~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/reiserfs/xattr.h

Version: ~ [ linux-5.15-rc6 ] ~ [ linux-5.14.14 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.75 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.155 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.213 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.252 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.287 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.289 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #include <linux/reiserfs_xattr.h>
  3 #include <linux/init.h>
  4 #include <linux/list.h>
  5 #include <linux/rwsem.h>
  6 #include <linux/xattr.h>
  7 
  8 struct inode;
  9 struct dentry;
 10 struct iattr;
 11 struct super_block;
 12 
 13 int reiserfs_xattr_register_handlers(void) __init;
 14 void reiserfs_xattr_unregister_handlers(void);
 15 int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
 16 int reiserfs_lookup_privroot(struct super_block *sb);
 17 int reiserfs_delete_xattrs(struct inode *inode);
 18 int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
 19 int reiserfs_permission(struct inode *inode, int mask);
 20 
 21 #ifdef CONFIG_REISERFS_FS_XATTR
 22 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
 23 ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
 24 
 25 int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
 26 int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
 27 int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
 28                               struct inode *, const char *, const void *,
 29                               size_t, int);
 30 
 31 extern const struct xattr_handler reiserfs_xattr_user_handler;
 32 extern const struct xattr_handler reiserfs_xattr_trusted_handler;
 33 extern const struct xattr_handler reiserfs_xattr_security_handler;
 34 #ifdef CONFIG_REISERFS_FS_SECURITY
 35 int reiserfs_security_init(struct inode *dir, struct inode *inode,
 36                            const struct qstr *qstr,
 37                            struct reiserfs_security_handle *sec);
 38 int reiserfs_security_write(struct reiserfs_transaction_handle *th,
 39                             struct inode *inode,
 40                             struct reiserfs_security_handle *sec);
 41 void reiserfs_security_free(struct reiserfs_security_handle *sec);
 42 #endif
 43 
 44 static inline int reiserfs_xattrs_initialized(struct super_block *sb)
 45 {
 46         return REISERFS_SB(sb)->priv_root != NULL;
 47 }
 48 
 49 #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header))
 50 static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
 51 {
 52         loff_t ret = 0;
 53         if (reiserfs_file_data_log(inode)) {
 54                 ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize);
 55                 ret >>= inode->i_sb->s_blocksize_bits;
 56         }
 57         return ret;
 58 }
 59 
 60 /*
 61  * We may have to create up to 3 objects: xattr root, xattr dir, xattr file.
 62  * Let's try to be smart about it.
 63  * xattr root: We cache it. If it's not cached, we may need to create it.
 64  * xattr dir: If anything has been loaded for this inode, we can set a flag
 65  *            saying so.
 66  * xattr file: Since we don't cache xattrs, we can't tell. We always include
 67  *             blocks for it.
 68  *
 69  * However, since root and dir can be created between calls - YOU MUST SAVE
 70  * THIS VALUE.
 71  */
 72 static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
 73 {
 74         size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
 75 
 76         if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
 77                 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
 78                 if (d_really_is_negative(REISERFS_SB(inode->i_sb)->xattr_root))
 79                         nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
 80         }
 81 
 82         return nblocks;
 83 }
 84 
 85 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 86 {
 87         init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
 88 }
 89 
 90 #else
 91 
 92 #define reiserfs_listxattr NULL
 93 
 94 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 95 {
 96 }
 97 #endif  /*  CONFIG_REISERFS_FS_XATTR  */
 98 
 99 #ifndef CONFIG_REISERFS_FS_SECURITY
100 static inline int reiserfs_security_init(struct inode *dir,
101                                          struct inode *inode,
102                                          const struct qstr *qstr,
103                                          struct reiserfs_security_handle *sec)
104 {
105         return 0;
106 }
107 static inline int
108 reiserfs_security_write(struct reiserfs_transaction_handle *th,
109                         struct inode *inode,
110                         struct reiserfs_security_handle *sec)
111 {
112         return 0;
113 }
114 static inline void reiserfs_security_free(struct reiserfs_security_handle *sec)
115 {}
116 #endif
117 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp