Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * xattr.h
0004  *
0005  * Copyright (C) 2004, 2008 Oracle.  All rights reserved.
0006  */
0007 
0008 #ifndef OCFS2_XATTR_H
0009 #define OCFS2_XATTR_H
0010 
0011 #include <linux/init.h>
0012 #include <linux/xattr.h>
0013 
0014 enum ocfs2_xattr_type {
0015     OCFS2_XATTR_INDEX_USER = 1,
0016     OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS,
0017     OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT,
0018     OCFS2_XATTR_INDEX_TRUSTED,
0019     OCFS2_XATTR_INDEX_SECURITY,
0020     OCFS2_XATTR_MAX
0021 };
0022 
0023 struct ocfs2_security_xattr_info {
0024     int enable;
0025     const char *name;
0026     void *value;
0027     size_t value_len;
0028 };
0029 
0030 extern const struct xattr_handler ocfs2_xattr_user_handler;
0031 extern const struct xattr_handler ocfs2_xattr_trusted_handler;
0032 extern const struct xattr_handler ocfs2_xattr_security_handler;
0033 extern const struct xattr_handler *ocfs2_xattr_handlers[];
0034 
0035 ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
0036 int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
0037                const char *, void *, size_t);
0038 int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
0039             size_t, int);
0040 int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
0041                int, const char *, const void *, size_t, int,
0042                struct ocfs2_alloc_context *,
0043                struct ocfs2_alloc_context *);
0044 int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
0045                      struct ocfs2_dinode *di);
0046 int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
0047 int ocfs2_init_security_get(struct inode *, struct inode *,
0048                 const struct qstr *,
0049                 struct ocfs2_security_xattr_info *);
0050 int ocfs2_init_security_set(handle_t *, struct inode *,
0051                 struct buffer_head *,
0052                 struct ocfs2_security_xattr_info *,
0053                 struct ocfs2_alloc_context *,
0054                 struct ocfs2_alloc_context *);
0055 int ocfs2_calc_security_init(struct inode *,
0056                  struct ocfs2_security_xattr_info *,
0057                  int *, int *, struct ocfs2_alloc_context **);
0058 int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
0059               umode_t, struct ocfs2_security_xattr_info *,
0060               int *, int *, int *);
0061 
0062 /*
0063  * xattrs can live inside an inode, as part of an external xattr block,
0064  * or inside an xattr bucket, which is the leaf of a tree rooted in an
0065  * xattr block.  Some of the xattr calls, especially the value setting
0066  * functions, want to treat each of these locations as equal.  Let's wrap
0067  * them in a structure that we can pass around instead of raw buffer_heads.
0068  */
0069 struct ocfs2_xattr_value_buf {
0070     struct buffer_head      *vb_bh;
0071     ocfs2_journal_access_func   vb_access;
0072     struct ocfs2_xattr_value_root   *vb_xv;
0073 };
0074 
0075 int ocfs2_xattr_attach_refcount_tree(struct inode *inode,
0076                      struct buffer_head *fe_bh,
0077                      struct ocfs2_caching_info *ref_ci,
0078                      struct buffer_head *ref_root_bh,
0079                      struct ocfs2_cached_dealloc_ctxt *dealloc);
0080 int ocfs2_reflink_xattrs(struct inode *old_inode,
0081              struct buffer_head *old_bh,
0082              struct inode *new_inode,
0083              struct buffer_head *new_bh,
0084              bool preserve_security);
0085 int ocfs2_init_security_and_acl(struct inode *dir,
0086                 struct inode *inode,
0087                 const struct qstr *qstr);
0088 #endif /* OCFS2_XATTR_H */