162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * xattr.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2004, 2008 Oracle. All rights reserved. 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef OCFS2_XATTR_H 962306a36Sopenharmony_ci#define OCFS2_XATTR_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/init.h> 1262306a36Sopenharmony_ci#include <linux/xattr.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cienum ocfs2_xattr_type { 1562306a36Sopenharmony_ci OCFS2_XATTR_INDEX_USER = 1, 1662306a36Sopenharmony_ci OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS, 1762306a36Sopenharmony_ci OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT, 1862306a36Sopenharmony_ci OCFS2_XATTR_INDEX_TRUSTED, 1962306a36Sopenharmony_ci OCFS2_XATTR_INDEX_SECURITY, 2062306a36Sopenharmony_ci OCFS2_XATTR_MAX 2162306a36Sopenharmony_ci}; 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_cistruct ocfs2_security_xattr_info { 2462306a36Sopenharmony_ci int enable; 2562306a36Sopenharmony_ci const char *name; 2662306a36Sopenharmony_ci void *value; 2762306a36Sopenharmony_ci size_t value_len; 2862306a36Sopenharmony_ci}; 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ciextern const struct xattr_handler ocfs2_xattr_user_handler; 3162306a36Sopenharmony_ciextern const struct xattr_handler ocfs2_xattr_trusted_handler; 3262306a36Sopenharmony_ciextern const struct xattr_handler ocfs2_xattr_security_handler; 3362306a36Sopenharmony_ciextern const struct xattr_handler *ocfs2_xattr_handlers[]; 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_cissize_t ocfs2_listxattr(struct dentry *, char *, size_t); 3662306a36Sopenharmony_ciint ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int, 3762306a36Sopenharmony_ci const char *, void *, size_t); 3862306a36Sopenharmony_ciint ocfs2_xattr_set(struct inode *, int, const char *, const void *, 3962306a36Sopenharmony_ci size_t, int); 4062306a36Sopenharmony_ciint ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *, 4162306a36Sopenharmony_ci int, const char *, const void *, size_t, int, 4262306a36Sopenharmony_ci struct ocfs2_alloc_context *, 4362306a36Sopenharmony_ci struct ocfs2_alloc_context *); 4462306a36Sopenharmony_ciint ocfs2_has_inline_xattr_value_outside(struct inode *inode, 4562306a36Sopenharmony_ci struct ocfs2_dinode *di); 4662306a36Sopenharmony_ciint ocfs2_xattr_remove(struct inode *, struct buffer_head *); 4762306a36Sopenharmony_ciint ocfs2_init_security_get(struct inode *, struct inode *, 4862306a36Sopenharmony_ci const struct qstr *, 4962306a36Sopenharmony_ci struct ocfs2_security_xattr_info *); 5062306a36Sopenharmony_ciint ocfs2_init_security_set(handle_t *, struct inode *, 5162306a36Sopenharmony_ci struct buffer_head *, 5262306a36Sopenharmony_ci struct ocfs2_security_xattr_info *, 5362306a36Sopenharmony_ci struct ocfs2_alloc_context *, 5462306a36Sopenharmony_ci struct ocfs2_alloc_context *); 5562306a36Sopenharmony_ciint ocfs2_calc_security_init(struct inode *, 5662306a36Sopenharmony_ci struct ocfs2_security_xattr_info *, 5762306a36Sopenharmony_ci int *, int *, struct ocfs2_alloc_context **); 5862306a36Sopenharmony_ciint ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, 5962306a36Sopenharmony_ci umode_t, struct ocfs2_security_xattr_info *, 6062306a36Sopenharmony_ci int *, int *, int *); 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* 6362306a36Sopenharmony_ci * xattrs can live inside an inode, as part of an external xattr block, 6462306a36Sopenharmony_ci * or inside an xattr bucket, which is the leaf of a tree rooted in an 6562306a36Sopenharmony_ci * xattr block. Some of the xattr calls, especially the value setting 6662306a36Sopenharmony_ci * functions, want to treat each of these locations as equal. Let's wrap 6762306a36Sopenharmony_ci * them in a structure that we can pass around instead of raw buffer_heads. 6862306a36Sopenharmony_ci */ 6962306a36Sopenharmony_cistruct ocfs2_xattr_value_buf { 7062306a36Sopenharmony_ci struct buffer_head *vb_bh; 7162306a36Sopenharmony_ci ocfs2_journal_access_func vb_access; 7262306a36Sopenharmony_ci struct ocfs2_xattr_value_root *vb_xv; 7362306a36Sopenharmony_ci}; 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciint ocfs2_xattr_attach_refcount_tree(struct inode *inode, 7662306a36Sopenharmony_ci struct buffer_head *fe_bh, 7762306a36Sopenharmony_ci struct ocfs2_caching_info *ref_ci, 7862306a36Sopenharmony_ci struct buffer_head *ref_root_bh, 7962306a36Sopenharmony_ci struct ocfs2_cached_dealloc_ctxt *dealloc); 8062306a36Sopenharmony_ciint ocfs2_reflink_xattrs(struct inode *old_inode, 8162306a36Sopenharmony_ci struct buffer_head *old_bh, 8262306a36Sopenharmony_ci struct inode *new_inode, 8362306a36Sopenharmony_ci struct buffer_head *new_bh, 8462306a36Sopenharmony_ci bool preserve_security); 8562306a36Sopenharmony_ciint ocfs2_init_security_and_acl(struct inode *dir, 8662306a36Sopenharmony_ci struct inode *inode, 8762306a36Sopenharmony_ci const struct qstr *qstr); 8862306a36Sopenharmony_ci#endif /* OCFS2_XATTR_H */ 89