aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/acl.c52
-rw-r--r--fs/jffs2/acl.h12
2 files changed, 32 insertions, 32 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:
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h
index c98610b4e81c..3f41e09200b8 100644
--- a/fs/jffs2/acl.h
+++ b/fs/jffs2/acl.h
@@ -7,20 +7,20 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in the jffs2 directory. 8 * For licensing information, see the file 'LICENCE' in the jffs2 directory.
9 *-------------------------------------------------------------------------*/ 9 *-------------------------------------------------------------------------*/
10typedef struct { 10struct jffs2_acl_entry {
11 jint16_t e_tag; 11 jint16_t e_tag;
12 jint16_t e_perm; 12 jint16_t e_perm;
13 jint32_t e_id; 13 jint32_t e_id;
14} jffs2_acl_entry; 14};
15 15
16typedef struct { 16struct jffs2_acl_entry_short {
17 jint16_t e_tag; 17 jint16_t e_tag;
18 jint16_t e_perm; 18 jint16_t e_perm;
19} jffs2_acl_entry_short; 19};
20 20
21typedef struct { 21struct jffs2_acl_header {
22 jint32_t a_version; 22 jint32_t a_version;
23} jffs2_acl_header; 23};
24 24
25#ifdef __KERNEL__ 25#ifdef __KERNEL__
26#ifdef CONFIG_JFFS2_FS_POSIX_ACL 26#ifdef CONFIG_JFFS2_FS_POSIX_ACL