blob: 00308b57f64f18fb058d95f16a62e2cc95be9749 [file] [log] [blame]
Thomas Gleixner1802d0b2019-05-27 08:55:21 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Masahiro Yamadafa60ce22021-05-06 18:06:44 -07002/*
Tiger Yangcf1d6c72008-08-18 17:11:00 +08003 * xattr.h
4 *
Tiger Yangc3cb6822008-10-23 16:33:03 +08005 * Copyright (C) 2004, 2008 Oracle. All rights reserved.
Tiger Yangcf1d6c72008-08-18 17:11:00 +08006 */
7
8#ifndef OCFS2_XATTR_H
9#define OCFS2_XATTR_H
10
11#include <linux/init.h>
12#include <linux/xattr.h>
13
14enum ocfs2_xattr_type {
15 OCFS2_XATTR_INDEX_USER = 1,
16 OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS,
17 OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT,
18 OCFS2_XATTR_INDEX_TRUSTED,
19 OCFS2_XATTR_INDEX_SECURITY,
20 OCFS2_XATTR_MAX
21};
22
Tiger Yang534eadd2008-11-14 11:16:41 +080023struct ocfs2_security_xattr_info {
24 int enable;
Tetsuo Handa95489062013-07-25 05:44:02 +090025 const char *name;
Tiger Yang534eadd2008-11-14 11:16:41 +080026 void *value;
27 size_t value_len;
28};
29
Stephen Hemminger537d81c2010-05-13 17:53:22 -070030extern const struct xattr_handler ocfs2_xattr_user_handler;
31extern const struct xattr_handler ocfs2_xattr_trusted_handler;
32extern const struct xattr_handler ocfs2_xattr_security_handler;
Stephen Hemminger537d81c2010-05-13 17:53:22 -070033extern const struct xattr_handler *ocfs2_xattr_handlers[];
Tiger Yangcf1d6c72008-08-18 17:11:00 +080034
Tiger Yang0030e002008-10-23 16:33:33 +080035ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
Tiger Yang4e3e9d02008-11-14 11:16:53 +080036int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
37 const char *, void *, size_t);
Tiger Yang0030e002008-10-23 16:33:33 +080038int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
39 size_t, int);
Tiger Yang6c3faba2008-11-14 11:16:03 +080040int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
41 int, const char *, const void *, size_t, int,
42 struct ocfs2_alloc_context *,
43 struct ocfs2_alloc_context *);
Tao Ma8b2c0db2009-08-18 11:43:49 +080044int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
45 struct ocfs2_dinode *di);
Tiger Yang0030e002008-10-23 16:33:33 +080046int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
Tiger Yang534eadd2008-11-14 11:16:41 +080047int ocfs2_init_security_get(struct inode *, struct inode *,
Eric Paris2a7dba32011-02-01 11:05:39 -050048 const struct qstr *,
Tiger Yang534eadd2008-11-14 11:16:41 +080049 struct ocfs2_security_xattr_info *);
50int ocfs2_init_security_set(handle_t *, struct inode *,
51 struct buffer_head *,
52 struct ocfs2_security_xattr_info *,
53 struct ocfs2_alloc_context *,
54 struct ocfs2_alloc_context *);
55int ocfs2_calc_security_init(struct inode *,
56 struct ocfs2_security_xattr_info *,
57 int *, int *, struct ocfs2_alloc_context **);
Tiger Yang89c38bd2008-11-14 11:17:41 +080058int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
Al Viro67697cb2011-07-26 02:55:32 -040059 umode_t, struct ocfs2_security_xattr_info *,
Mark Fasheh9b7895e2008-11-12 16:27:44 -080060 int *, int *, int *);
Tao Ma0c044f02008-08-18 17:38:50 +080061
Joel Becker2a50a742008-12-09 14:24:33 -080062/*
63 * xattrs can live inside an inode, as part of an external xattr block,
64 * or inside an xattr bucket, which is the leaf of a tree rooted in an
65 * xattr block. Some of the xattr calls, especially the value setting
66 * functions, want to treat each of these locations as equal. Let's wrap
67 * them in a structure that we can pass around instead of raw buffer_heads.
68 */
69struct ocfs2_xattr_value_buf {
70 struct buffer_head *vb_bh;
71 ocfs2_journal_access_func vb_access;
72 struct ocfs2_xattr_value_root *vb_xv;
73};
74
Tao Ma01292412009-09-21 13:04:19 +080075int ocfs2_xattr_attach_refcount_tree(struct inode *inode,
76 struct buffer_head *fe_bh,
77 struct ocfs2_caching_info *ref_ci,
78 struct buffer_head *ref_root_bh,
79 struct ocfs2_cached_dealloc_ctxt *dealloc);
Tao Ma2999d122009-08-18 11:43:55 +080080int ocfs2_reflink_xattrs(struct inode *old_inode,
81 struct buffer_head *old_bh,
82 struct inode *new_inode,
Tao Ma0fe9b662009-08-18 11:47:56 +080083 struct buffer_head *new_bh,
84 bool preserve_security);
85int ocfs2_init_security_and_acl(struct inode *dir,
Eric Paris2a7dba32011-02-01 11:05:39 -050086 struct inode *inode,
Junxiao Bic25a1e02016-05-12 15:42:18 -070087 const struct qstr *qstr);
Tiger Yangcf1d6c72008-08-18 17:11:00 +080088#endif /* OCFS2_XATTR_H */