Tiger Yang | cf1d6c7 | 2008-08-18 17:11:00 +0800 | [diff] [blame] | 1 | /* -*- mode: c; c-basic-offset: 8; -*- |
| 2 | * vim: noexpandtab sw=8 ts=8 sts=0: |
| 3 | * |
| 4 | * xattr.h |
| 5 | * |
Tiger Yang | c3cb682 | 2008-10-23 16:33:03 +0800 | [diff] [blame] | 6 | * Copyright (C) 2004, 2008 Oracle. All rights reserved. |
Tiger Yang | cf1d6c7 | 2008-08-18 17:11:00 +0800 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public |
Tiger Yang | c3cb682 | 2008-10-23 16:33:03 +0800 | [diff] [blame] | 10 | * License version 2 as published by the Free Software Foundation. |
Tiger Yang | cf1d6c7 | 2008-08-18 17:11:00 +0800 | [diff] [blame] | 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
Tiger Yang | cf1d6c7 | 2008-08-18 17:11:00 +0800 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #ifndef OCFS2_XATTR_H |
| 19 | #define OCFS2_XATTR_H |
| 20 | |
| 21 | #include <linux/init.h> |
| 22 | #include <linux/xattr.h> |
| 23 | |
| 24 | enum ocfs2_xattr_type { |
| 25 | OCFS2_XATTR_INDEX_USER = 1, |
| 26 | OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS, |
| 27 | OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT, |
| 28 | OCFS2_XATTR_INDEX_TRUSTED, |
| 29 | OCFS2_XATTR_INDEX_SECURITY, |
| 30 | OCFS2_XATTR_MAX |
| 31 | }; |
| 32 | |
Tiger Yang | 534eadd | 2008-11-14 11:16:41 +0800 | [diff] [blame] | 33 | struct ocfs2_security_xattr_info { |
| 34 | int enable; |
| 35 | char *name; |
| 36 | void *value; |
| 37 | size_t value_len; |
| 38 | }; |
| 39 | |
Tiger Yang | cf1d6c7 | 2008-08-18 17:11:00 +0800 | [diff] [blame] | 40 | extern struct xattr_handler ocfs2_xattr_user_handler; |
| 41 | extern struct xattr_handler ocfs2_xattr_trusted_handler; |
Tiger Yang | 923f7f3 | 2008-11-14 11:16:27 +0800 | [diff] [blame] | 42 | extern struct xattr_handler ocfs2_xattr_security_handler; |
Tiger Yang | 929fb01 | 2008-11-14 11:17:04 +0800 | [diff] [blame] | 43 | #ifdef CONFIG_OCFS2_FS_POSIX_ACL |
| 44 | extern struct xattr_handler ocfs2_xattr_acl_access_handler; |
| 45 | extern struct xattr_handler ocfs2_xattr_acl_default_handler; |
| 46 | #endif |
Tiger Yang | cf1d6c7 | 2008-08-18 17:11:00 +0800 | [diff] [blame] | 47 | extern struct xattr_handler *ocfs2_xattr_handlers[]; |
| 48 | |
Tiger Yang | 0030e00 | 2008-10-23 16:33:33 +0800 | [diff] [blame] | 49 | ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); |
Tiger Yang | 4e3e9d0 | 2008-11-14 11:16:53 +0800 | [diff] [blame] | 50 | int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int, |
| 51 | const char *, void *, size_t); |
Tiger Yang | 0030e00 | 2008-10-23 16:33:33 +0800 | [diff] [blame] | 52 | int ocfs2_xattr_set(struct inode *, int, const char *, const void *, |
| 53 | size_t, int); |
Tiger Yang | 6c3faba | 2008-11-14 11:16:03 +0800 | [diff] [blame] | 54 | int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *, |
| 55 | int, const char *, const void *, size_t, int, |
| 56 | struct ocfs2_alloc_context *, |
| 57 | struct ocfs2_alloc_context *); |
Tao Ma | 8b2c0db | 2009-08-18 11:43:49 +0800 | [diff] [blame^] | 58 | int ocfs2_has_inline_xattr_value_outside(struct inode *inode, |
| 59 | struct ocfs2_dinode *di); |
Tiger Yang | 0030e00 | 2008-10-23 16:33:33 +0800 | [diff] [blame] | 60 | int ocfs2_xattr_remove(struct inode *, struct buffer_head *); |
Tiger Yang | 534eadd | 2008-11-14 11:16:41 +0800 | [diff] [blame] | 61 | int ocfs2_init_security_get(struct inode *, struct inode *, |
| 62 | struct ocfs2_security_xattr_info *); |
| 63 | int ocfs2_init_security_set(handle_t *, struct inode *, |
| 64 | struct buffer_head *, |
| 65 | struct ocfs2_security_xattr_info *, |
| 66 | struct ocfs2_alloc_context *, |
| 67 | struct ocfs2_alloc_context *); |
| 68 | int ocfs2_calc_security_init(struct inode *, |
| 69 | struct ocfs2_security_xattr_info *, |
| 70 | int *, int *, struct ocfs2_alloc_context **); |
Tiger Yang | 89c38bd | 2008-11-14 11:17:41 +0800 | [diff] [blame] | 71 | int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, |
| 72 | int, struct ocfs2_security_xattr_info *, |
Mark Fasheh | 9b7895e | 2008-11-12 16:27:44 -0800 | [diff] [blame] | 73 | int *, int *, int *); |
Tao Ma | 0c044f0 | 2008-08-18 17:38:50 +0800 | [diff] [blame] | 74 | |
Joel Becker | 2a50a74 | 2008-12-09 14:24:33 -0800 | [diff] [blame] | 75 | /* |
| 76 | * xattrs can live inside an inode, as part of an external xattr block, |
| 77 | * or inside an xattr bucket, which is the leaf of a tree rooted in an |
| 78 | * xattr block. Some of the xattr calls, especially the value setting |
| 79 | * functions, want to treat each of these locations as equal. Let's wrap |
| 80 | * them in a structure that we can pass around instead of raw buffer_heads. |
| 81 | */ |
| 82 | struct ocfs2_xattr_value_buf { |
| 83 | struct buffer_head *vb_bh; |
| 84 | ocfs2_journal_access_func vb_access; |
| 85 | struct ocfs2_xattr_value_root *vb_xv; |
| 86 | }; |
| 87 | |
Tao Ma | 0129241 | 2009-09-21 13:04:19 +0800 | [diff] [blame] | 88 | int ocfs2_xattr_attach_refcount_tree(struct inode *inode, |
| 89 | struct buffer_head *fe_bh, |
| 90 | struct ocfs2_caching_info *ref_ci, |
| 91 | struct buffer_head *ref_root_bh, |
| 92 | struct ocfs2_cached_dealloc_ctxt *dealloc); |
Tiger Yang | cf1d6c7 | 2008-08-18 17:11:00 +0800 | [diff] [blame] | 93 | #endif /* OCFS2_XATTR_H */ |