Skip to content

Commit

Permalink
UDF: coding style conversion - lindent
Browse files Browse the repository at this point in the history
This patch converts UDF coding style to kernel coding style using Lindent.

Signed-off-by: Cyrill Gorcunov <[email protected]>
Cc: Jan Kara <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
cyrillos authored and Linus Torvalds committed Jul 19, 2007
1 parent 95a631e commit cb00ea3
Show file tree
Hide file tree
Showing 23 changed files with 3,801 additions and 3,649 deletions.
709 changes: 363 additions & 346 deletions fs/udf/balloc.c

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions fs/udf/crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ static uint16_t crc_table[256] = {
* July 21, 1997 - Andrew E. Mileski
* Adapted from OSTA-UDF(tm) 1.50 standard.
*/
uint16_t
udf_crc(uint8_t *data, uint32_t size, uint16_t crc)
uint16_t udf_crc(uint8_t * data, uint32_t size, uint16_t crc)
{
while (size--)
crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8);
Expand Down Expand Up @@ -112,7 +111,7 @@ int main(void)
return 0;
}

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

/****************************************************************************/
#if defined(GENERATE)
Expand All @@ -138,7 +137,7 @@ int main(int argc, char **argv)

/* Get the polynomial */
sscanf(argv[1], "%lo", &poly);
if (poly & 0xffff0000U){
if (poly & 0xffff0000U) {
fprintf(stderr, "polynomial is too large\en");
exit(1);
}
Expand All @@ -147,27 +146,27 @@ int main(int argc, char **argv)

/* Create a table */
printf("static unsigned short crc_table[256] = {\n");
for (n = 0; n < 256; n++){
for (n = 0; n < 256; n++) {
if (n % 8 == 0)
printf("\t");
crc = n << 8;
for (i = 0; i < 8; i++){
if(crc & 0x8000U)
for (i = 0; i < 8; i++) {
if (crc & 0x8000U)
crc = (crc << 1) ^ poly;
else
crc <<= 1;
crc &= 0xFFFFU;
crc &= 0xFFFFU;
}
if (n == 255)
printf("0x%04xU ", crc);
else
printf("0x%04xU, ", crc);
if(n % 8 == 7)
if (n % 8 == 7)
printf("\n");
}
printf("};\n");

return 0;
}

#endif /* defined(GENERATE) */
#endif /* defined(GENERATE) */
132 changes: 63 additions & 69 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 @@ -82,26 +82,26 @@ 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 (filp->f_pos == 0) {
if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) <
0) {
unlock_kernel();
return 0;
}
filp->f_pos ++;
filp->f_pos++;
}

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

static int
do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *dirent)
static int
do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
void *dirent)
{
struct udf_fileident_bh fibh;
struct fileIdentDesc *fi=NULL;
struct fileIdentDesc *fi = NULL;
struct fileIdentDesc cfi;
int block, iblock;
loff_t nf_pos = filp->f_pos - 1;
Expand All @@ -117,73 +117,69 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
sector_t offset;
int i, num;
unsigned int dt_type;
struct extent_position epos = { NULL, 0, {0, 0}};
struct extent_position epos = { NULL, 0, {0, 0} };

if (nf_pos >= size)
return 0;

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;
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))
{
&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 ((++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)))
{
if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) {
brelse(epos.bh);
return -EIO;
}

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
{
} else {
brelse(epos.bh);
return -ENOENT;
}

while ( nf_pos < size )
{
while (nf_pos < size) {
filp->f_pos = nf_pos + 1;

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

if (!fi)
{
if (!fi) {
if (fibh.sbh != fibh.ebh)
brelse(fibh.ebh);
brelse(fibh.sbh);
Expand All @@ -196,62 +192,60 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d

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
{
nameptr =
(char *)(fibh.ebh->b_data + poffset - lfi);
else {
nameptr = fname;
memcpy(nameptr, fi->fileIdent + liu, lfi - poffset);
memcpy(nameptr + lfi - poffset, fibh.ebh->b_data, poffset);
memcpy(nameptr, fi->fileIdent + liu,
lfi - poffset);
memcpy(nameptr + lfi - poffset,
fibh.ebh->b_data, poffset);
}
}

if ( (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0 )
{
if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) )
if ((cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) {
if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE))
continue;
}

if ( (cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0 )
{
if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) )

if ((cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0) {
if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE))
continue;
}

if ( cfi.fileCharacteristics & FID_FILE_CHAR_PARENT )
{
if (cfi.fileCharacteristics & FID_FILE_CHAR_PARENT) {
iblock = parent_ino(filp->f_path.dentry);
flen = 2;
memcpy(fname, "..", flen);
dt_type = DT_DIR;
}
else
{
} else {
kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation);

iblock = udf_get_lb_pblock(dir->i_sb, tloc, 0);
flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
dt_type = DT_UNKNOWN;
}

if (flen)
{
if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0)
{
if (flen) {
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
Loading

0 comments on commit cb00ea3

Please sign in to comment.