diff options
author | David Teigland <teigland@redhat.com> | 2006-01-16 11:50:04 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-01-16 11:50:04 -0500 |
commit | b3b94faa5fe5968827ba0640ee9fba4b3e7f736e (patch) | |
tree | 70bd6068b050d2c46e338484f8b03fae4365c6c3 /fs/gfs2/eattr.h | |
parent | f7825dcf8c7301cfd3724eb40c5b443cc85ab7b8 (diff) |
[GFS2] The core of GFS2
This patch contains all the core files for GFS2.
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/eattr.h')
-rw-r--r-- | fs/gfs2/eattr.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/fs/gfs2/eattr.h b/fs/gfs2/eattr.h new file mode 100644 index 000000000000..a64039295759 --- /dev/null +++ b/fs/gfs2/eattr.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | ||
3 | * Copyright (C) 2004-2005 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 v.2. | ||
8 | */ | ||
9 | |||
10 | #ifndef __EATTR_DOT_H__ | ||
11 | #define __EATTR_DOT_H__ | ||
12 | |||
13 | #define GFS2_EA_REC_LEN(ea) be32_to_cpu((ea)->ea_rec_len) | ||
14 | #define GFS2_EA_DATA_LEN(ea) be32_to_cpu((ea)->ea_data_len) | ||
15 | |||
16 | #define GFS2_EA_SIZE(ea) \ | ||
17 | ALIGN(sizeof(struct gfs2_ea_header) + (ea)->ea_name_len + \ | ||
18 | ((GFS2_EA_IS_STUFFED(ea)) ? GFS2_EA_DATA_LEN(ea) : \ | ||
19 | (sizeof(uint64_t) * (ea)->ea_num_ptrs)), 8) | ||
20 | |||
21 | #define GFS2_EA_STRLEN(ea) \ | ||
22 | ((((ea)->ea_type == GFS2_EATYPE_USR) ? 5 : 7) + (ea)->ea_name_len + 1) | ||
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) \ | ||
28 | ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + (er)->er_data_len, 8) | ||
29 | |||
30 | #define GFS2_EAREQ_SIZE_UNSTUFFED(sdp, er) \ | ||
31 | ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \ | ||
32 | sizeof(uint64_t) * DIV_RU((er)->er_data_len, (sdp)->sd_jbsize), 8) | ||
33 | |||
34 | #define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1)) | ||
35 | #define GFS2_EA2DATA(ea) (GFS2_EA2NAME(ea) + (ea)->ea_name_len) | ||
36 | |||
37 | #define GFS2_EA2DATAPTRS(ea) \ | ||
38 | ((uint64_t *)(GFS2_EA2NAME(ea) + ALIGN((ea)->ea_name_len, 8))) | ||
39 | |||
40 | #define GFS2_EA2NEXT(ea) \ | ||
41 | ((struct gfs2_ea_header *)((char *)(ea) + GFS2_EA_REC_LEN(ea))) | ||
42 | |||
43 | #define GFS2_EA_BH2FIRST(bh) \ | ||
44 | ((struct gfs2_ea_header *)((bh)->b_data + sizeof(struct gfs2_meta_header))) | ||
45 | |||
46 | #define GFS2_ERF_MODE 0x80000000 | ||
47 | |||
48 | struct gfs2_ea_request { | ||
49 | char *er_name; | ||
50 | char *er_data; | ||
51 | unsigned int er_name_len; | ||
52 | unsigned int er_data_len; | ||
53 | unsigned int er_type; /* GFS2_EATYPE_... */ | ||
54 | int er_flags; | ||
55 | mode_t er_mode; | ||
56 | }; | ||
57 | |||
58 | struct gfs2_ea_location { | ||
59 | struct buffer_head *el_bh; | ||
60 | struct gfs2_ea_header *el_ea; | ||
61 | struct gfs2_ea_header *el_prev; | ||
62 | }; | ||
63 | |||
64 | int gfs2_ea_repack(struct gfs2_inode *ip); | ||
65 | |||
66 | int gfs2_ea_get_i(struct gfs2_inode *ip, struct gfs2_ea_request *er); | ||
67 | int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er); | ||
68 | int gfs2_ea_remove_i(struct gfs2_inode *ip, struct gfs2_ea_request *er); | ||
69 | |||
70 | int gfs2_ea_list(struct gfs2_inode *ip, struct gfs2_ea_request *er); | ||
71 | int gfs2_ea_get(struct gfs2_inode *ip, struct gfs2_ea_request *er); | ||
72 | int gfs2_ea_set(struct gfs2_inode *ip, struct gfs2_ea_request *er); | ||
73 | int gfs2_ea_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er); | ||
74 | |||
75 | int gfs2_ea_dealloc(struct gfs2_inode *ip); | ||
76 | |||
77 | int gfs2_get_eattr_meta(struct gfs2_inode *ip, struct gfs2_user_buffer *ub); | ||
78 | |||
79 | /* Exported to acl.c */ | ||
80 | |||
81 | int gfs2_ea_find(struct gfs2_inode *ip, | ||
82 | struct gfs2_ea_request *er, | ||
83 | struct gfs2_ea_location *el); | ||
84 | int gfs2_ea_get_copy(struct gfs2_inode *ip, | ||
85 | struct gfs2_ea_location *el, | ||
86 | char *data); | ||
87 | int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el, | ||
88 | struct iattr *attr, char *data); | ||
89 | |||
90 | #endif /* __EATTR_DOT_H__ */ | ||