summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 11:10:37 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2020-01-20 20:12:41 -0500
commit9318731bec8d38bdbe701d395cf103157046831d (patch)
tree02718cd6a751af610659ac5043cfccd42b7d5f15 /fs
parent7a0e4048bfd16848ac115b17f49a3df7993a2fac (diff)
downloadlinux-9318731bec8d38bdbe701d395cf103157046831d.tar.bz2
fs/adfs: newdir: merge adfs_dir_read() into adfs_f_read()
adfs_dir_read() is only called from adfs_f_read(), so merge it into that function. As new directories are always 2048 bytes in size, (which we rely on elsewhere) we can consolidate some of the code. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/adfs/dir_f.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c
index ebe8616ee533..dbb4f1ef7bb7 100644
--- a/fs/adfs/dir_f.c
+++ b/fs/adfs/dir_f.c
@@ -138,20 +138,16 @@ static int adfs_f_validate(struct adfs_dir *dir)
}
/* Read and check that a directory is valid */
-static int adfs_dir_read(struct super_block *sb, u32 indaddr,
- unsigned int size, struct adfs_dir *dir)
+static int adfs_f_read(struct super_block *sb, u32 indaddr, unsigned int size,
+ struct adfs_dir *dir)
{
const unsigned int blocksize_bits = sb->s_blocksize_bits;
int ret;
- /*
- * Directories which are not a multiple of 2048 bytes
- * are considered bad v2 [3.6]
- */
- if (size & 2047)
- goto bad_dir;
+ if (size && size != ADFS_NEWDIR_SIZE)
+ return -EIO;
- ret = adfs_dir_read_buffers(sb, indaddr, size, dir);
+ ret = adfs_dir_read_buffers(sb, indaddr, ADFS_NEWDIR_SIZE, dir);
if (ret)
return ret;
@@ -161,6 +157,8 @@ static int adfs_dir_read(struct super_block *sb, u32 indaddr,
if (adfs_f_validate(dir))
goto bad_dir;
+ dir->parent_id = adfs_readval(dir->newtail->dirparent, 3);
+
return 0;
bad_dir:
@@ -271,23 +269,6 @@ static int adfs_dir_find_entry(struct adfs_dir *dir, u32 indaddr)
return ret;
}
-static int adfs_f_read(struct super_block *sb, u32 indaddr, unsigned int size,
- struct adfs_dir *dir)
-{
- int ret;
-
- if (size != ADFS_NEWDIR_SIZE)
- return -EIO;
-
- ret = adfs_dir_read(sb, indaddr, size, dir);
- if (ret)
- adfs_error(sb, "unable to read directory");
- else
- dir->parent_id = adfs_readval(dir->newtail->dirparent, 3);
-
- return ret;
-}
-
static int
adfs_f_setpos(struct adfs_dir *dir, unsigned int fpos)
{