diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:38 -0400 |
commit | 48b32a3553a54740d236b79a90f20147a25875e3 (patch) | |
tree | faf6807facb5825608469a9e33c9127f90b974df /include | |
parent | 8ecbe550a142fe604874afa477ea68986f89b86c (diff) |
reiserfs: use generic xattr handlers
Christoph Hellwig had asked me quite some time ago to port the reiserfs
xattrs to the generic xattr interface.
This patch replaces the reiserfs-specific xattr handling code with the
generic struct xattr_handler.
However, since reiserfs doesn't split the prefix and name when accessing
xattrs, it can't leverage generic_{set,get,list,remove}xattr without
needlessly reconstructing the name on the back end.
Update 7/26/07: Added missing dput() to deletion path.
Update 8/30/07: Added missing mark_inode_dirty when i_mode is used to
represent an ACL and no previous ACL existed.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/reiserfs_acl.h | 16 | ||||
-rw-r--r-- | include/linux/reiserfs_fs_sb.h | 3 | ||||
-rw-r--r-- | include/linux/reiserfs_xattr.h | 25 |
3 files changed, 9 insertions, 35 deletions
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h index fe00f781a622..d180446470f2 100644 --- a/include/linux/reiserfs_acl.h +++ b/include/linux/reiserfs_acl.h | |||
@@ -52,10 +52,8 @@ int reiserfs_acl_chmod(struct inode *inode); | |||
52 | int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, | 52 | int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, |
53 | struct inode *inode); | 53 | struct inode *inode); |
54 | int reiserfs_cache_default_acl(struct inode *dir); | 54 | int reiserfs_cache_default_acl(struct inode *dir); |
55 | extern int reiserfs_xattr_posix_acl_init(void) __init; | 55 | extern struct xattr_handler reiserfs_posix_acl_default_handler; |
56 | extern int reiserfs_xattr_posix_acl_exit(void); | 56 | extern struct xattr_handler reiserfs_posix_acl_access_handler; |
57 | extern struct reiserfs_xattr_handler posix_acl_default_handler; | ||
58 | extern struct reiserfs_xattr_handler posix_acl_access_handler; | ||
59 | 57 | ||
60 | static inline void reiserfs_init_acl_access(struct inode *inode) | 58 | static inline void reiserfs_init_acl_access(struct inode *inode) |
61 | { | 59 | { |
@@ -75,16 +73,6 @@ static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
75 | return NULL; | 73 | return NULL; |
76 | } | 74 | } |
77 | 75 | ||
78 | static inline int reiserfs_xattr_posix_acl_init(void) | ||
79 | { | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static inline int reiserfs_xattr_posix_acl_exit(void) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static inline int reiserfs_acl_chmod(struct inode *inode) | 76 | static inline int reiserfs_acl_chmod(struct inode *inode) |
89 | { | 77 | { |
90 | return 0; | 78 | return 0; |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index c8aee41ccc23..4686b90886ed 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -451,7 +451,6 @@ enum reiserfs_mount_options { | |||
451 | REISERFS_NO_UNHASHED_RELOCATION, | 451 | REISERFS_NO_UNHASHED_RELOCATION, |
452 | REISERFS_HASHED_RELOCATION, | 452 | REISERFS_HASHED_RELOCATION, |
453 | REISERFS_ATTRS, | 453 | REISERFS_ATTRS, |
454 | REISERFS_XATTRS, | ||
455 | REISERFS_XATTRS_USER, | 454 | REISERFS_XATTRS_USER, |
456 | REISERFS_POSIXACL, | 455 | REISERFS_POSIXACL, |
457 | REISERFS_BARRIER_NONE, | 456 | REISERFS_BARRIER_NONE, |
@@ -489,7 +488,7 @@ enum reiserfs_mount_options { | |||
489 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) | 488 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) |
490 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) | 489 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) |
491 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) | 490 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) |
492 | #define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS)) | 491 | #define reiserfs_xattrs(s) ((s)->s_xattr != NULL) |
493 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) | 492 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) |
494 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) | 493 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) |
495 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) | 494 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 3bd154fd56e9..958fcaca0e8b 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -29,20 +29,6 @@ struct iattr; | |||
29 | struct super_block; | 29 | struct super_block; |
30 | struct nameidata; | 30 | struct nameidata; |
31 | 31 | ||
32 | struct reiserfs_xattr_handler { | ||
33 | char *prefix; | ||
34 | int (*init) (void); | ||
35 | void (*exit) (void); | ||
36 | int (*get) (struct inode * inode, const char *name, void *buffer, | ||
37 | size_t size); | ||
38 | int (*set) (struct inode * inode, const char *name, const void *buffer, | ||
39 | size_t size, int flags); | ||
40 | int (*del) (struct inode * inode, const char *name); | ||
41 | int (*list) (struct inode * inode, const char *name, int namelen, | ||
42 | char *out); | ||
43 | struct list_head handlers; | ||
44 | }; | ||
45 | |||
46 | int reiserfs_xattr_register_handlers(void) __init; | 32 | int reiserfs_xattr_register_handlers(void) __init; |
47 | void reiserfs_xattr_unregister_handlers(void); | 33 | void reiserfs_xattr_unregister_handlers(void); |
48 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | 34 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); |
@@ -59,13 +45,14 @@ ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | |||
59 | int reiserfs_removexattr(struct dentry *dentry, const char *name); | 45 | int reiserfs_removexattr(struct dentry *dentry, const char *name); |
60 | int reiserfs_permission(struct inode *inode, int mask); | 46 | int reiserfs_permission(struct inode *inode, int mask); |
61 | 47 | ||
62 | int reiserfs_xattr_del(struct inode *, const char *); | 48 | int reiserfs_xattr_get(struct inode *, const char *, void *, size_t); |
63 | int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); | 49 | int __reiserfs_xattr_set(struct inode *, const char *, const void *, |
50 | size_t, int); | ||
64 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); | 51 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); |
65 | 52 | ||
66 | extern struct reiserfs_xattr_handler user_handler; | 53 | extern struct xattr_handler reiserfs_xattr_user_handler; |
67 | extern struct reiserfs_xattr_handler trusted_handler; | 54 | extern struct xattr_handler reiserfs_xattr_trusted_handler; |
68 | extern struct reiserfs_xattr_handler security_handler; | 55 | extern struct xattr_handler reiserfs_xattr_security_handler; |
69 | 56 | ||
70 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | 57 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) |
71 | { | 58 | { |