Linux Audio

Check our new training course

Loading...
v4.10.11
 1/* -*- mode: c; c-basic-offset: 8; -*-
 2 * vim: noexpandtab sw=8 ts=8 sts=0:
 3 *
 4 * xattr.h
 5 *
 6 * Copyright (C) 2004, 2008 Oracle.  All rights reserved.
 7 *
 8 * This program is free software; you can redistribute it and/or
 9 * modify it under the terms of the GNU General Public
10 * License version 2 as published by the Free Software Foundation.
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.
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
33struct ocfs2_security_xattr_info {
34	int enable;
35	const char *name;
36	void *value;
37	size_t value_len;
38};
39
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_handlers[];
44
45ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
46int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
47			   const char *, void *, size_t);
48int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
49		    size_t, int);
50int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
51			   int, const char *, const void *, size_t, int,
52			   struct ocfs2_alloc_context *,
53			   struct ocfs2_alloc_context *);
54int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
55					 struct ocfs2_dinode *di);
56int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
57int ocfs2_init_security_get(struct inode *, struct inode *,
58			    const struct qstr *,
59			    struct ocfs2_security_xattr_info *);
60int ocfs2_init_security_set(handle_t *, struct inode *,
61			    struct buffer_head *,
62			    struct ocfs2_security_xattr_info *,
63			    struct ocfs2_alloc_context *,
64			    struct ocfs2_alloc_context *);
65int ocfs2_calc_security_init(struct inode *,
66			     struct ocfs2_security_xattr_info *,
67			     int *, int *, struct ocfs2_alloc_context **);
68int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
69			  umode_t, struct ocfs2_security_xattr_info *,
70			  int *, int *, int *);
71
72/*
73 * xattrs can live inside an inode, as part of an external xattr block,
74 * or inside an xattr bucket, which is the leaf of a tree rooted in an
75 * xattr block.  Some of the xattr calls, especially the value setting
76 * functions, want to treat each of these locations as equal.  Let's wrap
77 * them in a structure that we can pass around instead of raw buffer_heads.
78 */
79struct ocfs2_xattr_value_buf {
80	struct buffer_head		*vb_bh;
81	ocfs2_journal_access_func	vb_access;
82	struct ocfs2_xattr_value_root	*vb_xv;
83};
84
85int ocfs2_xattr_attach_refcount_tree(struct inode *inode,
86				     struct buffer_head *fe_bh,
87				     struct ocfs2_caching_info *ref_ci,
88				     struct buffer_head *ref_root_bh,
89				     struct ocfs2_cached_dealloc_ctxt *dealloc);
90int ocfs2_reflink_xattrs(struct inode *old_inode,
91			 struct buffer_head *old_bh,
92			 struct inode *new_inode,
93			 struct buffer_head *new_bh,
94			 bool preserve_security);
95int ocfs2_init_security_and_acl(struct inode *dir,
96				struct inode *inode,
97				const struct qstr *qstr);
98#endif /* OCFS2_XATTR_H */
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 
 3 * xattr.h
 4 *
 5 * Copyright (C) 2004, 2008 Oracle.  All rights reserved.
 
 
 
 
 
 
 
 
 
 6 */
 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
23struct ocfs2_security_xattr_info {
24	int enable;
25	const char *name;
26	void *value;
27	size_t value_len;
28};
29
30extern 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;
33extern const struct xattr_handler * const ocfs2_xattr_handlers[];
34
35ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
36int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
37			   const char *, void *, size_t);
38int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
39		    size_t, int);
40int 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 *);
44int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
45					 struct ocfs2_dinode *di);
46int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
47int ocfs2_init_security_get(struct inode *, struct inode *,
48			    const struct qstr *,
49			    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 **);
58int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
59			  umode_t, struct ocfs2_security_xattr_info *,
60			  int *, int *, int *);
61
62/*
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
75int 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);
80int ocfs2_reflink_xattrs(struct inode *old_inode,
81			 struct buffer_head *old_bh,
82			 struct inode *new_inode,
83			 struct buffer_head *new_bh,
84			 bool preserve_security);
85int ocfs2_init_security_and_acl(struct inode *dir,
86				struct inode *inode,
87				const struct qstr *qstr);
88#endif /* OCFS2_XATTR_H */