Added EA operations to VFS layer.
authorJeremy Allison <jra@samba.org>
Fri, 6 Jun 2003 00:04:27 +0000 (00:04 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 6 Jun 2003 00:04:27 +0000 (00:04 +0000)
Jeremy.
(This used to be commit 024de9213e414659296cb518a6753e510c64f614)

source3/include/vfs.h
source3/include/vfs_macros.h
source3/smbd/vfs-wrap.c
source3/smbd/vfs.c

index 85e641c1c41d9c6e47ed615ad7fcd119cc33d253..924d7063217b3bdbadac36f43a1251890d982093 100644 (file)
@@ -1,6 +1,7 @@
 /* 
    Unix SMB/CIFS implementation.
    VFS structures and parameters
+   Copyright (C) Jeremy Allison                         1999-2003
    Copyright (C) Tim Potter                            1999
    Copyright (C) Alexander Bokovoy                     2002
    Copyright (C) Stefan (metze) Metzmacher             2003
 /* Changed to version 4 for cascaded VFS interface. Alexander Bokovoy. */
 /* Changed to version 5 for sendfile addition. JRA. */
 /* Changed to version 6 for the new module system, fixed cascading and quota functions. --metze */
-/* Version 7 to include the get_nt_acl info parameter. JRA. */
-#define SMB_VFS_INTERFACE_VERSION 7
+/* Changed to version 7 to include the get_nt_acl info parameter. JRA. */
+/* Changed to version 8 includes EA calls. JRA. */
+
+#define SMB_VFS_INTERFACE_VERSION 8
 
 
 /* to bug old modules witch are trying to compile with the old functions */
-#define vfs_init __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_6_donot_use_vfs_init_anymore(void) { __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_6_donot_use_vfs_init_anymore };
+#define vfs_init __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore(void) { __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore };
 #define lp_parm_string __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string { \
   __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string };
 #define lp_vfs_options __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead { \
@@ -161,6 +164,20 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_SYS_ACL_FREE_ACL,
        SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,
        
+       /* EA operations. */
+       SMB_VFS_OP_GETXATTR,
+       SMB_VFS_OP_LGETXATTR,
+       SMB_VFS_OP_FGETXATTR,
+       SMB_VFS_OP_LISTXATTR,
+       SMB_VFS_OP_LLISTXATTR,
+       SMB_VFS_OP_FLISTXATTR,
+       SMB_VFS_OP_REMOVEXATTR,
+       SMB_VFS_OP_LREMOVEXATTR,
+       SMB_VFS_OP_FREMOVEXATTR,
+       SMB_VFS_OP_SETXATTR,
+       SMB_VFS_OP_LSETXATTR,
+       SMB_VFS_OP_FSETXATTR,
+
        /* This should always be last enum value */
        
        SMB_VFS_OP_LAST
@@ -251,6 +268,21 @@ struct vfs_ops {
                int (*sys_acl_free_text)(struct vfs_handle_struct *handle, struct connection_struct *conn, char *text);
                int (*sys_acl_free_acl)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_ACL_T posix_acl);
                int (*sys_acl_free_qualifier)(struct vfs_handle_struct *handle, struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype);
+
+               /* EA operations. */
+               ssize_t (*getxattr)(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size);
+               ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size);
+               ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size);
+               ssize_t (*listxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size);
+               ssize_t (*llistxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size);
+               ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size);
+               int (*removexattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name);
+               int (*lremovexattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name);
+               int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name);
+               int (*setxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags);
+               int (*lsetxattr)(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags);
+               int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags);
+
        } ops;
 
        struct vfs_handles_pointers {
@@ -333,6 +365,20 @@ struct vfs_ops {
                struct vfs_handle_struct *sys_acl_free_text;
                struct vfs_handle_struct *sys_acl_free_acl;
                struct vfs_handle_struct *sys_acl_free_qualifier;
+
+               /* EA operations. */
+               struct vfs_handle_struct *getxattr;
+               struct vfs_handle_struct *lgetxattr;
+               struct vfs_handle_struct *fgetxattr;
+               struct vfs_handle_struct *listxattr;
+               struct vfs_handle_struct *llistxattr;
+               struct vfs_handle_struct *flistxattr;
+               struct vfs_handle_struct *removexattr;
+               struct vfs_handle_struct *lremovexattr;
+               struct vfs_handle_struct *fremovexattr;
+               struct vfs_handle_struct *setxattr;
+               struct vfs_handle_struct *lsetxattr;
+               struct vfs_handle_struct *fsetxattr;
        } handles;
 };
 
index 6510246f4564034ec2b19032a3d8ddf0a3c722bb..87a3773372e215790d567babc04878f2076e42b8 100644 (file)
 #define SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl) ((conn)->vfs.ops.sys_acl_free_acl((conn)->vfs.handles.sys_acl_free_acl, (conn), (posix_acl)))
 #define SMB_VFS_SYS_ACL_FREE_QUALIFIER(conn, qualifier, tagtype) ((conn)->vfs.ops.sys_acl_free_qualifier((conn)->vfs.handles.sys_acl_free_qualifier, (conn), (qualifier), (tagtype)))
 
+/* EA operations. */
+#define SMB_VFS_GETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.getxattr((conn)->vfs.handles.getxattr,(conn),(path),(name),(value),(size)))
+#define SMB_VFS_LGETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.lgetxattr((conn)->vfs.handles.lgetxattr,(conn),(path),(name),(value),(size)))
+#define SMB_VFS_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(fd),(value),(size)))
+#define SMB_VFS_LISTXATTR(conn,path,list,size) ((conn)->vfs.ops.listxattr((conn)->vfs.handles.listxattr,(conn),(path),(list),(size)))
+#define SMB_VFS_LLISTXATTR(conn,path,list,size) ((conn)->vfs.ops.llistxattr((conn)->vfs.handles.llistxattr,(conn),(path),(list),(size)))
+#define SMB_VFS_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_REMOVEXATTR(conn,path,name) (((conn)->vfs.ops.removexattr((conn)->vfs.handles.removeattr,(conn),(path),(name)))
+#define SMB_VFS_LREMOVEXATTR(conn,path,name) (((conn)->vfs.ops.lremovexattr((conn)->vfs.handles.lremoveattr,(conn),(path),(name)))
+#define SMB_VFS_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.setxattr((conn)->vfs.handles.setxattr,(conn),(path),(name),(value),(size),(flags)))
+#define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.lsetxattr((conn)->vfs.handles.lsetxattr,(conn),(path),(name),(value),(size),(flags)))
+#define SMB_VFS_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
 
 /*******************************************************************
  Don't access conn->vfs_opaque.ops directly!!!
 #define SMB_VFS_OPAQUE_SYS_ACL_FREE_ACL(conn, posix_acl) ((conn)->vfs_opaque.ops.sys_acl_free_acl((conn)->vfs_opaque.handles.sys_acl_free_acl, (conn), (posix_acl)))
 #define SMB_VFS_OPAQUE_SYS_ACL_FREE_QUALIFIER(conn, qualifier, tagtype) ((conn)->vfs_opaque.ops.sys_acl_free_qualifier((conn)->vfs_opaque.handles.sys_acl_free_qualifier, (conn), (qualifier), (tagtype)))
 
+/* EA operations. */
+#define SMB_VFS_OPAQUE_GETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.getxattr((conn)->vfs_opaque.handles.getxattr,(conn),(path),(name),(value),(size)))
+#define SMB_VFS_OPAQUE_LGETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.lgetxattr((conn)->vfs_opaque.handles.lgetxattr,(conn),(path),(name),(value),(size)))
+#define SMB_VFS_OPAQUE_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(fd),(value),(size)))
+#define SMB_VFS_OPAQUE_LISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.listxattr((conn)->vfs_opaque.handles.listxattr,(conn),(path),(list),(size)))
+#define SMB_VFS_OPAQUE_LLISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.llistxattr((conn)->vfs_opaque.handles.llistxattr,(conn),(path),(list),(size)))
+#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_OPAQUE_REMOVEXATTR(conn,path,name) (((conn)->vfs_opaque.ops.removexattr((conn)->vfs_opaque.handles.removeattr,(conn),(path),(name)))
+#define SMB_VFS_OPAQUE_LREMOVEXATTR(conn,path,name) (((conn)->vfs_opaque.ops.lremovexattr((conn)->vfs_opaque.handles.lremoveattr,(conn),(path),(name)))
+#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_OPAQUE_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.setxattr((conn)->vfs_opaque.handles.setxattr,(conn),(path),(name),(value),(size),(flags)))
+#define SMB_VFS_OPAQUE_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.lsetxattr((conn)->vfs_opaque.handles.lsetxattr,(conn),(path),(name),(value),(size),(flags)))
+#define SMB_VFS_OPAQUE_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
 
 /*******************************************************************
  Don't access handle->vfs_next.ops.* directly!!!
 #define SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, conn, posix_acl) ((handle)->vfs_next.ops.sys_acl_free_acl((handle)->vfs_next.handles.sys_acl_free_acl, (conn), (posix_acl)))
 #define SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, conn, qualifier, tagtype) ((handle)->vfs_next.ops.sys_acl_free_qualifier((handle)->vfs_next.handles.sys_acl_free_qualifier, (conn), (qualifier), (tagtype)))
 
+/* EA operations. */
+#define SMB_VFS_NEXT_GETXATTR(handle,conn,path,name,value,size) ((handle)->vfs_next.ops.getxattr((handle)->vfs_next.handles.getxattr,(conn),(path),(name),(value),(size)))
+#define SMB_VFS_NEXT_LGETXATTR(handle,conn,path,name,value,size) ((handle)->vfs_next.ops.lgetxattr((handle)->vfs_next.handles.lgetxattr,(conn),(path),(name),(value),(size)))
+#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,fd,name,value,size) ((handle)->conn->vfs_next.ops.fgetxattr((handle)->conn->vfs_next.handles.fgetxattr,(fsp),(fd),(value),(size)))
+#define SMB_VFS_NEXT_LISTXATTR(handle,conn,path,list,size) ((handle)->vfs_next.ops.listxattr((handle)->vfs_next.handles.listxattr,(conn),(path),(list),(size)))
+#define SMB_VFS_NEXT_LLISTXATTR(handle,conn,path,list,size) ((handle)->vfs_next.ops.llistxattr((handle)->vfs_next.handles.llistxattr,(conn),(path),(list),(size)))
+#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,fd,list,size) ((handle)->conn->vfs_next.ops.flistxattr((handle)->conn->vfs_next.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_NEXT_REMOVEXATTR(handle,conn,path,name) (((handle)->vfs_next.ops.removexattr((handle)->vfs_next.handles.removeattr,(conn),(path),(name)))
+#define SMB_VFS_NEXT_LREMOVEXATTR(handle,conn,path,name) (((handle)->vfs_next.ops.lremovexattr((handle)->vfs_next.handles.lremoveattr,(conn),(path),(name)))
+#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,fd,name) ((handle)->conn->vfs_next.ops.fremovexattr((handle)->conn->vfs_next.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_NEXT_SETXATTR(handle,conn,path,name,value,size,flags) ((handle)->vfs_next.ops.setxattr((handle)->vfs_next.handles.setxattr,(conn),(path),(name),(value),(size),(flags)))
+#define SMB_VFS_NEXT_LSETXATTR(handle,conn,path,name,value,size,flags) ((handle)->vfs_next.ops.lsetxattr((handle)->vfs_next.handles.lsetxattr,(conn),(path),(name),(value),(size),(flags)))
+#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,fd,name,value,size,flags) ((handle)->conn->vfs_next.ops.fsetxattr((handle)->conn->vfs_next.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
 
 #endif /* _VFS_MACROS_H */
index f923d22aea23b26d517def61df8ce85ed121fc7a..8d44a1a0fa12ac44a45af07152986f89caa7d7f5 100644 (file)
@@ -785,3 +785,67 @@ int vfswrap_set_quota(struct vfs_handle_struct *handle, struct connection_struct
        return -1;
 #endif 
 }
+
+/****************************************************************
+ Extended attribute operations.
+*****************************************************************/
+
+ssize_t vfswrap_getxattr(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size)
+{
+       return sys_getxattr(path, name, value, size);
+}
+
+ssize_t vfswrap_lgetxattr(struct vfs_handle_struct *handle,struct connection_struct *conn,const char *path, const char *name, void *value, size_t size)
+{
+       return sys_lgetxattr(path, name, value, size);
+}
+
+ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size)
+{
+       return sys_fgetxattr(fd, name, value, size);
+}
+
+ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size)
+{
+       return sys_listxattr(path, list, size);
+}
+
+ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, char *list, size_t size)
+{
+       return sys_llistxattr(path, list, size);
+}
+
+ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size)
+{
+       return sys_flistxattr(fd, list, size);
+}
+
+int vfswrap_removexattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name)
+{
+       return sys_removexattr(path, name);
+}
+
+int vfswrap_lremovexattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name)
+{
+       return sys_lremovexattr(path, name);
+}
+
+int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name)
+{
+       return sys_fremovexattr(fd, name);
+}
+
+int vfswrap_setxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags)
+{
+       return sys_setxattr(path, name, value, size, flags);
+}
+
+int vfswrap_lsetxattr(struct vfs_handle_struct *handle, struct connection_struct *conn,const char *path, const char *name, const void *value, size_t size, int flags)
+{
+       return sys_lsetxattr(path, name, value, size, flags);
+}
+
+int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags)
+{
+       return sys_fsetxattr(fd, name, value, size, flags);
+}
index d24ae54d42ee7dcf1ad31cbfaa87a71d2182d8db..5f3abe7efea5b43dbda54b462cd9fcd6d4e36787 100644 (file)
@@ -94,6 +94,7 @@ static struct vfs_ops default_vfs = {
                vfswrap_mknod,
                vfswrap_realpath,
        
+               /* Windows ACL operations. */
                vfswrap_fget_nt_acl,
                vfswrap_get_nt_acl,
                vfswrap_fset_nt_acl,
@@ -124,7 +125,22 @@ static struct vfs_ops default_vfs = {
                vfswrap_sys_acl_get_perm,
                vfswrap_sys_acl_free_text,
                vfswrap_sys_acl_free_acl,
-               vfswrap_sys_acl_free_qualifier
+               vfswrap_sys_acl_free_qualifier,
+
+               /* EA operations. */
+               vfswrap_getxattr,
+               vfswrap_lgetxattr,
+               vfswrap_fgetxattr,
+               vfswrap_listxattr,
+               vfswrap_llistxattr,
+               vfswrap_flistxattr,
+               vfswrap_removexattr,
+               vfswrap_lremovexattr,
+               vfswrap_fremovexattr,
+               vfswrap_setxattr,
+               vfswrap_lsetxattr,
+               vfswrap_fsetxattr
+
        }
 };