1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* !! 2 /* -*- mode: c; c-basic-offset: 8; -*- >> 3 * vim: noexpandtab sw=8 ts=8 sts=0: >> 4 * 3 * xattr.h 5 * xattr.h 4 * 6 * 5 * Copyright (C) 2004, 2008 Oracle. All right 7 * Copyright (C) 2004, 2008 Oracle. All rights reserved. 6 */ 8 */ 7 9 8 #ifndef OCFS2_XATTR_H 10 #ifndef OCFS2_XATTR_H 9 #define OCFS2_XATTR_H 11 #define OCFS2_XATTR_H 10 12 11 #include <linux/init.h> 13 #include <linux/init.h> 12 #include <linux/xattr.h> 14 #include <linux/xattr.h> 13 15 14 enum ocfs2_xattr_type { 16 enum ocfs2_xattr_type { 15 OCFS2_XATTR_INDEX_USER = 1, 17 OCFS2_XATTR_INDEX_USER = 1, 16 OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS, 18 OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS, 17 OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT, 19 OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT, 18 OCFS2_XATTR_INDEX_TRUSTED, 20 OCFS2_XATTR_INDEX_TRUSTED, 19 OCFS2_XATTR_INDEX_SECURITY, 21 OCFS2_XATTR_INDEX_SECURITY, 20 OCFS2_XATTR_MAX 22 OCFS2_XATTR_MAX 21 }; 23 }; 22 24 23 struct ocfs2_security_xattr_info { 25 struct ocfs2_security_xattr_info { 24 int enable; 26 int enable; 25 const char *name; 27 const char *name; 26 void *value; 28 void *value; 27 size_t value_len; 29 size_t value_len; 28 }; 30 }; 29 31 30 extern const struct xattr_handler ocfs2_xattr_ 32 extern const struct xattr_handler ocfs2_xattr_user_handler; 31 extern const struct xattr_handler ocfs2_xattr_ 33 extern const struct xattr_handler ocfs2_xattr_trusted_handler; 32 extern const struct xattr_handler ocfs2_xattr_ 34 extern const struct xattr_handler ocfs2_xattr_security_handler; 33 extern const struct xattr_handler * const ocfs !! 35 extern const struct xattr_handler *ocfs2_xattr_handlers[]; 34 36 35 ssize_t ocfs2_listxattr(struct dentry *, char 37 ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); 36 int ocfs2_xattr_get_nolock(struct inode *, str 38 int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int, 37 const char *, void 39 const char *, void *, size_t); 38 int ocfs2_xattr_set(struct inode *, int, const 40 int ocfs2_xattr_set(struct inode *, int, const char *, const void *, 39 size_t, int); 41 size_t, int); 40 int ocfs2_xattr_set_handle(handle_t *, struct 42 int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *, 41 int, const char *, 43 int, const char *, const void *, size_t, int, 42 struct ocfs2_alloc_ 44 struct ocfs2_alloc_context *, 43 struct ocfs2_alloc_ 45 struct ocfs2_alloc_context *); 44 int ocfs2_has_inline_xattr_value_outside(struc 46 int ocfs2_has_inline_xattr_value_outside(struct inode *inode, 45 struc 47 struct ocfs2_dinode *di); 46 int ocfs2_xattr_remove(struct inode *, struct 48 int ocfs2_xattr_remove(struct inode *, struct buffer_head *); 47 int ocfs2_init_security_get(struct inode *, st 49 int ocfs2_init_security_get(struct inode *, struct inode *, 48 const struct qstr 50 const struct qstr *, 49 struct ocfs2_secur 51 struct ocfs2_security_xattr_info *); 50 int ocfs2_init_security_set(handle_t *, struct 52 int ocfs2_init_security_set(handle_t *, struct inode *, 51 struct buffer_head 53 struct buffer_head *, 52 struct ocfs2_secur 54 struct ocfs2_security_xattr_info *, 53 struct ocfs2_alloc 55 struct ocfs2_alloc_context *, 54 struct ocfs2_alloc 56 struct ocfs2_alloc_context *); 55 int ocfs2_calc_security_init(struct inode *, 57 int ocfs2_calc_security_init(struct inode *, 56 struct ocfs2_secu 58 struct ocfs2_security_xattr_info *, 57 int *, int *, str 59 int *, int *, struct ocfs2_alloc_context **); 58 int ocfs2_calc_xattr_init(struct inode *, stru 60 int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, 59 umode_t, struct ocfs 61 umode_t, struct ocfs2_security_xattr_info *, 60 int *, int *, int *) 62 int *, int *, int *); 61 63 62 /* 64 /* 63 * xattrs can live inside an inode, as part of 65 * xattrs can live inside an inode, as part of an external xattr block, 64 * or inside an xattr bucket, which is the lea 66 * or inside an xattr bucket, which is the leaf of a tree rooted in an 65 * xattr block. Some of the xattr calls, espe 67 * xattr block. Some of the xattr calls, especially the value setting 66 * functions, want to treat each of these loca 68 * functions, want to treat each of these locations as equal. Let's wrap 67 * them in a structure that we can pass around 69 * them in a structure that we can pass around instead of raw buffer_heads. 68 */ 70 */ 69 struct ocfs2_xattr_value_buf { 71 struct ocfs2_xattr_value_buf { 70 struct buffer_head *vb_bh 72 struct buffer_head *vb_bh; 71 ocfs2_journal_access_func vb_acc 73 ocfs2_journal_access_func vb_access; 72 struct ocfs2_xattr_value_root *vb_xv 74 struct ocfs2_xattr_value_root *vb_xv; 73 }; 75 }; 74 76 75 int ocfs2_xattr_attach_refcount_tree(struct in 77 int ocfs2_xattr_attach_refcount_tree(struct inode *inode, 76 struct bu 78 struct buffer_head *fe_bh, 77 struct oc 79 struct ocfs2_caching_info *ref_ci, 78 struct bu 80 struct buffer_head *ref_root_bh, 79 struct oc 81 struct ocfs2_cached_dealloc_ctxt *dealloc); 80 int ocfs2_reflink_xattrs(struct inode *old_ino 82 int ocfs2_reflink_xattrs(struct inode *old_inode, 81 struct buffer_head *o 83 struct buffer_head *old_bh, 82 struct inode *new_ino 84 struct inode *new_inode, 83 struct buffer_head *n 85 struct buffer_head *new_bh, 84 bool preserve_securit 86 bool preserve_security); 85 int ocfs2_init_security_and_acl(struct inode * 87 int ocfs2_init_security_and_acl(struct inode *dir, 86 struct inode * 88 struct inode *inode, 87 const struct q 89 const struct qstr *qstr); 88 #endif /* OCFS2_XATTR_H */ 90 #endif /* OCFS2_XATTR_H */ 89 91
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.