aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/directory.c
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-08 07:20:36 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:35 -0500
commit4b11111aba6c80cc2969fd1806d2a869bfc9f357 (patch)
tree57b72a1ca58859dc6a9e47d647f29cebb9bcf7e0 /fs/udf/directory.c
parentbd45a420f93d18c91115f3f0568dd6a2555aa15a (diff)
udf: fix coding style
fix coding style errors found by checkpatch: - assignments in if conditions - braces {} around single statement blocks - no spaces after commas - printks without KERN_* - lines longer than 80 characters - spaces between "type *" and variable name before: 192 errors, 561 warnings, 8987 lines checked after: 1 errors, 38 warnings, 9468 lines checked Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/directory.c')
-rw-r--r--fs/udf/directory.c80
1 files changed, 48 insertions, 32 deletions
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index ff8c08fd7bf5..ba79794abced 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -19,7 +19,7 @@
19#include <linux/buffer_head.h> 19#include <linux/buffer_head.h>
20 20
21#if 0 21#if 0
22static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad, 22static uint8_t *udf_filead_read(struct inode *dir, uint8_t *tmpad,
23 uint8_t ad_size, kernel_lb_addr fe_loc, 23 uint8_t ad_size, kernel_lb_addr fe_loc,
24 int *pos, int *offset, struct buffer_head **bh, 24 int *pos, int *offset, struct buffer_head **bh,
25 int *error) 25 int *error)
@@ -45,7 +45,8 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
45 block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos); 45 block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
46 if (!block) 46 if (!block)
47 return NULL; 47 return NULL;
48 if (!(*bh = udf_tread(dir->i_sb, block))) 48 *bh = udf_tread(dir->i_sb, block);
49 if (!*bh)
49 return NULL; 50 return NULL;
50 } else if (*offset > dir->i_sb->s_blocksize) { 51 } else if (*offset > dir->i_sb->s_blocksize) {
51 ad = tmpad; 52 ad = tmpad;
@@ -57,10 +58,12 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
57 block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos); 58 block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
58 if (!block) 59 if (!block)
59 return NULL; 60 return NULL;
60 if (!((*bh) = udf_tread(dir->i_sb, block))) 61 (*bh) = udf_tread(dir->i_sb, block);
62 if (!*bh)
61 return NULL; 63 return NULL;
62 64
63 memcpy((uint8_t *)ad + remainder, (*bh)->b_data, ad_size - remainder); 65 memcpy((uint8_t *)ad + remainder, (*bh)->b_data,
66 ad_size - remainder);
64 *offset = ad_size - remainder; 67 *offset = ad_size - remainder;
65 } 68 }
66 69
@@ -68,12 +71,12 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
68} 71}
69#endif 72#endif
70 73
71struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos, 74struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
72 struct udf_fileident_bh *fibh, 75 struct udf_fileident_bh *fibh,
73 struct fileIdentDesc *cfi, 76 struct fileIdentDesc *cfi,
74 struct extent_position *epos, 77 struct extent_position *epos,
75 kernel_lb_addr * eloc, uint32_t * elen, 78 kernel_lb_addr *eloc, uint32_t *elen,
76 sector_t * offset) 79 sector_t *offset)
77{ 80{
78 struct fileIdentDesc *fi; 81 struct fileIdentDesc *fi;
79 int i, num, block; 82 int i, num, block;
@@ -86,7 +89,8 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
86 (UDF_I_EFE(dir) ? 89 (UDF_I_EFE(dir) ?
87 sizeof(struct extendedFileEntry) : 90 sizeof(struct extendedFileEntry) :
88 sizeof(struct fileEntry)), 91 sizeof(struct fileEntry)),
89 dir->i_sb->s_blocksize, &(fibh->eoffset)); 92 dir->i_sb->s_blocksize,
93 &(fibh->eoffset));
90 if (!fi) 94 if (!fi)
91 return NULL; 95 return NULL;
92 96
@@ -100,6 +104,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
100 104
101 if (fibh->eoffset == dir->i_sb->s_blocksize) { 105 if (fibh->eoffset == dir->i_sb->s_blocksize) {
102 int lextoffset = epos->offset; 106 int lextoffset = epos->offset;
107 unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
103 108
104 if (udf_next_aext(dir, epos, eloc, elen, 1) != 109 if (udf_next_aext(dir, epos, eloc, elen, 1) !=
105 (EXT_RECORDED_ALLOCATED >> 30)) 110 (EXT_RECORDED_ALLOCATED >> 30))
@@ -109,24 +114,27 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
109 114
110 (*offset)++; 115 (*offset)++;
111 116
112 if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen) 117 if ((*offset << blocksize_bits) >= *elen)
113 *offset = 0; 118 *offset = 0;
114 else 119 else
115 epos->offset = lextoffset; 120 epos->offset = lextoffset;
116 121
117 brelse(fibh->sbh); 122 brelse(fibh->sbh);
118 if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block))) 123 fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
124 if (!fibh->sbh)
119 return NULL; 125 return NULL;
120 fibh->soffset = fibh->eoffset = 0; 126 fibh->soffset = fibh->eoffset = 0;
121 127
122 if (!(*offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) { 128 if (!(*offset & ((16 >> (blocksize_bits - 9)) - 1))) {
123 i = 16 >> (dir->i_sb->s_blocksize_bits - 9); 129 i = 16 >> (blocksize_bits - 9);
124 if (i + *offset > (*elen >> dir->i_sb->s_blocksize_bits)) 130 if (i + *offset > (*elen >> blocksize_bits))
125 i = (*elen >> dir->i_sb->s_blocksize_bits)-*offset; 131 i = (*elen >> blocksize_bits)-*offset;
126 for (num = 0; i > 0; i--) { 132 for (num = 0; i > 0; i--) {
127 block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset + i); 133 block = udf_get_lb_pblock(dir->i_sb, *eloc,
134 *offset + i);
128 tmp = udf_tgetblk(dir->i_sb, block); 135 tmp = udf_tgetblk(dir->i_sb, block);
129 if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp)) 136 if (tmp && !buffer_uptodate(tmp) &&
137 !buffer_locked(tmp))
130 bha[num++] = tmp; 138 bha[num++] = tmp;
131 else 139 else
132 brelse(tmp); 140 brelse(tmp);
@@ -172,20 +180,24 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
172 fibh->soffset -= dir->i_sb->s_blocksize; 180 fibh->soffset -= dir->i_sb->s_blocksize;
173 fibh->eoffset -= dir->i_sb->s_blocksize; 181 fibh->eoffset -= dir->i_sb->s_blocksize;
174 182
175 if (!(fibh->ebh = udf_tread(dir->i_sb, block))) 183 fibh->ebh = udf_tread(dir->i_sb, block);
184 if (!fibh->ebh)
176 return NULL; 185 return NULL;
177 186
178 if (sizeof(struct fileIdentDesc) > -fibh->soffset) { 187 if (sizeof(struct fileIdentDesc) > -fibh->soffset) {
179 int fi_len; 188 int fi_len;
180 189
181 memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset); 190 memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset);
182 memcpy((uint8_t *)cfi - fibh->soffset, fibh->ebh->b_data, 191 memcpy((uint8_t *)cfi - fibh->soffset,
192 fibh->ebh->b_data,
183 sizeof(struct fileIdentDesc) + fibh->soffset); 193 sizeof(struct fileIdentDesc) + fibh->soffset);
184 194
185 fi_len = (sizeof(struct fileIdentDesc) + cfi->lengthFileIdent + 195 fi_len = (sizeof(struct fileIdentDesc) +
196 cfi->lengthFileIdent +
186 le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3; 197 le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3;
187 198
188 *nf_pos += ((fi_len - (fibh->eoffset - fibh->soffset)) >> 2); 199 *nf_pos += (fi_len - (fibh->eoffset - fibh->soffset))
200 >> 2;
189 fibh->eoffset = fibh->soffset + fi_len; 201 fibh->eoffset = fibh->soffset + fi_len;
190 } else { 202 } else {
191 memcpy((uint8_t *)cfi, (uint8_t *)fi, 203 memcpy((uint8_t *)cfi, (uint8_t *)fi,
@@ -210,9 +222,8 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
210 222
211 ptr = buffer; 223 ptr = buffer;
212 224
213 if ((*offset > 0) && (*offset < bufsize)) { 225 if ((*offset > 0) && (*offset < bufsize))
214 ptr += *offset; 226 ptr += *offset;
215 }
216 fi = (struct fileIdentDesc *)ptr; 227 fi = (struct fileIdentDesc *)ptr;
217 if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID) { 228 if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID) {
218 udf_debug("0x%x != TAG_IDENT_FID\n", 229 udf_debug("0x%x != TAG_IDENT_FID\n",
@@ -222,12 +233,11 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
222 bufsize); 233 bufsize);
223 return NULL; 234 return NULL;
224 } 235 }
225 if ((*offset + sizeof(struct fileIdentDesc)) > bufsize) { 236 if ((*offset + sizeof(struct fileIdentDesc)) > bufsize)
226 lengthThisIdent = sizeof(struct fileIdentDesc); 237 lengthThisIdent = sizeof(struct fileIdentDesc);
227 } else { 238 else
228 lengthThisIdent = sizeof(struct fileIdentDesc) + 239 lengthThisIdent = sizeof(struct fileIdentDesc) +
229 fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse); 240 fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse);
230 }
231 241
232 /* we need to figure padding, too! */ 242 /* we need to figure padding, too! */
233 padlen = lengthThisIdent % UDF_NAME_PAD; 243 padlen = lengthThisIdent % UDF_NAME_PAD;
@@ -258,11 +268,11 @@ static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset)
258 return NULL; 268 return NULL;
259 } 269 }
260 270
261 ptr = (uint8_t *)(fe->extendedAttr) + le32_to_cpu(fe->lengthExtendedAttr); 271 ptr = (uint8_t *)(fe->extendedAttr) +
272 le32_to_cpu(fe->lengthExtendedAttr);
262 273
263 if ((*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs))) { 274 if ((*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs)))
264 ptr += *offset; 275 ptr += *offset;
265 }
266 276
267 ext = (extent_ad *)ptr; 277 ext = (extent_ad *)ptr;
268 278
@@ -283,8 +293,11 @@ short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset,
283 293
284 if ((*offset < 0) || ((*offset + sizeof(short_ad)) > maxoffset)) 294 if ((*offset < 0) || ((*offset + sizeof(short_ad)) > maxoffset))
285 return NULL; 295 return NULL;
286 else if ((sa = (short_ad *)ptr)->extLength == 0) 296 else {
287 return NULL; 297 sa = (short_ad *)ptr;
298 if (sa->extLength == 0)
299 return NULL;
300 }
288 301
289 if (inc) 302 if (inc)
290 *offset += sizeof(short_ad); 303 *offset += sizeof(short_ad);
@@ -302,8 +315,11 @@ long_ad *udf_get_filelongad(uint8_t *ptr, int maxoffset, int *offset, int inc)
302 315
303 if ((*offset < 0) || ((*offset + sizeof(long_ad)) > maxoffset)) 316 if ((*offset < 0) || ((*offset + sizeof(long_ad)) > maxoffset))
304 return NULL; 317 return NULL;
305 else if ((la = (long_ad *)ptr)->extLength == 0) 318 else {
306 return NULL; 319 la = (long_ad *)ptr;
320 if (la->extLength == 0)
321 return NULL;
322 }
307 323
308 if (inc) 324 if (inc)
309 *offset += sizeof(long_ad); 325 *offset += sizeof(long_ad);