snapper: add snap_dir_expand VFS op handler
authorDavid Disseldorp <ddiss@samba.org>
Mon, 5 Nov 2012 12:31:01 +0000 (13:31 +0100)
committerDavid Disseldorp <ddiss@samba.org>
Mon, 15 Apr 2013 16:15:22 +0000 (18:15 +0200)
source3/modules/vfs_snapper.c

index d45121b2de6f799af322071e931a2f6affc72bf0..62eecf7af8c0944d89163e35e5abdb13c987c5ea 100644 (file)
@@ -28,9 +28,6 @@
 #include "smbd/smbd.h"
 #include "lib/util/tevent_ntstatus.h"
 
-/* include common @GMT token filter code */
-#include "vfs_gmt_tok_common.c"
-
 #define SNAPPER_SIG_LIST_SNAPS_RSP "a(uqutussa{ss})"
 #define SNAPPER_SIG_LIST_CONFS_RSP "a(ssa{ss})"
 #define SNAPPER_SIG_CREATE_SNAP_RSP "u"
@@ -1527,10 +1524,10 @@ err_out:
        return status;
 }
 
-/* callout for vfs_gmt_tok_common.c */
-static char *gmt_tok_insert_string(TALLOC_CTX *mem_ctx,
-                                  struct vfs_handle_struct *handle,
-                                  time_t snap_time)
+static NTSTATUS snapper_snap_dir_expand(struct vfs_handle_struct *handle,
+                                       TALLOC_CTX *mem_ctx,
+                                       time_t snap_time,
+                                       char **snap_dir_out)
 {
        DBusConnection *dconn;
        NTSTATUS status;
@@ -1581,8 +1578,9 @@ static char *gmt_tok_insert_string(TALLOC_CTX *mem_ctx,
        talloc_free(conf_name);
        talloc_free(base_path);
        dbus_connection_unref(dconn);
+       *snap_dir_out = snap_path_nobase;
 
-       return snap_path_nobase;
+       return NT_STATUS_OK;
 
 err_snap_path_free:
        talloc_free(snap_path);
@@ -1592,7 +1590,7 @@ err_conf_name_free:
 err_conn_free:
        dbus_connection_unref(dconn);
 err_out:
-       return NULL;
+       return status;
 }
 
 static struct vfs_fn_pointers snapper_fns = {
@@ -1602,34 +1600,7 @@ static struct vfs_fn_pointers snapper_fns = {
        .snap_delete_send_fn = snapper_snap_delete_send,
        .snap_delete_recv_fn = snapper_snap_delete_recv,
        .get_shadow_copy_data_fn = snapper_get_shadow_copy_data,
-       /* use common @GMT token wrapper fns */
-       .opendir_fn = gmt_tok_opendir,
-       .rename_fn = gmt_tok_rename,
-       .link_fn = gmt_tok_link,
-       .symlink_fn = gmt_tok_symlink,
-       .stat_fn = gmt_tok_stat,
-       .lstat_fn = gmt_tok_lstat,
-       .fstat_fn = gmt_tok_fstat,
-       .open_fn = gmt_tok_open,
-       .unlink_fn = gmt_tok_unlink,
-       .chmod_fn = gmt_tok_chmod,
-       .chown_fn = gmt_tok_chown,
-       .chdir_fn = gmt_tok_chdir,
-       .ntimes_fn = gmt_tok_ntimes,
-       .readlink_fn = gmt_tok_readlink,
-       .mknod_fn = gmt_tok_mknod,
-       .realpath_fn = gmt_tok_realpath,
-       .get_nt_acl_fn = gmt_tok_get_nt_acl,
-       .fget_nt_acl_fn = gmt_tok_fget_nt_acl,
-       .mkdir_fn = gmt_tok_mkdir,
-       .rmdir_fn = gmt_tok_rmdir,
-       .getxattr_fn = gmt_tok_getxattr,
-       .listxattr_fn = gmt_tok_listxattr,
-       .removexattr_fn = gmt_tok_removexattr,
-       .setxattr_fn = gmt_tok_setxattr,
-       .chmod_acl_fn = gmt_tok_chmod_acl,
-       .chflags_fn = gmt_tok_chflags,
-       .get_real_filename_fn = gmt_tok_get_real_filename,
+       .snap_dir_expand_fn = snapper_snap_dir_expand,
 };
 
 NTSTATUS vfs_snapper_init(void);