aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/xattr.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 17:35:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 17:35:56 -0400
commit33f1de69312432baecb997a570b7d77c4d02d1ed (patch)
tree24e9e7487ec3b892e120409aa2ac1b1263794373 /fs/gfs2/xattr.h
parent041d6d0be82bed7e0b87181dba5d10b8ab14afd9 (diff)
parent86d006365610fe6cda243d89b67d5047dca44656 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw: GFS2: Whitespace fixes GFS2: Remove unused sysfs file GFS2: Be extra careful about deallocating inodes GFS2: Remove no_formal_ino generating code GFS2: Rename eattr.[ch] as xattr.[ch] GFS2: Clean up of extended attribute support GFS2: Add explanation of extended attr on-disk format GFS2: Add "-o errors=panic|withdraw" mount options GFS2: jumping to wrong label? GFS2: free disk inode which is deleted by remote node -V2 GFS2: Add a document explaining GFS2's uevents GFS2: Add sysfs link to device GFS2: Replace assertion with proper error handling GFS2: Improve error handling in inode allocation GFS2: Add some more info to uevents GFS2: Add online uevent to GFS2
Diffstat (limited to 'fs/gfs2/xattr.h')
-rw-r--r--fs/gfs2/xattr.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/fs/gfs2/xattr.h b/fs/gfs2/xattr.h
new file mode 100644
index 000000000000..cbdfd7743733
--- /dev/null
+++ b/fs/gfs2/xattr.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __EATTR_DOT_H__
11#define __EATTR_DOT_H__
12
13struct gfs2_inode;
14struct iattr;
15
16#define GFS2_EA_REC_LEN(ea) be32_to_cpu((ea)->ea_rec_len)
17#define GFS2_EA_DATA_LEN(ea) be32_to_cpu((ea)->ea_data_len)
18
19#define GFS2_EA_SIZE(ea) \
20ALIGN(sizeof(struct gfs2_ea_header) + (ea)->ea_name_len + \
21 ((GFS2_EA_IS_STUFFED(ea)) ? GFS2_EA_DATA_LEN(ea) : \
22 (sizeof(__be64) * (ea)->ea_num_ptrs)), 8)
23
24#define GFS2_EA_IS_STUFFED(ea) (!(ea)->ea_num_ptrs)
25#define GFS2_EA_IS_LAST(ea) ((ea)->ea_flags & GFS2_EAFLAG_LAST)
26
27#define GFS2_EAREQ_SIZE_STUFFED(er) \
28ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + (er)->er_data_len, 8)
29
30#define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1))
31#define GFS2_EA2DATA(ea) (GFS2_EA2NAME(ea) + (ea)->ea_name_len)
32
33#define GFS2_EA2DATAPTRS(ea) \
34((__be64 *)(GFS2_EA2NAME(ea) + ALIGN((ea)->ea_name_len, 8)))
35
36#define GFS2_EA2NEXT(ea) \
37((struct gfs2_ea_header *)((char *)(ea) + GFS2_EA_REC_LEN(ea)))
38
39#define GFS2_EA_BH2FIRST(bh) \
40((struct gfs2_ea_header *)((bh)->b_data + sizeof(struct gfs2_meta_header)))
41
42struct gfs2_ea_request {
43 const char *er_name;
44 char *er_data;
45 unsigned int er_name_len;
46 unsigned int er_data_len;
47 unsigned int er_type; /* GFS2_EATYPE_... */
48};
49
50struct gfs2_ea_location {
51 struct buffer_head *el_bh;
52 struct gfs2_ea_header *el_ea;
53 struct gfs2_ea_header *el_prev;
54};
55
56extern int gfs2_xattr_get(struct inode *inode, int type, const char *name,
57 void *buffer, size_t size);
58extern int gfs2_xattr_set(struct inode *inode, int type, const char *name,
59 const void *value, size_t size, int flags);
60extern ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size);
61extern int gfs2_ea_dealloc(struct gfs2_inode *ip);
62
63/* Exported to acl.c */
64
65extern int gfs2_ea_find(struct gfs2_inode *ip, int type, const char *name,
66 struct gfs2_ea_location *el);
67extern int gfs2_ea_get_copy(struct gfs2_inode *ip, struct gfs2_ea_location *el,
68 char *data, size_t size);
69extern int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
70 struct iattr *attr, char *data);
71
72#endif /* __EATTR_DOT_H__ */