summaryrefslogtreecommitdiffstats
path: root/fs/udf/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/dir.c')
-rw-r--r--fs/udf/dir.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 79bab9fe120..9e3b9f97ddb 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -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,
};
/*
@@ -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;
}
@@ -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
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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;