]> bbs.cooldavid.org Git - net-next-2.6.git/blame - fs/ocfs2/xattr.h
ocfs: constify xattr_handler
[net-next-2.6.git] / fs / ocfs2 / xattr.h
CommitLineData
cf1d6c76
TY
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * xattr.h
5 *
c3cb6827 6 * Copyright (C) 2004, 2008 Oracle. All rights reserved.
cf1d6c76
TY
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
c3cb6827 10 * License version 2 as published by the Free Software Foundation.
cf1d6c76
TY
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.
cf1d6c76
TY
16 */
17
18#ifndef OCFS2_XATTR_H
19#define OCFS2_XATTR_H
20
21#include <linux/init.h>
22#include <linux/xattr.h>
23
24enum 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
534eaddd
TY
33struct ocfs2_security_xattr_info {
34 int enable;
35 char *name;
36 void *value;
37 size_t value_len;
38};
39
537d81ca
SH
40extern const struct xattr_handler ocfs2_xattr_user_handler;
41extern const struct xattr_handler ocfs2_xattr_trusted_handler;
42extern const struct xattr_handler ocfs2_xattr_security_handler;
43extern const struct xattr_handler ocfs2_xattr_acl_access_handler;
44extern const struct xattr_handler ocfs2_xattr_acl_default_handler;
45extern const struct xattr_handler *ocfs2_xattr_handlers[];
cf1d6c76 46
0030e001 47ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
4e3e9d02
TY
48int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
49 const char *, void *, size_t);
0030e001
TY
50int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
51 size_t, int);
6c3faba4
TY
52int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
53 int, const char *, const void *, size_t, int,
54 struct ocfs2_alloc_context *,
55 struct ocfs2_alloc_context *);
8b2c0dba
TM
56int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
57 struct ocfs2_dinode *di);
0030e001 58int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
534eaddd
TY
59int ocfs2_init_security_get(struct inode *, struct inode *,
60 struct ocfs2_security_xattr_info *);
61int ocfs2_init_security_set(handle_t *, struct inode *,
62 struct buffer_head *,
63 struct ocfs2_security_xattr_info *,
64 struct ocfs2_alloc_context *,
65 struct ocfs2_alloc_context *);
66int ocfs2_calc_security_init(struct inode *,
67 struct ocfs2_security_xattr_info *,
68 int *, int *, struct ocfs2_alloc_context **);
89c38bd0
TY
69int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
70 int, struct ocfs2_security_xattr_info *,
9b7895ef 71 int *, int *, int *);
01225596 72
2a50a743
JB
73/*
74 * xattrs can live inside an inode, as part of an external xattr block,
75 * or inside an xattr bucket, which is the leaf of a tree rooted in an
76 * xattr block. Some of the xattr calls, especially the value setting
77 * functions, want to treat each of these locations as equal. Let's wrap
78 * them in a structure that we can pass around instead of raw buffer_heads.
79 */
80struct ocfs2_xattr_value_buf {
81 struct buffer_head *vb_bh;
82 ocfs2_journal_access_func vb_access;
83 struct ocfs2_xattr_value_root *vb_xv;
84};
85
0129241e
TM
86int ocfs2_xattr_attach_refcount_tree(struct inode *inode,
87 struct buffer_head *fe_bh,
88 struct ocfs2_caching_info *ref_ci,
89 struct buffer_head *ref_root_bh,
90 struct ocfs2_cached_dealloc_ctxt *dealloc);
2999d12f
TM
91int ocfs2_reflink_xattrs(struct inode *old_inode,
92 struct buffer_head *old_bh,
93 struct inode *new_inode,
0fe9b66c
TM
94 struct buffer_head *new_bh,
95 bool preserve_security);
96int ocfs2_init_security_and_acl(struct inode *dir,
97 struct inode *inode);
cf1d6c76 98#endif /* OCFS2_XATTR_H */