1cf1d6c76STiger Yang /* -*- mode: c; c-basic-offset: 8; -*- 2cf1d6c76STiger Yang * vim: noexpandtab sw=8 ts=8 sts=0: 3cf1d6c76STiger Yang * 4cf1d6c76STiger Yang * xattr.h 5cf1d6c76STiger Yang * 6c3cb6827STiger Yang * Copyright (C) 2004, 2008 Oracle. All rights reserved. 7cf1d6c76STiger Yang * 8cf1d6c76STiger Yang * This program is free software; you can redistribute it and/or 9cf1d6c76STiger Yang * modify it under the terms of the GNU General Public 10c3cb6827STiger Yang * License version 2 as published by the Free Software Foundation. 11cf1d6c76STiger Yang * 12cf1d6c76STiger Yang * This program is distributed in the hope that it will be useful, 13cf1d6c76STiger Yang * but WITHOUT ANY WARRANTY; without even the implied warranty of 14cf1d6c76STiger Yang * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15cf1d6c76STiger Yang * General Public License for more details. 16cf1d6c76STiger Yang */ 17cf1d6c76STiger Yang 18cf1d6c76STiger Yang #ifndef OCFS2_XATTR_H 19cf1d6c76STiger Yang #define OCFS2_XATTR_H 20cf1d6c76STiger Yang 21cf1d6c76STiger Yang #include <linux/init.h> 22cf1d6c76STiger Yang #include <linux/xattr.h> 23cf1d6c76STiger Yang 24cf1d6c76STiger Yang enum ocfs2_xattr_type { 25cf1d6c76STiger Yang OCFS2_XATTR_INDEX_USER = 1, 26cf1d6c76STiger Yang OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS, 27cf1d6c76STiger Yang OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT, 28cf1d6c76STiger Yang OCFS2_XATTR_INDEX_TRUSTED, 29cf1d6c76STiger Yang OCFS2_XATTR_INDEX_SECURITY, 30cf1d6c76STiger Yang OCFS2_XATTR_MAX 31cf1d6c76STiger Yang }; 32cf1d6c76STiger Yang 33534eadddSTiger Yang struct ocfs2_security_xattr_info { 34534eadddSTiger Yang int enable; 35*9548906bSTetsuo Handa const char *name; 36534eadddSTiger Yang void *value; 37534eadddSTiger Yang size_t value_len; 38534eadddSTiger Yang }; 39534eadddSTiger Yang 40537d81caSStephen Hemminger extern const struct xattr_handler ocfs2_xattr_user_handler; 41537d81caSStephen Hemminger extern const struct xattr_handler ocfs2_xattr_trusted_handler; 42537d81caSStephen Hemminger extern const struct xattr_handler ocfs2_xattr_security_handler; 43537d81caSStephen Hemminger extern const struct xattr_handler ocfs2_xattr_acl_access_handler; 44537d81caSStephen Hemminger extern const struct xattr_handler ocfs2_xattr_acl_default_handler; 45537d81caSStephen Hemminger extern const struct xattr_handler *ocfs2_xattr_handlers[]; 46cf1d6c76STiger Yang 470030e001STiger Yang ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); 484e3e9d02STiger Yang int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int, 494e3e9d02STiger Yang const char *, void *, size_t); 500030e001STiger Yang int ocfs2_xattr_set(struct inode *, int, const char *, const void *, 510030e001STiger Yang size_t, int); 526c3faba4STiger Yang int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *, 536c3faba4STiger Yang int, const char *, const void *, size_t, int, 546c3faba4STiger Yang struct ocfs2_alloc_context *, 556c3faba4STiger Yang struct ocfs2_alloc_context *); 568b2c0dbaSTao Ma int ocfs2_has_inline_xattr_value_outside(struct inode *inode, 578b2c0dbaSTao Ma struct ocfs2_dinode *di); 580030e001STiger Yang int ocfs2_xattr_remove(struct inode *, struct buffer_head *); 59534eadddSTiger Yang int ocfs2_init_security_get(struct inode *, struct inode *, 602a7dba39SEric Paris const struct qstr *, 61534eadddSTiger Yang struct ocfs2_security_xattr_info *); 62534eadddSTiger Yang int ocfs2_init_security_set(handle_t *, struct inode *, 63534eadddSTiger Yang struct buffer_head *, 64534eadddSTiger Yang struct ocfs2_security_xattr_info *, 65534eadddSTiger Yang struct ocfs2_alloc_context *, 66534eadddSTiger Yang struct ocfs2_alloc_context *); 67534eadddSTiger Yang int ocfs2_calc_security_init(struct inode *, 68534eadddSTiger Yang struct ocfs2_security_xattr_info *, 69534eadddSTiger Yang int *, int *, struct ocfs2_alloc_context **); 7089c38bd0STiger Yang int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, 7167697cbdSAl Viro umode_t, struct ocfs2_security_xattr_info *, 729b7895efSMark Fasheh int *, int *, int *); 730c044f0bSTao Ma 742a50a743SJoel Becker /* 752a50a743SJoel Becker * xattrs can live inside an inode, as part of an external xattr block, 762a50a743SJoel Becker * or inside an xattr bucket, which is the leaf of a tree rooted in an 772a50a743SJoel Becker * xattr block. Some of the xattr calls, especially the value setting 782a50a743SJoel Becker * functions, want to treat each of these locations as equal. Let's wrap 792a50a743SJoel Becker * them in a structure that we can pass around instead of raw buffer_heads. 802a50a743SJoel Becker */ 812a50a743SJoel Becker struct ocfs2_xattr_value_buf { 822a50a743SJoel Becker struct buffer_head *vb_bh; 832a50a743SJoel Becker ocfs2_journal_access_func vb_access; 842a50a743SJoel Becker struct ocfs2_xattr_value_root *vb_xv; 852a50a743SJoel Becker }; 862a50a743SJoel Becker 870129241eSTao Ma int ocfs2_xattr_attach_refcount_tree(struct inode *inode, 880129241eSTao Ma struct buffer_head *fe_bh, 890129241eSTao Ma struct ocfs2_caching_info *ref_ci, 900129241eSTao Ma struct buffer_head *ref_root_bh, 910129241eSTao Ma struct ocfs2_cached_dealloc_ctxt *dealloc); 922999d12fSTao Ma int ocfs2_reflink_xattrs(struct inode *old_inode, 932999d12fSTao Ma struct buffer_head *old_bh, 942999d12fSTao Ma struct inode *new_inode, 950fe9b66cSTao Ma struct buffer_head *new_bh, 960fe9b66cSTao Ma bool preserve_security); 970fe9b66cSTao Ma int ocfs2_init_security_and_acl(struct inode *dir, 982a7dba39SEric Paris struct inode *inode, 992a7dba39SEric Paris const struct qstr *qstr); 100cf1d6c76STiger Yang #endif /* OCFS2_XATTR_H */ 101