18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* -*- mode: c; c-basic-offset: 8; -*- 38c2ecf20Sopenharmony_ci * vim: noexpandtab sw=8 ts=8 sts=0: 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * xattr.h 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2004, 2008 Oracle. All rights reserved. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef OCFS2_XATTR_H 118c2ecf20Sopenharmony_ci#define OCFS2_XATTR_H 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/init.h> 148c2ecf20Sopenharmony_ci#include <linux/xattr.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cienum ocfs2_xattr_type { 178c2ecf20Sopenharmony_ci OCFS2_XATTR_INDEX_USER = 1, 188c2ecf20Sopenharmony_ci OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS, 198c2ecf20Sopenharmony_ci OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT, 208c2ecf20Sopenharmony_ci OCFS2_XATTR_INDEX_TRUSTED, 218c2ecf20Sopenharmony_ci OCFS2_XATTR_INDEX_SECURITY, 228c2ecf20Sopenharmony_ci OCFS2_XATTR_MAX 238c2ecf20Sopenharmony_ci}; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistruct ocfs2_security_xattr_info { 268c2ecf20Sopenharmony_ci int enable; 278c2ecf20Sopenharmony_ci const char *name; 288c2ecf20Sopenharmony_ci void *value; 298c2ecf20Sopenharmony_ci size_t value_len; 308c2ecf20Sopenharmony_ci}; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciextern const struct xattr_handler ocfs2_xattr_user_handler; 338c2ecf20Sopenharmony_ciextern const struct xattr_handler ocfs2_xattr_trusted_handler; 348c2ecf20Sopenharmony_ciextern const struct xattr_handler ocfs2_xattr_security_handler; 358c2ecf20Sopenharmony_ciextern const struct xattr_handler *ocfs2_xattr_handlers[]; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cissize_t ocfs2_listxattr(struct dentry *, char *, size_t); 388c2ecf20Sopenharmony_ciint ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int, 398c2ecf20Sopenharmony_ci const char *, void *, size_t); 408c2ecf20Sopenharmony_ciint ocfs2_xattr_set(struct inode *, int, const char *, const void *, 418c2ecf20Sopenharmony_ci size_t, int); 428c2ecf20Sopenharmony_ciint ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *, 438c2ecf20Sopenharmony_ci int, const char *, const void *, size_t, int, 448c2ecf20Sopenharmony_ci struct ocfs2_alloc_context *, 458c2ecf20Sopenharmony_ci struct ocfs2_alloc_context *); 468c2ecf20Sopenharmony_ciint ocfs2_has_inline_xattr_value_outside(struct inode *inode, 478c2ecf20Sopenharmony_ci struct ocfs2_dinode *di); 488c2ecf20Sopenharmony_ciint ocfs2_xattr_remove(struct inode *, struct buffer_head *); 498c2ecf20Sopenharmony_ciint ocfs2_init_security_get(struct inode *, struct inode *, 508c2ecf20Sopenharmony_ci const struct qstr *, 518c2ecf20Sopenharmony_ci struct ocfs2_security_xattr_info *); 528c2ecf20Sopenharmony_ciint ocfs2_init_security_set(handle_t *, struct inode *, 538c2ecf20Sopenharmony_ci struct buffer_head *, 548c2ecf20Sopenharmony_ci struct ocfs2_security_xattr_info *, 558c2ecf20Sopenharmony_ci struct ocfs2_alloc_context *, 568c2ecf20Sopenharmony_ci struct ocfs2_alloc_context *); 578c2ecf20Sopenharmony_ciint ocfs2_calc_security_init(struct inode *, 588c2ecf20Sopenharmony_ci struct ocfs2_security_xattr_info *, 598c2ecf20Sopenharmony_ci int *, int *, struct ocfs2_alloc_context **); 608c2ecf20Sopenharmony_ciint ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, 618c2ecf20Sopenharmony_ci umode_t, struct ocfs2_security_xattr_info *, 628c2ecf20Sopenharmony_ci int *, int *, int *); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * xattrs can live inside an inode, as part of an external xattr block, 668c2ecf20Sopenharmony_ci * or inside an xattr bucket, which is the leaf of a tree rooted in an 678c2ecf20Sopenharmony_ci * xattr block. Some of the xattr calls, especially the value setting 688c2ecf20Sopenharmony_ci * functions, want to treat each of these locations as equal. Let's wrap 698c2ecf20Sopenharmony_ci * them in a structure that we can pass around instead of raw buffer_heads. 708c2ecf20Sopenharmony_ci */ 718c2ecf20Sopenharmony_cistruct ocfs2_xattr_value_buf { 728c2ecf20Sopenharmony_ci struct buffer_head *vb_bh; 738c2ecf20Sopenharmony_ci ocfs2_journal_access_func vb_access; 748c2ecf20Sopenharmony_ci struct ocfs2_xattr_value_root *vb_xv; 758c2ecf20Sopenharmony_ci}; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ciint ocfs2_xattr_attach_refcount_tree(struct inode *inode, 788c2ecf20Sopenharmony_ci struct buffer_head *fe_bh, 798c2ecf20Sopenharmony_ci struct ocfs2_caching_info *ref_ci, 808c2ecf20Sopenharmony_ci struct buffer_head *ref_root_bh, 818c2ecf20Sopenharmony_ci struct ocfs2_cached_dealloc_ctxt *dealloc); 828c2ecf20Sopenharmony_ciint ocfs2_reflink_xattrs(struct inode *old_inode, 838c2ecf20Sopenharmony_ci struct buffer_head *old_bh, 848c2ecf20Sopenharmony_ci struct inode *new_inode, 858c2ecf20Sopenharmony_ci struct buffer_head *new_bh, 868c2ecf20Sopenharmony_ci bool preserve_security); 878c2ecf20Sopenharmony_ciint ocfs2_init_security_and_acl(struct inode *dir, 888c2ecf20Sopenharmony_ci struct inode *inode, 898c2ecf20Sopenharmony_ci const struct qstr *qstr); 908c2ecf20Sopenharmony_ci#endif /* OCFS2_XATTR_H */ 91