Commit fa18d04a authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Simplify setup of i_mode in fs/ntfs/inode.c::ntfs_read_locked_inode().

Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent 714cd140
...@@ -132,6 +132,7 @@ ToDo/Notes: ...@@ -132,6 +132,7 @@ ToDo/Notes:
inode.h and make fs/ntfs/inode.c::__ntfs_init_inode() non-static and inode.h and make fs/ntfs/inode.c::__ntfs_init_inode() non-static and
add a declaration for it to inode.h. Fix some compilation issues add a declaration for it to inode.h. Fix some compilation issues
that resulted due to #includes and header file interdependencies. that resulted due to #includes and header file interdependencies.
- Simplify setup of i_mode in fs/ntfs/inode.c::ntfs_read_locked_inode().
2.1.20 - Fix two stupid bugs introduced in 2.1.18 release. 2.1.20 - Fix two stupid bugs introduced in 2.1.18 release.
......
...@@ -594,14 +594,26 @@ static int ntfs_read_locked_inode(struct inode *vi) ...@@ -594,14 +594,26 @@ static int ntfs_read_locked_inode(struct inode *vi)
* Also if not a directory, it could be something else, rather than * Also if not a directory, it could be something else, rather than
* a regular file. But again, will do for now. * a regular file. But again, will do for now.
*/ */
/* Everyone gets all permissions. */
vi->i_mode |= S_IRWXUGO;
/* If read-only, noone gets write permissions. */
if (IS_RDONLY(vi))
vi->i_mode &= ~S_IWUGO;
if (m->flags & MFT_RECORD_IS_DIRECTORY) { if (m->flags & MFT_RECORD_IS_DIRECTORY) {
vi->i_mode |= S_IFDIR; vi->i_mode |= S_IFDIR;
/*
* Apply the directory permissions mask set in the mount
* options.
*/
vi->i_mode &= ~vol->dmask;
/* Things break without this kludge! */ /* Things break without this kludge! */
if (vi->i_nlink > 1) if (vi->i_nlink > 1)
vi->i_nlink = 1; vi->i_nlink = 1;
} else } else {
vi->i_mode |= S_IFREG; vi->i_mode |= S_IFREG;
/* Apply the file permissions mask set in the mount options. */
vi->i_mode &= ~vol->fmask;
}
/* /*
* Find the standard information attribute in the mft record. At this * Find the standard information attribute in the mft record. At this
* stage we haven't setup the attribute list stuff yet, so this could * stage we haven't setup the attribute list stuff yet, so this could
...@@ -944,16 +956,6 @@ static int ntfs_read_locked_inode(struct inode *vi) ...@@ -944,16 +956,6 @@ static int ntfs_read_locked_inode(struct inode *vi)
goto unm_err_out; goto unm_err_out;
} }
skip_large_dir_stuff: skip_large_dir_stuff:
/* Everyone gets read and scan permissions. */
vi->i_mode |= S_IRUGO | S_IXUGO;
/* If not read-only, set write permissions. */
if (!IS_RDONLY(vi))
vi->i_mode |= S_IWUGO;
/*
* Apply the directory permissions mask set in the mount
* options.
*/
vi->i_mode &= ~vol->dmask;
/* Setup the operations for this inode. */ /* Setup the operations for this inode. */
vi->i_op = &ntfs_dir_inode_ops; vi->i_op = &ntfs_dir_inode_ops;
vi->i_fop = &ntfs_dir_ops; vi->i_fop = &ntfs_dir_ops;
...@@ -1090,13 +1092,6 @@ static int ntfs_read_locked_inode(struct inode *vi) ...@@ -1090,13 +1092,6 @@ static int ntfs_read_locked_inode(struct inode *vi)
unmap_mft_record(ni); unmap_mft_record(ni);
m = NULL; m = NULL;
ctx = NULL; ctx = NULL;
/* Everyone gets all permissions. */
vi->i_mode |= S_IRWXUGO;
/* If read-only, noone gets write permissions. */
if (IS_RDONLY(vi))
vi->i_mode &= ~S_IWUGO;
/* Apply the file permissions mask set in the mount options. */
vi->i_mode &= ~vol->fmask;
/* Setup the operations for this inode. */ /* Setup the operations for this inode. */
vi->i_op = &ntfs_file_inode_ops; vi->i_op = &ntfs_file_inode_ops;
vi->i_fop = &ntfs_file_ops; vi->i_fop = &ntfs_file_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment