s3: VFS: Change SMB_VFS_DISK_FREE to use const struct smb_filename * instead of const...
authorJeremy Allison <jra@samba.org>
Tue, 23 May 2017 17:40:47 +0000 (10:40 -0700)
committerJeremy Allison <jra@samba.org>
Sun, 18 Jun 2017 00:49:24 +0000 (02:49 +0200)
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>
17 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_cap.c
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/modules/vfs_fake_dfq.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_gpfs.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_snapper.c
source3/modules/vfs_time_audit.c
source3/smbd/dfree.c
source3/smbd/vfs.c
source3/torture/cmd_vfs.c

index aeb1ff37b5f8703eab3f493418580b0992355406..40951db35e31db688fef6420b96d82d50548eb7b 100644 (file)
@@ -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;
index f3adae3978fada2cfa69993b0e9527cc22150cce..83c0c2ae4d97a86ad6e02b7ed27bc0225d99a42b 100644 (file)
@@ -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,
index 93ec6e8f49a58344640de1f822c648323eb6634b..4a7179a094b886e5328bbaa498aa78746c88987a 100644 (file)
 /* 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);
index 701dc534984798610b98c1a6343f6fc06785ce42..cd34ec981c1dcc2bf0949822d2b72d19a439a118 100644 (file)
 #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))
index eba58961926f3d743a784bb014a24303957e802b..cf3bb94498c977d81206a7dabdcc58b83f162998 100644 (file)
 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;
+       }
+       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, cappath, bsize, dfree, dsize);
+       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,
index d936738ff5a81184f595a7a7f54ce80c4be7ae3e..1244468abed02ffcc2c7526d492b3e9f2b702b38 100644 (file)
@@ -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.
                 */
index b2c6c28f87b5dbd3cc37692c140676d68b1fd0d8..1c267287cff480fac7e4392ee73a48baaa8c6017 100644 (file)
@@ -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;
        }
 
index f13ec7de40ccf1b49629ae15c721569f6e0f8225..5e8879fe1cc12224ec972ada81d74ce84ea514c1 100644 (file)
@@ -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);
        }
 
index 634caf09a6145d6658ad54c707e59491408c6fee..916825767bfd209c2d7e46f4b0f939077448cc0f 100644 (file)
@@ -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;
 }
index 878c5078c588e249292d125bfa4288f2250eed64..cabb86120d9688d5e337b54e13e6d6e5f4c1d894 100644 (file)
@@ -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;
        }
index aeb0836b866ac1b26742efdff4a57815361b2c11..9898d44391555a0cae976c13c956e1c6f6ba0362 100644 (file)
@@ -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);
        }
 
index 35c08549afa60c2e211f3939c1d0b18255b888de..e1f30398c1d777ce4124d08e2475021525ee3bdd 100644 (file)
@@ -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,
-                                        &timestamp, &stripped)) {
-               return -1;
+       if (!shadow_copy2_strip_snapshot(talloc_tos(),
+                               handle,
+                               smb_fname->base_name,
+                               &timestamp,
+                               &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;
 }
 
index ec23c616aae045cfe60bf4fc9d71dbcfc6310168..774f7ee3c69e9e65516346e3294830e6436df21d 100644 (file)
@@ -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,
-                                       &timestamp, &stripped)) {
-               return -1;
+       if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
+                       smb_fname->base_name, &timestamp, &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;
 }
 
index aa882bb7700cc513db68d5b4168760382b06e5f8..092474fd0d8a607e9f3b80bd80b3533ede88d690 100644 (file)
@@ -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;
index 7e58daa45cf5d0bb642ed57e2a6c8e4a86b35007..a702d083a1170fc7543394b6500e5e6962f8da71 100644 (file)
@@ -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));
index 9248091153aef66e1dbe9e56d42d0bdc296dcfee..f91e9e33a021e4f1f96e41fcfc6905b5ae2c8a24 100644 (file)
@@ -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,
index 68def35277656399b07fed383f9ffbc779c1b17f..8d7d2a7f17504eced18c6cf30cd88646d54ff2b3 100644 (file)
@@ -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,