diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2007-07-19 01:47:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 10:04:43 -0700 |
commit | cb00ea3528eb3c09eae9871d6e7d038776e952e2 (patch) | |
tree | b87eae0b060f37bedf01b52ccad6034d1df4f376 /fs/udf/directory.c | |
parent | 95a631e2d9853c9138e14fbaa9a51e6451f040b4 (diff) | |
download | kernel-common-cb00ea3528eb3c09eae9871d6e7d038776e952e2.tar.gz kernel-common-cb00ea3528eb3c09eae9871d6e7d038776e952e2.tar.bz2 kernel-common-cb00ea3528eb3c09eae9871d6e7d038776e952e2.zip |
UDF: coding style conversion - lindent
This patch converts UDF coding style to kernel coding style using Lindent.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Jan Kara <jack@ucw.cz>
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.c | 207 |
1 files changed, 99 insertions, 108 deletions
diff --git a/fs/udf/directory.c b/fs/udf/directory.c index 198caa33027a..8adc77c1d579 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c @@ -19,10 +19,10 @@ #include <linux/buffer_head.h> #if 0 -static uint8_t * -udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size, - kernel_lb_addr fe_loc, int *pos, int *offset, - struct buffer_head **bh, int *error) +static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad, + uint8_t ad_size, kernel_lb_addr fe_loc, + int *pos, int *offset, struct buffer_head **bh, + int *error) { int loffset = *offset; int block; @@ -31,31 +31,27 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size, *error = 0; - ad = (uint8_t *)(*bh)->b_data + *offset; + ad = (uint8_t *) (*bh)->b_data + *offset; *offset += ad_size; - if (!ad) - { + if (!ad) { brelse(*bh); *error = 1; return NULL; } - if (*offset == dir->i_sb->s_blocksize) - { + if (*offset == dir->i_sb->s_blocksize) { brelse(*bh); block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos); if (!block) return NULL; if (!(*bh = udf_tread(dir->i_sb, block))) return NULL; - } - else if (*offset > dir->i_sb->s_blocksize) - { + } else if (*offset > dir->i_sb->s_blocksize) { ad = tmpad; remainder = dir->i_sb->s_blocksize - loffset; - memcpy((uint8_t *)ad, (*bh)->b_data + loffset, remainder); + memcpy((uint8_t *) ad, (*bh)->b_data + loffset, remainder); brelse(*bh); block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos); @@ -64,56 +60,56 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size, if (!((*bh) = udf_tread(dir->i_sb, block))) return NULL; - memcpy((uint8_t *)ad + remainder, (*bh)->b_data, ad_size - remainder); + memcpy((uint8_t *) ad + remainder, (*bh)->b_data, + ad_size - remainder); *offset = ad_size - remainder; } return ad; } #endif -struct fileIdentDesc * -udf_fileident_read(struct inode *dir, loff_t *nf_pos, - struct udf_fileident_bh *fibh, - struct fileIdentDesc *cfi, - struct extent_position *epos, - kernel_lb_addr *eloc, uint32_t *elen, - sector_t *offset) +struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos, + struct udf_fileident_bh *fibh, + struct fileIdentDesc *cfi, + struct extent_position *epos, + kernel_lb_addr * eloc, uint32_t * elen, + sector_t * offset) { struct fileIdentDesc *fi; int i, num, block; - struct buffer_head * tmp, * bha[16]; + struct buffer_head *tmp, *bha[16]; fibh->soffset = fibh->eoffset; - if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) - { + if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) { fi = udf_get_fileident(UDF_I_DATA(dir) - - (UDF_I_EFE(dir) ? - sizeof(struct extendedFileEntry) : - sizeof(struct fileEntry)), - dir->i_sb->s_blocksize, &(fibh->eoffset)); + (UDF_I_EFE(dir) ? + sizeof(struct extendedFileEntry) : + sizeof(struct fileEntry)), + dir->i_sb->s_blocksize, + &(fibh->eoffset)); if (!fi) return NULL; *nf_pos += ((fibh->eoffset - fibh->soffset) >> 2); - memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc)); + memcpy((uint8_t *) cfi, (uint8_t *) fi, + sizeof(struct fileIdentDesc)); return fi; } - if (fibh->eoffset == dir->i_sb->s_blocksize) - { + if (fibh->eoffset == dir->i_sb->s_blocksize) { int lextoffset = epos->offset; if (udf_next_aext(dir, epos, eloc, elen, 1) != - (EXT_RECORDED_ALLOCATED >> 30)) + (EXT_RECORDED_ALLOCATED >> 30)) return NULL; block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset); - (*offset) ++; + (*offset)++; if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen) *offset = 0; @@ -125,57 +121,57 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, return NULL; fibh->soffset = fibh->eoffset = 0; - if (!(*offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9))-1))) + if (! + (*offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) { i = 16 >> (dir->i_sb->s_blocksize_bits - 9); - if (i+*offset > (*elen >> dir->i_sb->s_blocksize_bits)) - i = (*elen >> dir->i_sb->s_blocksize_bits)-*offset; - for (num=0; i>0; i--) - { - block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset+i); + if (i + *offset > + (*elen >> dir->i_sb->s_blocksize_bits)) + i = (*elen >> dir->i_sb->s_blocksize_bits) - + *offset; + for (num = 0; i > 0; i--) { + block = + udf_get_lb_pblock(dir->i_sb, *eloc, + *offset + i); tmp = udf_tgetblk(dir->i_sb, block); - if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp)) + if (tmp && !buffer_uptodate(tmp) + && !buffer_locked(tmp)) bha[num++] = tmp; else brelse(tmp); } - if (num) - { + if (num) { ll_rw_block(READA, num, bha); - for (i=0; i<num; i++) + for (i = 0; i < num; i++) brelse(bha[i]); } } - } - else if (fibh->sbh != fibh->ebh) - { + } else if (fibh->sbh != fibh->ebh) { brelse(fibh->sbh); fibh->sbh = fibh->ebh; } fi = udf_get_fileident(fibh->sbh->b_data, dir->i_sb->s_blocksize, - &(fibh->eoffset)); + &(fibh->eoffset)); if (!fi) return NULL; *nf_pos += ((fibh->eoffset - fibh->soffset) >> 2); - if (fibh->eoffset <= dir->i_sb->s_blocksize) - { - memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc)); - } - else if (fibh->eoffset > dir->i_sb->s_blocksize) - { + if (fibh->eoffset <= dir->i_sb->s_blocksize) { + memcpy((uint8_t *) cfi, (uint8_t *) fi, + sizeof(struct fileIdentDesc)); + } else if (fibh->eoffset > dir->i_sb->s_blocksize) { int lextoffset = epos->offset; if (udf_next_aext(dir, epos, eloc, elen, 1) != - (EXT_RECORDED_ALLOCATED >> 30)) + (EXT_RECORDED_ALLOCATED >> 30)) return NULL; block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset); - (*offset) ++; + (*offset)++; if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen) *offset = 0; @@ -188,62 +184,62 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, if (!(fibh->ebh = udf_tread(dir->i_sb, block))) return NULL; - if (sizeof(struct fileIdentDesc) > - fibh->soffset) - { + if (sizeof(struct fileIdentDesc) > -fibh->soffset) { int fi_len; - memcpy((uint8_t *)cfi, (uint8_t *)fi, - fibh->soffset); - memcpy((uint8_t *)cfi - fibh->soffset, fibh->ebh->b_data, - sizeof(struct fileIdentDesc) + fibh->soffset); + memcpy((uint8_t *) cfi, (uint8_t *) fi, -fibh->soffset); + memcpy((uint8_t *) cfi - fibh->soffset, + fibh->ebh->b_data, + sizeof(struct fileIdentDesc) + fibh->soffset); - fi_len = (sizeof(struct fileIdentDesc) + cfi->lengthFileIdent + - le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3; + fi_len = + (sizeof(struct fileIdentDesc) + + cfi->lengthFileIdent + + le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3; - *nf_pos += ((fi_len - (fibh->eoffset - fibh->soffset)) >> 2); + *nf_pos += + ((fi_len - (fibh->eoffset - fibh->soffset)) >> 2); fibh->eoffset = fibh->soffset + fi_len; - } - else - { - memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc)); + } else { + memcpy((uint8_t *) cfi, (uint8_t *) fi, + sizeof(struct fileIdentDesc)); } } return fi; } -struct fileIdentDesc * -udf_get_fileident(void * buffer, int bufsize, int * offset) +struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset) { struct fileIdentDesc *fi; int lengthThisIdent; - uint8_t * ptr; + uint8_t *ptr; int padlen; - if ( (!buffer) || (!offset) ) { - udf_debug("invalidparms\n, buffer=%p, offset=%p\n", buffer, offset); + if ((!buffer) || (!offset)) { + udf_debug("invalidparms\n, buffer=%p, offset=%p\n", buffer, + offset); return NULL; } ptr = buffer; - if ( (*offset > 0) && (*offset < bufsize) ) { + if ((*offset > 0) && (*offset < bufsize)) { ptr += *offset; } - fi=(struct fileIdentDesc *)ptr; - if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID) - { + fi = (struct fileIdentDesc *)ptr; + if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID) { udf_debug("0x%x != TAG_IDENT_FID\n", - le16_to_cpu(fi->descTag.tagIdent)); + le16_to_cpu(fi->descTag.tagIdent)); udf_debug("offset: %u sizeof: %lu bufsize: %u\n", - *offset, (unsigned long)sizeof(struct fileIdentDesc), bufsize); + *offset, (unsigned long)sizeof(struct fileIdentDesc), + bufsize); return NULL; } - if ( (*offset + sizeof(struct fileIdentDesc)) > bufsize ) - { + if ((*offset + sizeof(struct fileIdentDesc)) > bufsize) { lengthThisIdent = sizeof(struct fileIdentDesc); - } - else + } else lengthThisIdent = sizeof(struct fileIdentDesc) + - fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse); + fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse); /* we need to figure padding, too! */ padlen = lengthThisIdent % UDF_NAME_PAD; @@ -255,56 +251,53 @@ udf_get_fileident(void * buffer, int bufsize, int * offset) } #if 0 -static extent_ad * -udf_get_fileextent(void * buffer, int bufsize, int * offset) +static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset) { - extent_ad * ext; + extent_ad *ext; struct fileEntry *fe; - uint8_t * ptr; + uint8_t *ptr; - if ( (!buffer) || (!offset) ) - { + if ((!buffer) || (!offset)) { printk(KERN_ERR "udf: udf_get_fileextent() invalidparms\n"); return NULL; } fe = (struct fileEntry *)buffer; - if ( le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE ) - { + if (le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE) { udf_debug("0x%x != TAG_IDENT_FE\n", - le16_to_cpu(fe->descTag.tagIdent)); + le16_to_cpu(fe->descTag.tagIdent)); return NULL; } - ptr=(uint8_t *)(fe->extendedAttr) + le32_to_cpu(fe->lengthExtendedAttr); + ptr = + (uint8_t *) (fe->extendedAttr) + + le32_to_cpu(fe->lengthExtendedAttr); - if ( (*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs)) ) - { + if ((*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs))) { ptr += *offset; } - ext = (extent_ad *)ptr; + ext = (extent_ad *) ptr; *offset = *offset + sizeof(extent_ad); return ext; } #endif -short_ad * -udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset, int inc) +short_ad *udf_get_fileshortad(uint8_t * ptr, int maxoffset, int *offset, + int inc) { short_ad *sa; - if ( (!ptr) || (!offset) ) - { + if ((!ptr) || (!offset)) { printk(KERN_ERR "udf: udf_get_fileshortad() invalidparms\n"); return NULL; } - if ( (*offset < 0) || ((*offset + sizeof(short_ad)) > maxoffset) ) + if ((*offset < 0) || ((*offset + sizeof(short_ad)) > maxoffset)) return NULL; - else if ((sa = (short_ad *)ptr)->extLength == 0) + else if ((sa = (short_ad *) ptr)->extLength == 0) return NULL; if (inc) @@ -312,20 +305,18 @@ udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset, int inc) return sa; } -long_ad * -udf_get_filelongad(uint8_t *ptr, int maxoffset, int * offset, int inc) +long_ad *udf_get_filelongad(uint8_t * ptr, int maxoffset, int *offset, int inc) { long_ad *la; - if ( (!ptr) || (!offset) ) - { + if ((!ptr) || (!offset)) { printk(KERN_ERR "udf: udf_get_filelongad() invalidparms\n"); return NULL; } - if ( (*offset < 0) || ((*offset + sizeof(long_ad)) > maxoffset) ) + if ((*offset < 0) || ((*offset + sizeof(long_ad)) > maxoffset)) return NULL; - else if ((la = (long_ad *)ptr)->extLength == 0) + else if ((la = (long_ad *) ptr)->extLength == 0) return NULL; if (inc) |