Skip to content

Commit

Permalink
UDF: coding style conversion - lindent fixups
Browse files Browse the repository at this point in the history
This patch fixes up sources after conversion by 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>
  • Loading branch information
Cyrill Gorcunov authored and Linus Torvalds committed Jul 22, 2007
1 parent 7113302 commit 28de794
Show file tree
Hide file tree
Showing 23 changed files with 1,910 additions and 2,702 deletions.
420 changes: 161 additions & 259 deletions fs/udf/balloc.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions fs/udf/crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int main(void)
return 0;
}

#endif /* defined(TEST) */
#endif /* defined(TEST) */

/****************************************************************************/
#if defined(GENERATE)
Expand Down Expand Up @@ -169,4 +169,4 @@ int main(int argc, char **argv)
return 0;
}

#endif /* defined(GENERATE) */
#endif /* defined(GENERATE) */
60 changes: 24 additions & 36 deletions fs/udf/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ static int do_udf_readdir(struct inode *, struct file *, filldir_t, void *);
/* readdir and lookup functions */

const struct file_operations udf_dir_operations = {
.read = generic_read_dir,
.readdir = udf_readdir,
.ioctl = udf_ioctl,
.fsync = udf_fsync_file,
.read = generic_read_dir,
.readdir = udf_readdir,
.ioctl = udf_ioctl,
.fsync = udf_fsync_file,
};

/*
Expand Down Expand Up @@ -83,8 +83,7 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
lock_kernel();

if (filp->f_pos == 0) {
if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) <
0) {
if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) < 0) {
unlock_kernel();
return 0;
}
Expand All @@ -93,7 +92,7 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)

result = do_udf_readdir(dir, filp, filldir, dirent);
unlock_kernel();
return result;
return result;
}

static int
Expand Down Expand Up @@ -125,21 +124,20 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
if (nf_pos == 0)
nf_pos = (udf_ext0_offset(dir) >> 2);

fibh.soffset = fibh.eoffset =
(nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) {
fibh.sbh = fibh.ebh = NULL;
else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
&epos, &eloc, &elen,
&offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
} else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
&epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
epos.offset -= sizeof(short_ad);
else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
epos.offset -= sizeof(long_ad);
} else
} else {
offset = 0;
}

if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) {
brelse(epos.bh);
Expand All @@ -149,15 +147,11 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
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;
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);
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);
Expand All @@ -178,7 +172,6 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,

fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
&elen, &offset);

if (!fi) {
if (fibh.sbh != fibh.ebh)
brelse(fibh.ebh);
Expand All @@ -190,19 +183,16 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
liu = le16_to_cpu(cfi.lengthOfImpUse);
lfi = cfi.lengthFileIdent;

if (fibh.sbh == fibh.ebh)
if (fibh.sbh == fibh.ebh) {
nameptr = fi->fileIdent + liu;
else {
} else {
int poffset; /* Unpaded ending offset */

poffset =
fibh.soffset + sizeof(struct fileIdentDesc) + liu +
lfi;
poffset = fibh.soffset + sizeof(struct fileIdentDesc) + liu + lfi;

if (poffset >= lfi)
nameptr =
(char *)(fibh.ebh->b_data + poffset - lfi);
else {
if (poffset >= lfi) {
nameptr = (char *)(fibh.ebh->b_data + poffset - lfi);
} else {
nameptr = fname;
memcpy(nameptr, fi->fileIdent + liu,
lfi - poffset);
Expand Down Expand Up @@ -235,17 +225,15 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
}

if (flen) {
if (filldir
(dirent, fname, flen, filp->f_pos, iblock,
dt_type) < 0) {
if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0) {
if (fibh.sbh != fibh.ebh)
brelse(fibh.ebh);
brelse(fibh.sbh);
brelse(epos.bh);
return 0;
return 0;
}
}
} /* end while */
} /* end while */

filp->f_pos = nf_pos + 1;

Expand Down
68 changes: 27 additions & 41 deletions fs/udf/directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,

*error = 0;

ad = (uint8_t *) (*bh)->b_data + *offset;
ad = (uint8_t *)(*bh)->b_data + *offset;
*offset += ad_size;

if (!ad) {
Expand All @@ -51,7 +51,7 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
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);
Expand All @@ -60,10 +60,10 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
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
Expand All @@ -86,15 +86,13 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
(UDF_I_EFE(dir) ?
sizeof(struct extendedFileEntry) :
sizeof(struct fileEntry)),
dir->i_sb->s_blocksize,
&(fibh->eoffset));

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,
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));

return fi;
Expand All @@ -121,21 +119,14 @@ struct fileIdentDesc *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;
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);
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);
Expand All @@ -160,7 +151,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
*nf_pos += ((fibh->eoffset - fibh->soffset) >> 2);

if (fibh->eoffset <= dir->i_sb->s_blocksize) {
memcpy((uint8_t *) cfi, (uint8_t *) fi,
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
} else if (fibh->eoffset > dir->i_sb->s_blocksize) {
int lextoffset = epos->offset;
Expand All @@ -187,21 +178,17 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
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,
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,
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
}
}
Expand Down Expand Up @@ -237,9 +224,10 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
}
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;
Expand Down Expand Up @@ -270,22 +258,20 @@ static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset)
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))) {
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,
short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset,
int inc)
{
short_ad *sa;
Expand All @@ -297,15 +283,15 @@ short_ad *udf_get_fileshortad(uint8_t * ptr, int maxoffset, int *offset,

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)
*offset += sizeof(short_ad);
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;

Expand All @@ -316,7 +302,7 @@ long_ad *udf_get_filelongad(uint8_t * ptr, int maxoffset, int *offset, int inc)

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)
Expand Down
Loading

0 comments on commit 28de794

Please sign in to comment.