VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb)
Firstly by applying the following with coccinelle's spatch: @@ expression SB; @@ -SB->s_flags & MS_RDONLY +sb_rdonly(SB) to effect the conversion to sb_rdonly(sb), then by applying: @@ expression A, SB; @@ ( -(!sb_rdonly(SB)) && A +!sb_rdonly(SB) && A | -A != (sb_rdonly(SB)) +A != sb_rdonly(SB) | -A == (sb_rdonly(SB)) +A == sb_rdonly(SB) | -!(sb_rdonly(SB)) +!sb_rdonly(SB) | -A && (sb_rdonly(SB)) +A && sb_rdonly(SB) | -A || (sb_rdonly(SB)) +A || sb_rdonly(SB) | -(sb_rdonly(SB)) != A +sb_rdonly(SB) != A | -(sb_rdonly(SB)) == A +sb_rdonly(SB) == A | -(sb_rdonly(SB)) && A +sb_rdonly(SB) && A | -(sb_rdonly(SB)) || A +sb_rdonly(SB) || A ) @@ expression A, B, SB; @@ ( -(sb_rdonly(SB)) ? 1 : 0 +sb_rdonly(SB) | -(sb_rdonly(SB)) ? A : B +sb_rdonly(SB) ? A : B ) to remove left over excess bracketage and finally by applying: @@ expression A, SB; @@ ( -(A & MS_RDONLY) != sb_rdonly(SB) +(bool)(A & MS_RDONLY) != sb_rdonly(SB) | -(A & MS_RDONLY) == sb_rdonly(SB) +(bool)(A & MS_RDONLY) == sb_rdonly(SB) ) to make comparisons against the result of sb_rdonly() (which is a bool) work correctly. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -210,7 +210,7 @@ int hfs_mdb_get(struct super_block *sb)
|
||||
pr_warn("filesystem is marked locked, mounting read-only.\n");
|
||||
sb->s_flags |= MS_RDONLY;
|
||||
}
|
||||
if (!(sb->s_flags & MS_RDONLY)) {
|
||||
if (!sb_rdonly(sb)) {
|
||||
/* Mark the volume uncleanly unmounted in case we crash */
|
||||
attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT);
|
||||
attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT);
|
||||
@@ -259,7 +259,7 @@ void hfs_mdb_commit(struct super_block *sb)
|
||||
{
|
||||
struct hfs_mdb *mdb = HFS_SB(sb)->mdb;
|
||||
|
||||
if (sb->s_flags & MS_RDONLY)
|
||||
if (sb_rdonly(sb))
|
||||
return;
|
||||
|
||||
lock_buffer(HFS_SB(sb)->mdb_bh);
|
||||
@@ -334,7 +334,7 @@ void hfs_mdb_commit(struct super_block *sb)
|
||||
void hfs_mdb_close(struct super_block *sb)
|
||||
{
|
||||
/* update volume attributes */
|
||||
if (sb->s_flags & MS_RDONLY)
|
||||
if (sb_rdonly(sb))
|
||||
return;
|
||||
HFS_SB(sb)->mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT);
|
||||
HFS_SB(sb)->mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT);
|
||||
|
@@ -71,7 +71,7 @@ void hfs_mark_mdb_dirty(struct super_block *sb)
|
||||
struct hfs_sb_info *sbi = HFS_SB(sb);
|
||||
unsigned long delay;
|
||||
|
||||
if (sb->s_flags & MS_RDONLY)
|
||||
if (sb_rdonly(sb))
|
||||
return;
|
||||
|
||||
spin_lock(&sbi->work_lock);
|
||||
@@ -115,7 +115,7 @@ static int hfs_remount(struct super_block *sb, int *flags, char *data)
|
||||
{
|
||||
sync_filesystem(sb);
|
||||
*flags |= MS_NODIRATIME;
|
||||
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
|
||||
if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb))
|
||||
return 0;
|
||||
if (!(*flags & MS_RDONLY)) {
|
||||
if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) {
|
||||
|
Reference in New Issue
Block a user