mirror of
https://github.com/samba-team/samba.git
synced 2025-03-24 10:50:22 +03:00
s3: VFS: Change SMB_VFS_DISK_FREE to use const struct smb_filename * instead of const char *.
We need to migrate all pathname based VFS calls to use a struct to finish modernising the VFS with extra timestamp and flags parameters. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
This commit is contained in:
parent
730de8e091
commit
0037815453
@ -44,9 +44,11 @@ static void skel_disconnect(vfs_handle_struct *handle)
|
||||
;
|
||||
}
|
||||
|
||||
static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
static uint64_t skel_disk_free(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
*bsize = 0;
|
||||
*dfree = 0;
|
||||
|
@ -48,11 +48,13 @@ static void skel_disconnect(vfs_handle_struct *handle)
|
||||
SMB_VFS_NEXT_DISCONNECT(handle);
|
||||
}
|
||||
|
||||
static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
static uint64_t skel_disk_free(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize);
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
static int skel_get_quota(vfs_handle_struct *handle, const char *path,
|
||||
|
@ -216,6 +216,8 @@
|
||||
/* Version 37 - Change mknod from const char * to const struct smb_filename * */
|
||||
/* Version 37 - Change chflags from const char *
|
||||
to const struct smb_filename * */
|
||||
/* Version 37 - Change disk_free from const char *
|
||||
to const struct smb_filename * */
|
||||
|
||||
#define SMB_VFS_INTERFACE_VERSION 37
|
||||
|
||||
@ -600,8 +602,11 @@ struct vfs_fn_pointers {
|
||||
|
||||
int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user);
|
||||
void (*disconnect_fn)(struct vfs_handle_struct *handle);
|
||||
uint64_t (*disk_free_fn)(struct vfs_handle_struct *handle, const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize);
|
||||
uint64_t (*disk_free_fn)(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize);
|
||||
int (*get_quota_fn)(struct vfs_handle_struct *handle, const char *path,
|
||||
enum SMB_QUOTA_TYPE qtype, unid_t id,
|
||||
SMB_DISK_QUOTA *qt);
|
||||
@ -1056,8 +1061,10 @@ int smb_vfs_call_connect(struct vfs_handle_struct *handle,
|
||||
const char *service, const char *user);
|
||||
void smb_vfs_call_disconnect(struct vfs_handle_struct *handle);
|
||||
uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize);
|
||||
const struct smb_filename *smb_filename,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize);
|
||||
int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
|
||||
enum SMB_QUOTA_TYPE qtype, unid_t id,
|
||||
SMB_DISK_QUOTA *qt);
|
||||
|
@ -39,10 +39,10 @@
|
||||
#define SMB_VFS_NEXT_DISCONNECT(handle) \
|
||||
smb_vfs_call_disconnect((handle)->next)
|
||||
|
||||
#define SMB_VFS_DISK_FREE(conn, path, bsize, dfree ,dsize) \
|
||||
smb_vfs_call_disk_free((conn)->vfs_handles, (path), (bsize), (dfree), (dsize))
|
||||
#define SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree ,dsize)\
|
||||
smb_vfs_call_disk_free((handle)->next, (path), (bsize), (dfree), (dsize))
|
||||
#define SMB_VFS_DISK_FREE(conn, smb_fname, bsize, dfree ,dsize) \
|
||||
smb_vfs_call_disk_free((conn)->vfs_handles, (smb_fname), (bsize), (dfree), (dsize))
|
||||
#define SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree ,dsize)\
|
||||
smb_vfs_call_disk_free((handle)->next, (smb_fname), (bsize), (dfree), (dsize))
|
||||
|
||||
#define SMB_VFS_GET_QUOTA(conn, path, qtype, id, qt) \
|
||||
smb_vfs_call_get_quota((conn)->vfs_handles, (path), (qtype), (id), (qt))
|
||||
|
@ -29,16 +29,31 @@
|
||||
static char *capencode(TALLOC_CTX *ctx, const char *from);
|
||||
static char *capdecode(TALLOC_CTX *ctx, const char *from);
|
||||
|
||||
static uint64_t cap_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
|
||||
static uint64_t cap_disk_free(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
char *cappath = capencode(talloc_tos(), path);
|
||||
char *capname = capencode(talloc_tos(), smb_fname->base_name);
|
||||
struct smb_filename *cap_smb_fname = NULL;
|
||||
|
||||
if (!cappath) {
|
||||
if (!capname) {
|
||||
errno = ENOMEM;
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, cappath, bsize, dfree, dsize);
|
||||
cap_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
capname,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (cap_smb_fname == NULL) {
|
||||
TALLOC_FREE(capname);
|
||||
errno = ENOMEM;
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, cap_smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
static int cap_get_quota(vfs_handle_struct *handle, const char *path,
|
||||
|
@ -175,13 +175,16 @@ static void cephwrap_disconnect(struct vfs_handle_struct *handle)
|
||||
/* Disk operations */
|
||||
|
||||
static uint64_t cephwrap_disk_free(struct vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
struct statvfs statvfs_buf;
|
||||
int ret;
|
||||
|
||||
if (!(ret = ceph_statfs(handle->data, path, &statvfs_buf))) {
|
||||
if (!(ret = ceph_statfs(handle->data, smb_fname->base_name,
|
||||
&statvfs_buf))) {
|
||||
/*
|
||||
* Provide all the correct values.
|
||||
*/
|
||||
|
@ -55,11 +55,13 @@ static void vfswrap_disconnect(vfs_handle_struct *handle)
|
||||
|
||||
/* Disk operations */
|
||||
|
||||
static uint64_t vfswrap_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
uint64_t *bsize, uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
static uint64_t vfswrap_disk_free(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
if (sys_fsusage(path, dfree, dsize) != 0) {
|
||||
if (sys_fsusage(smb_fname->base_name, dfree, dsize) != 0) {
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,11 @@ static uint64_t dfq_load_param(int snum, const char *path, const char *section,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint64_t dfq_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
|
||||
static uint64_t dfq_disk_free(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
uint64_t free_1k;
|
||||
int snum = SNUM(handle->conn);
|
||||
@ -61,13 +64,13 @@ static uint64_t dfq_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
/* look up the params based on real path to be resilient
|
||||
* to refactoring of path<->realpath
|
||||
*/
|
||||
rpath = SMB_VFS_NEXT_REALPATH(handle, path);
|
||||
rpath = SMB_VFS_NEXT_REALPATH(handle, smb_fname->base_name);
|
||||
if (rpath != NULL) {
|
||||
dfq_bsize = dfq_load_param(snum, rpath, "df", "block size", 0);
|
||||
}
|
||||
if (dfq_bsize == 0) {
|
||||
SAFE_FREE(rpath);
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree,
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree,
|
||||
dsize);
|
||||
}
|
||||
|
||||
|
@ -676,16 +676,18 @@ static void smb_full_audit_disconnect(vfs_handle_struct *handle)
|
||||
}
|
||||
|
||||
static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
uint64_t result;
|
||||
|
||||
result = SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize);
|
||||
result = SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
|
||||
|
||||
/* Don't have a reasonable notion of failure here */
|
||||
|
||||
do_log(SMB_VFS_OP_DISK_FREE, True, handle, "%s", path);
|
||||
do_log(SMB_VFS_OP_DISK_FREE, True, handle, "%s", smb_fname->base_name);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -375,13 +375,15 @@ static void vfs_gluster_disconnect(struct vfs_handle_struct *handle)
|
||||
}
|
||||
|
||||
static uint64_t vfs_gluster_disk_free(struct vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize_p,
|
||||
uint64_t *dfree_p, uint64_t *dsize_p)
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize_p,
|
||||
uint64_t *dfree_p,
|
||||
uint64_t *dsize_p)
|
||||
{
|
||||
struct statvfs statvfs = { 0, };
|
||||
int ret;
|
||||
|
||||
ret = glfs_statvfs(handle->data, path, &statvfs);
|
||||
ret = glfs_statvfs(handle->data, smb_fname->base_name, &statvfs);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -2160,9 +2160,11 @@ static void vfs_gpfs_disk_free_quota(struct gpfs_quotaInfo qi, time_t cur_time,
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
struct security_unix_token *utok;
|
||||
struct gpfs_quotaInfo qi_user = { 0 }, qi_group = { 0 };
|
||||
@ -2173,14 +2175,14 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config, struct gpfs_config_data,
|
||||
return (uint64_t)-1);
|
||||
if (!config->dfreequota) {
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path,
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
err = sys_fsusage(path, dfree, dsize);
|
||||
err = sys_fsusage(smb_fname->base_name, dfree, dsize);
|
||||
if (err) {
|
||||
DEBUG (0, ("Could not get fs usage, errno %d\n", errno));
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path,
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
@ -2192,15 +2194,17 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path,
|
||||
|
||||
utok = handle->conn->session_info->unix_token;
|
||||
|
||||
err = get_gpfs_quota(path, GPFS_USRQUOTA, utok->uid, &qi_user);
|
||||
err = get_gpfs_quota(smb_fname->base_name,
|
||||
GPFS_USRQUOTA, utok->uid, &qi_user);
|
||||
if (err) {
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path,
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
err = get_gpfs_quota(path, GPFS_GRPQUOTA, utok->gid, &qi_group);
|
||||
err = get_gpfs_quota(smb_fname->base_name,
|
||||
GPFS_GRPQUOTA, utok->gid, &qi_group);
|
||||
if (err) {
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path,
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
|
@ -2742,40 +2742,53 @@ done:
|
||||
}
|
||||
|
||||
static uint64_t shadow_copy2_disk_free(vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
time_t timestamp = 0;
|
||||
char *stripped = NULL;
|
||||
ssize_t ret;
|
||||
int saved_errno = 0;
|
||||
char *conv;
|
||||
char *conv = NULL;
|
||||
struct smb_filename *conv_smb_fname = NULL;
|
||||
uint64_t ret = (uint64_t)-1;
|
||||
|
||||
if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, path,
|
||||
×tamp, &stripped)) {
|
||||
return -1;
|
||||
if (!shadow_copy2_strip_snapshot(talloc_tos(),
|
||||
handle,
|
||||
smb_fname->base_name,
|
||||
×tamp,
|
||||
&stripped)) {
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path,
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
|
||||
TALLOC_FREE(stripped);
|
||||
if (conv == NULL) {
|
||||
return -1;
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_DISK_FREE(handle, conv, bsize, dfree, dsize);
|
||||
|
||||
if (ret == -1) {
|
||||
conv_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
conv,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (conv_smb_fname == NULL) {
|
||||
TALLOC_FREE(conv);
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
ret = SMB_VFS_NEXT_DISK_FREE(handle, conv_smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
if (ret == (uint64_t)-1) {
|
||||
saved_errno = errno;
|
||||
}
|
||||
TALLOC_FREE(conv);
|
||||
TALLOC_FREE(conv_smb_fname);
|
||||
if (saved_errno != 0) {
|
||||
errno = saved_errno;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2982,36 +2982,53 @@ static int snapper_gmt_get_real_filename(struct vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static uint64_t snapper_gmt_disk_free(vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
time_t timestamp;
|
||||
char *stripped;
|
||||
ssize_t ret;
|
||||
int saved_errno;
|
||||
char *conv;
|
||||
time_t timestamp = 0;
|
||||
char *stripped = NULL;
|
||||
uint64_t ret;
|
||||
int saved_errno = 0;
|
||||
char *conv = NULL;
|
||||
struct smb_filename *conv_smb_fname = NULL;
|
||||
|
||||
if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, path,
|
||||
×tamp, &stripped)) {
|
||||
return -1;
|
||||
if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
|
||||
smb_fname->base_name, ×tamp, &stripped)) {
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, path,
|
||||
return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
|
||||
TALLOC_FREE(stripped);
|
||||
if (conv == NULL) {
|
||||
return -1;
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
conv_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
conv,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (conv_smb_fname == NULL) {
|
||||
TALLOC_FREE(conv);
|
||||
errno = ENOMEM;
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_DISK_FREE(handle, conv, bsize, dfree, dsize);
|
||||
|
||||
saved_errno = errno;
|
||||
TALLOC_FREE(conv);
|
||||
errno = saved_errno;
|
||||
ret = SMB_VFS_NEXT_DISK_FREE(handle, conv_smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
|
||||
if (ret == (uint64_t)-1) {
|
||||
saved_errno = errno;
|
||||
}
|
||||
TALLOC_FREE(conv_smb_fname);
|
||||
if (saved_errno != 0) {
|
||||
errno = saved_errno;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -157,21 +157,25 @@ static void smb_time_audit_disconnect(vfs_handle_struct *handle)
|
||||
}
|
||||
|
||||
static uint64_t smb_time_audit_disk_free(vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
uint64_t result;
|
||||
struct timespec ts1,ts2;
|
||||
double timediff;
|
||||
|
||||
clock_gettime_mono(&ts1);
|
||||
result = SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize);
|
||||
result = SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
|
||||
clock_gettime_mono(&ts2);
|
||||
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
|
||||
|
||||
/* Don't have a reasonable notion of failure here */
|
||||
if (timediff > audit_timeout) {
|
||||
smb_time_audit_log_fname("disk_free", timediff, path);
|
||||
smb_time_audit_log_fname("disk_free",
|
||||
timediff,
|
||||
smb_fname->base_name);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -118,7 +118,7 @@ uint64_t sys_disk_free(connection_struct *conn, struct smb_filename *fname,
|
||||
syscmd, strerror(errno) ));
|
||||
}
|
||||
|
||||
if (SMB_VFS_DISK_FREE(conn, path, bsize, dfree, dsize) ==
|
||||
if (SMB_VFS_DISK_FREE(conn, fname, bsize, dfree, dsize) ==
|
||||
(uint64_t)-1) {
|
||||
DBG_ERR("VFS disk_free failed. Error was : %s\n",
|
||||
strerror(errno));
|
||||
|
@ -1468,11 +1468,14 @@ void smb_vfs_call_disconnect(struct vfs_handle_struct *handle)
|
||||
}
|
||||
|
||||
uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
|
||||
const char *path, uint64_t *bsize,
|
||||
uint64_t *dfree, uint64_t *dsize)
|
||||
const struct smb_filename *smb_fname,
|
||||
uint64_t *bsize,
|
||||
uint64_t *dfree,
|
||||
uint64_t *dsize)
|
||||
{
|
||||
VFS_FIND(disk_free);
|
||||
return handle->fns->disk_free_fn(handle, path, bsize, dfree, dsize);
|
||||
return handle->fns->disk_free_fn(handle, smb_fname,
|
||||
bsize, dfree, dsize);
|
||||
}
|
||||
|
||||
int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
|
||||
|
@ -116,13 +116,23 @@ static NTSTATUS cmd_disconnect(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
|
||||
|
||||
static NTSTATUS cmd_disk_free(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
|
||||
{
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
uint64_t diskfree, bsize, dfree, dsize;
|
||||
if (argc != 2) {
|
||||
printf("Usage: disk_free <path>\n");
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
diskfree = SMB_VFS_DISK_FREE(vfs->conn, argv[1], &bsize, &dfree, &dsize);
|
||||
smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
argv[1],
|
||||
NULL,
|
||||
NULL,
|
||||
ssf_flags());
|
||||
if (smb_fname == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
diskfree = SMB_VFS_DISK_FREE(vfs->conn, smb_fname,
|
||||
&bsize, &dfree, &dsize);
|
||||
printf("disk_free: %lu, bsize = %lu, dfree = %lu, dsize = %lu\n",
|
||||
(unsigned long)diskfree,
|
||||
(unsigned long)bsize,
|
||||
|
Loading…
x
Reference in New Issue
Block a user