aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/acl.c
diff options
context:
space:
mode:
authorKaiGai Kohei <kaigai@ak.jp.nec.com>2006-05-13 02:13:27 -0400
committerKaiGai Kohei <kaigai@ak.jp.nec.com>2006-05-13 02:13:27 -0400
commitde1f72fab35d2b6215017690c6dc27b8f4aa14bc (patch)
tree7ed7688335b1f5a5b5ac86420f48810a94a5d4ce /fs/jffs2/acl.c
parentaa98d7cf59b5b0764d3502662053489585faf2fe (diff)
[JFFS2][XATTR] remove typedef from posix_acl related definition.
jffs2_acl_header, jffs2_acl_entry and jffs2_acl_entry_short were redefined with using 'struct' instead of 'typedef' in kernel implementation. [1/10] jffs2-xattr-v5.1-01-remove_typedef_kernel.patch Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com>
Diffstat (limited to 'fs/jffs2/acl.c')
-rw-r--r--fs/jffs2/acl.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 080bb51e4b65..de173df84a83 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -21,12 +21,12 @@
21static size_t jffs2_acl_size(int count) 21static size_t jffs2_acl_size(int count)
22{ 22{
23 if (count <= 4) { 23 if (count <= 4) {
24 return sizeof(jffs2_acl_header) 24 return sizeof(struct jffs2_acl_header)
25 + count * sizeof(jffs2_acl_entry_short); 25 + count * sizeof(struct jffs2_acl_entry_short);
26 } else { 26 } else {
27 return sizeof(jffs2_acl_header) 27 return sizeof(struct jffs2_acl_header)
28 + 4 * sizeof(jffs2_acl_entry_short) 28 + 4 * sizeof(struct jffs2_acl_entry_short)
29 + (count - 4) * sizeof(jffs2_acl_entry); 29 + (count - 4) * sizeof(struct jffs2_acl_entry);
30 } 30 }
31} 31}
32 32
@@ -34,16 +34,16 @@ static int jffs2_acl_count(size_t size)
34{ 34{
35 size_t s; 35 size_t s;
36 36
37 size -= sizeof(jffs2_acl_header); 37 size -= sizeof(struct jffs2_acl_header);
38 s = size - 4 * sizeof(jffs2_acl_entry_short); 38 s = size - 4 * sizeof(struct jffs2_acl_entry_short);
39 if (s < 0) { 39 if (s < 0) {
40 if (size % sizeof(jffs2_acl_entry_short)) 40 if (size % sizeof(struct jffs2_acl_entry_short))
41 return -1; 41 return -1;
42 return size / sizeof(jffs2_acl_entry_short); 42 return size / sizeof(struct jffs2_acl_entry_short);
43 } else { 43 } else {
44 if (s % sizeof(jffs2_acl_entry)) 44 if (s % sizeof(struct jffs2_acl_entry))
45 return -1; 45 return -1;
46 return s / sizeof(jffs2_acl_entry) + 4; 46 return s / sizeof(struct jffs2_acl_entry) + 4;
47 } 47 }
48} 48}
49 49
@@ -56,15 +56,15 @@ static struct posix_acl *jffs2_acl_from_medium(const void *value, size_t size)
56 56
57 if (!value) 57 if (!value)
58 return NULL; 58 return NULL;
59 if (size < sizeof(jffs2_acl_header)) 59 if (size < sizeof(struct jffs2_acl_header))
60 return ERR_PTR(-EINVAL); 60 return ERR_PTR(-EINVAL);
61 ver = je32_to_cpu(((jffs2_acl_header *)value)->a_version); 61 ver = je32_to_cpu(((struct jffs2_acl_header *)value)->a_version);
62 if (ver != JFFS2_ACL_VERSION) { 62 if (ver != JFFS2_ACL_VERSION) {
63 JFFS2_WARNING("Invalid ACL version. (=%u)\n", ver); 63 JFFS2_WARNING("Invalid ACL version. (=%u)\n", ver);
64 return ERR_PTR(-EINVAL); 64 return ERR_PTR(-EINVAL);
65 } 65 }
66 66
67 value = (char *)value + sizeof(jffs2_acl_header); 67 value = (char *)value + sizeof(struct jffs2_acl_header);
68 count = jffs2_acl_count(size); 68 count = jffs2_acl_count(size);
69 if (count < 0) 69 if (count < 0)
70 return ERR_PTR(-EINVAL); 70 return ERR_PTR(-EINVAL);
@@ -76,8 +76,8 @@ static struct posix_acl *jffs2_acl_from_medium(const void *value, size_t size)
76 return ERR_PTR(-ENOMEM); 76 return ERR_PTR(-ENOMEM);
77 77
78 for (i=0; i < count; i++) { 78 for (i=0; i < count; i++) {
79 jffs2_acl_entry *entry = (jffs2_acl_entry *)value; 79 struct jffs2_acl_entry *entry = (struct jffs2_acl_entry *)value;
80 if ((char *)value + sizeof(jffs2_acl_entry_short) > end) 80 if ((char *)value + sizeof(struct jffs2_acl_entry_short) > end)
81 goto fail; 81 goto fail;
82 acl->a_entries[i].e_tag = je16_to_cpu(entry->e_tag); 82 acl->a_entries[i].e_tag = je16_to_cpu(entry->e_tag);
83 acl->a_entries[i].e_perm = je16_to_cpu(entry->e_perm); 83 acl->a_entries[i].e_perm = je16_to_cpu(entry->e_perm);
@@ -86,13 +86,13 @@ static struct posix_acl *jffs2_acl_from_medium(const void *value, size_t size)
86 case ACL_GROUP_OBJ: 86 case ACL_GROUP_OBJ:
87 case ACL_MASK: 87 case ACL_MASK:
88 case ACL_OTHER: 88 case ACL_OTHER:
89 value = (char *)value + sizeof(jffs2_acl_entry_short); 89 value = (char *)value + sizeof(struct jffs2_acl_entry_short);
90 acl->a_entries[i].e_id = ACL_UNDEFINED_ID; 90 acl->a_entries[i].e_id = ACL_UNDEFINED_ID;
91 break; 91 break;
92 92
93 case ACL_USER: 93 case ACL_USER:
94 case ACL_GROUP: 94 case ACL_GROUP:
95 value = (char *)value + sizeof(jffs2_acl_entry); 95 value = (char *)value + sizeof(struct jffs2_acl_entry);
96 if ((char *)value > end) 96 if ((char *)value > end)
97 goto fail; 97 goto fail;
98 acl->a_entries[i].e_id = je32_to_cpu(entry->e_id); 98 acl->a_entries[i].e_id = je32_to_cpu(entry->e_id);
@@ -112,34 +112,34 @@ static struct posix_acl *jffs2_acl_from_medium(const void *value, size_t size)
112 112
113static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size) 113static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
114{ 114{
115 jffs2_acl_header *jffs2_acl; 115 struct jffs2_acl_header *jffs2_acl;
116 char *e; 116 char *e;
117 size_t i; 117 size_t i;
118 118
119 *size = jffs2_acl_size(acl->a_count); 119 *size = jffs2_acl_size(acl->a_count);
120 jffs2_acl = (jffs2_acl_header *)kmalloc(sizeof(jffs2_acl_header) 120 jffs2_acl = kmalloc(sizeof(struct jffs2_acl_header)
121 + acl->a_count * sizeof(jffs2_acl_entry), 121 + acl->a_count * sizeof(struct jffs2_acl_entry),
122 GFP_KERNEL); 122 GFP_KERNEL);
123 if (!jffs2_acl) 123 if (!jffs2_acl)
124 return ERR_PTR(-ENOMEM); 124 return ERR_PTR(-ENOMEM);
125 jffs2_acl->a_version = cpu_to_je32(JFFS2_ACL_VERSION); 125 jffs2_acl->a_version = cpu_to_je32(JFFS2_ACL_VERSION);
126 e = (char *)jffs2_acl + sizeof(jffs2_acl_header); 126 e = (char *)jffs2_acl + sizeof(struct jffs2_acl_header);
127 for (i=0; i < acl->a_count; i++) { 127 for (i=0; i < acl->a_count; i++) {
128 jffs2_acl_entry *entry = (jffs2_acl_entry *)e; 128 struct jffs2_acl_entry *entry = (struct jffs2_acl_entry *)e;
129 entry->e_tag = cpu_to_je16(acl->a_entries[i].e_tag); 129 entry->e_tag = cpu_to_je16(acl->a_entries[i].e_tag);
130 entry->e_perm = cpu_to_je16(acl->a_entries[i].e_perm); 130 entry->e_perm = cpu_to_je16(acl->a_entries[i].e_perm);
131 switch(acl->a_entries[i].e_tag) { 131 switch(acl->a_entries[i].e_tag) {
132 case ACL_USER: 132 case ACL_USER:
133 case ACL_GROUP: 133 case ACL_GROUP:
134 entry->e_id = cpu_to_je32(acl->a_entries[i].e_id); 134 entry->e_id = cpu_to_je32(acl->a_entries[i].e_id);
135 e += sizeof(jffs2_acl_entry); 135 e += sizeof(struct jffs2_acl_entry);
136 break; 136 break;
137 137
138 case ACL_USER_OBJ: 138 case ACL_USER_OBJ:
139 case ACL_GROUP_OBJ: 139 case ACL_GROUP_OBJ:
140 case ACL_MASK: 140 case ACL_MASK:
141 case ACL_OTHER: 141 case ACL_OTHER:
142 e += sizeof(jffs2_acl_entry_short); 142 e += sizeof(struct jffs2_acl_entry_short);
143 break; 143 break;
144 144
145 default: 145 default: