xattr support for btrfs
[safe/jmp/linux-2.6] / fs / btrfs / xattr.h
1 /*
2  * Copyright (C) 2007 Red Hat.  All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public
6  * License v2 as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public
14  * License along with this program; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 021110-1307, USA.
17  */
18
19 #ifndef __XATTR__
20 #define __XATTR__
21
22 #include <linux/xattr.h>
23 #include "ctree.h"
24
25 /* Name indexes */
26 enum {
27         BTRFS_XATTR_INDEX_USER,
28         BTRFS_XATTR_INDEX_POSIX_ACL_ACCESS,
29         BTRFS_XATTR_INDEX_POSIX_ACL_DEFAULT,
30         BTRFS_XATTR_INDEX_TRUSTED,
31         BTRFS_XATTR_INDEX_SECURITY,
32         BTRFS_XATTR_INDEX_SYSTEM,
33         BTRFS_XATTR_INDEX_END,
34 };
35
36 extern struct xattr_handler btrfs_xattr_user_handler;
37 extern struct xattr_handler btrfs_xattr_trusted_handler;
38 extern struct xattr_handler btrfs_xattr_acl_access_handler;
39 extern struct xattr_handler btrfs_xattr_acl_default_handler;
40 extern struct xattr_handler btrfs_xattr_security_handler;
41 extern struct xattr_handler btrfs_xattr_system_handler;
42
43 extern struct xattr_handler *btrfs_xattr_handlers[];
44
45 ssize_t btrfs_xattr_get(struct inode *inode, int name_index, const char *name,
46                         void *buffer, size_t size);
47 int btrfs_xattr_set(struct inode *inode, int name_index, const char *name,
48                         const void *value, size_t size, int flags);
49
50 /*
51  * the only reason this is public is for acl.c.  There may be a point where
52  * acl.c doesn't need it, and if thats the case we need to remove it and make
53  * it static in xattr.c
54  */
55 size_t btrfs_xattr_generic_list(struct inode *inode, char *list,
56                                 size_t list_size, const char *name,
57                                 size_t name_len);
58 #endif /* __XATTR__ */