diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:39 -0400 |
commit | 57fe60df62410f949da094d06ced1dda9575b69c (patch) | |
tree | f3ba5db112cd7d2a8865d16bece28c38a766145c /include/linux | |
parent | a41f1a4715f26f7bc4d047d0bc7710145c8e69c7 (diff) |
reiserfs: add atomic addition of selinux attributes during inode creation
Some time ago, some changes were made to make security inode attributes
be atomically written during inode creation. ReiserFS fell behind in
this area, but with the reworking of the xattr code, it's now fairly
easy to add.
The following patch adds the ability for security attributes to be added
automatically during inode creation.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/reiserfs_fs.h | 4 | ||||
-rw-r--r-- | include/linux/reiserfs_xattr.h | 32 |
2 files changed, 35 insertions, 1 deletions
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index c0365e07fce6..eb4e912e6bd3 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1915,10 +1915,12 @@ void make_le_item_head(struct item_head *ih, const struct cpu_key *key, | |||
1915 | loff_t offset, int type, int length, int entry_count); | 1915 | loff_t offset, int type, int length, int entry_count); |
1916 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); | 1916 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); |
1917 | 1917 | ||
1918 | struct reiserfs_security_handle; | ||
1918 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | 1919 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, |
1919 | struct inode *dir, int mode, | 1920 | struct inode *dir, int mode, |
1920 | const char *symname, loff_t i_size, | 1921 | const char *symname, loff_t i_size, |
1921 | struct dentry *dentry, struct inode *inode); | 1922 | struct dentry *dentry, struct inode *inode, |
1923 | struct reiserfs_security_handle *security); | ||
1922 | 1924 | ||
1923 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, | 1925 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, |
1924 | struct inode *inode, loff_t size); | 1926 | struct inode *inode, loff_t size); |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 20eca09729a2..dcae01e63e40 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -15,6 +15,12 @@ struct reiserfs_xattr_header { | |||
15 | __le32 h_hash; /* hash of the value */ | 15 | __le32 h_hash; /* hash of the value */ |
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct reiserfs_security_handle { | ||
19 | char *name; | ||
20 | void *value; | ||
21 | size_t length; | ||
22 | }; | ||
23 | |||
18 | #ifdef __KERNEL__ | 24 | #ifdef __KERNEL__ |
19 | 25 | ||
20 | #include <linux/init.h> | 26 | #include <linux/init.h> |
@@ -54,6 +60,14 @@ int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *, | |||
54 | extern struct xattr_handler reiserfs_xattr_user_handler; | 60 | extern struct xattr_handler reiserfs_xattr_user_handler; |
55 | extern struct xattr_handler reiserfs_xattr_trusted_handler; | 61 | extern struct xattr_handler reiserfs_xattr_trusted_handler; |
56 | extern struct xattr_handler reiserfs_xattr_security_handler; | 62 | extern struct xattr_handler reiserfs_xattr_security_handler; |
63 | #ifdef CONFIG_REISERFS_FS_SECURITY | ||
64 | int reiserfs_security_init(struct inode *dir, struct inode *inode, | ||
65 | struct reiserfs_security_handle *sec); | ||
66 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
67 | struct inode *inode, | ||
68 | struct reiserfs_security_handle *sec); | ||
69 | void reiserfs_security_free(struct reiserfs_security_handle *sec); | ||
70 | #endif | ||
57 | 71 | ||
58 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) | 72 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) |
59 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) | 73 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) |
@@ -109,6 +123,24 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | |||
109 | } | 123 | } |
110 | #endif /* CONFIG_REISERFS_FS_XATTR */ | 124 | #endif /* CONFIG_REISERFS_FS_XATTR */ |
111 | 125 | ||
126 | #ifndef CONFIG_REISERFS_FS_SECURITY | ||
127 | static inline int reiserfs_security_init(struct inode *dir, | ||
128 | struct inode *inode, | ||
129 | struct reiserfs_security_handle *sec) | ||
130 | { | ||
131 | return 0; | ||
132 | } | ||
133 | static inline int | ||
134 | reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
135 | struct inode *inode, | ||
136 | struct reiserfs_security_handle *sec) | ||
137 | { | ||
138 | return 0; | ||
139 | } | ||
140 | static inline void reiserfs_security_free(struct reiserfs_security_handle *sec) | ||
141 | {} | ||
142 | #endif | ||
143 | |||
112 | #endif /* __KERNEL__ */ | 144 | #endif /* __KERNEL__ */ |
113 | 145 | ||
114 | #endif /* _LINUX_REISERFS_XATTR_H */ | 146 | #endif /* _LINUX_REISERFS_XATTR_H */ |