diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-06-13 16:29:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-06-13 16:29:25 +0000 |
commit | db7d4daea91e105e3859cf461d7e53b9b77454b2 (patch) | |
tree | 9bb65b95440af09e8aca63abe56970dd3360cc57 /fs/ufs | |
parent | 9c1c01ead627bdda9211c9abd5b758d6c687d8ac (diff) |
Merge with Linux 2.2.8.
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/dir.c | 7 | ||||
-rw-r--r-- | fs/ufs/namei.c | 109 | ||||
-rw-r--r-- | fs/ufs/super.c | 59 | ||||
-rw-r--r-- | fs/ufs/util.h | 90 |
4 files changed, 108 insertions, 157 deletions
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 24810fe48..6a79c4a5e 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -43,13 +43,6 @@ ufs_readdir (struct file * filp, void * dirent, filldir_t filldir) int de_reclen; unsigned flags, swab; - - /* Isn't that already done in the upper layer??? - * the VFS layer really needs some explicit documentation! - */ - if (!inode || !S_ISDIR(inode->i_mode)) - return -EBADF; - sb = inode->i_sb; swab = sb->u.ufs_sb.s_swab; flags = sb->u.ufs_sb.s_flags; diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index dc5dccf4c..3daf77c57 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c @@ -91,8 +91,6 @@ static struct buffer_head * ufs_find_entry (struct inode * dir, UFSD(("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen)) *res_dir = NULL; - if (!dir) - return NULL; sb = dir->i_sb; flags = sb->u.ufs_sb.s_flags; @@ -185,7 +183,7 @@ failed: return NULL; } -int ufs_lookup(struct inode * dir, struct dentry *dentry) +struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry) { struct super_block * sb; struct inode * inode; @@ -199,7 +197,7 @@ int ufs_lookup(struct inode * dir, struct dentry *dentry) swab = sb->u.ufs_sb.s_swab; if (dentry->d_name.len > UFS_MAXNAMLEN) - return -ENAMETOOLONG; + return ERR_PTR(-ENAMETOOLONG); bh = ufs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &de); inode = NULL; @@ -208,11 +206,11 @@ int ufs_lookup(struct inode * dir, struct dentry *dentry) brelse (bh); inode = iget(sb, ino); if (!inode) - return -EACCES; + return ERR_PTR(-EACCES); } d_add(dentry, inode); UFSD(("EXIT\n")) - return 0; + return NULL; } /* @@ -250,12 +248,6 @@ static struct buffer_head * ufs_add_entry (struct inode * dir, swab = sb->u.ufs_sb.s_swab; uspi = sb->u.ufs_sb.s_uspi; - if (namelen > UFS_MAXNAMLEN) - { - *err = -ENAMETOOLONG; - return NULL; - } - if (!namelen) return NULL; /* @@ -469,10 +461,6 @@ int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev) sb = dir->i_sb; flags = sb->u.ufs_sb.s_flags; swab = sb->u.ufs_sb.s_swab; - - err = -ENAMETOOLONG; - if (dentry->d_name.len > UFS_MAXNAMLEN) - goto out; inode = ufs_new_inode (dir, mode, &err); if (!inode) @@ -528,10 +516,6 @@ int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) sb = dir->i_sb; flags = sb->u.ufs_sb.s_flags; swab = sb->u.ufs_sb.s_swab; - - err = -ENAMETOOLONG; - if (dentry->d_name.len > UFS_MAXNAMLEN) - goto out; err = -EMLINK; if (dir->i_nlink >= UFS_LINK_MAX) @@ -670,10 +654,6 @@ int ufs_rmdir (struct inode * dir, struct dentry *dentry) swab = sb->u.ufs_sb.s_swab; UFSD(("ENTER\n")) - - retval = -ENAMETOOLONG; - if (dentry->d_name.len > UFS_MAXNAMLEN) - goto out; retval = -ENOENT; bh = ufs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &de); @@ -687,14 +667,12 @@ int ufs_rmdir (struct inode * dir, struct dentry *dentry) if (SWAB32(de->d_ino) != inode->i_ino) goto end_rmdir; + retval = -ENOTEMPTY; if (!ufs_empty_dir (inode)) - retval = -ENOTEMPTY; - else if (SWAB32(de->d_ino) != inode->i_ino) - retval = -ENOENT; - else { - retval = ufs_delete_entry (dir, de, bh); - dir->i_version = ++event; - } + goto end_rmdir; + + retval = ufs_delete_entry (dir, de, bh); + dir->i_version = ++event; if (retval) goto end_rmdir; mark_buffer_dirty(bh, 1); @@ -717,7 +695,6 @@ int ufs_rmdir (struct inode * dir, struct dentry *dentry) end_rmdir: brelse (bh); -out: UFSD(("EXIT\n")) return retval; @@ -735,10 +712,6 @@ int ufs_unlink(struct inode * dir, struct dentry *dentry) sb = dir->i_sb; flags = sb->u.ufs_sb.s_flags; swab = sb->u.ufs_sb.s_swab; - - retval = -ENAMETOOLONG; - if (dentry->d_name.len > UFS_MAXNAMLEN) - goto out; retval = -ENOENT; bh = ufs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &de); @@ -779,7 +752,6 @@ int ufs_unlink(struct inode * dir, struct dentry *dentry) end_unlink: brelse (bh); -out: return retval; } @@ -881,9 +853,6 @@ int ufs_link (struct dentry * old_dentry, struct inode * dir, if (S_ISDIR(inode->i_mode)) return -EPERM; - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) - return -EPERM; - if (inode->i_nlink >= UFS_LINK_MAX) return -EMLINK; @@ -912,17 +881,10 @@ int ufs_link (struct dentry * old_dentry, struct inode * dir, ((struct ufs_dir_entry *) ((char *) buffer + \ SWAB16(((struct ufs_dir_entry *) buffer)->d_reclen)))->d_ino /* - * rename uses retrying to avoid race-conditions: at least they should be - * minimal. - * it tries to allocate all the blocks, then sanity-checks, and if the sanity- - * checks fail, it tries to restart itself again. Very practical - no changes - * are done until we know everything works ok.. and then all the changes can be - * done in one fell swoop when we have claimed all the buffers needed. - * * Anybody can rename anything with this: the permission checks are left to the * higher-level routines. */ -static int do_ufs_rename (struct inode * old_dir, struct dentry * old_dentry, +int ufs_rename (struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry ) { struct super_block * sb; @@ -941,9 +903,6 @@ static int do_ufs_rename (struct inode * old_dir, struct dentry * old_dentry, old_inode = new_inode = NULL; old_bh = new_bh = dir_bh = NULL; new_de = NULL; - retval = -ENAMETOOLONG; - if (old_dentry->d_name.len > UFS_MAXNAMLEN) - goto end_rename; old_bh = ufs_find_entry (old_dir, old_dentry->d_name.name, old_dentry->d_name.len, &old_de); /* @@ -967,25 +926,14 @@ static int do_ufs_rename (struct inode * old_dir, struct dentry * old_dentry, DQUOT_INIT(new_inode); } } - retval = 0; - if (new_inode == old_inode) - goto end_rename; if (S_ISDIR(old_inode->i_mode)) { - retval = -EINVAL; - if (is_subdir(new_dentry, old_dentry)) - goto end_rename; if (new_inode) { - /* Prune any children before testing for busy */ - if (new_dentry->d_count > 1) - shrink_dcache_parent(new_dentry); - retval = -EBUSY; - if (new_dentry->d_count > 1) - goto end_rename; retval = -ENOTEMPTY; if (!ufs_empty_dir (new_inode)) goto end_rename; } + retval = -EIO; dir_bh = ufs_bread (old_inode, 0, 0, &retval); if (!dir_bh) goto end_rename; @@ -1042,8 +990,6 @@ static int do_ufs_rename (struct inode * old_dir, struct dentry * old_dentry, wait_on_buffer (new_bh); } - /* Update the dcache */ - d_move(old_dentry, new_dentry); retval = 0; end_rename: brelse (dir_bh); @@ -1054,36 +1000,3 @@ end_rename: return retval; } - -/* - * Ok, rename also locks out other renames, as they can change the parent of - * a directory, and we don't want any races. Other races are checked for by - * "do_rename()", which restarts if there are inconsistencies. - * - * Note that there is no race between different filesystems: it's only within - * the same device that races occur: many renames can happen at once, as long - * as they are on different partitions. - * - * In the second extended file system, we use a lock flag stored in the memory - * super-block. This way, we really lock other renames only if they occur - * on the same file system - */ -int ufs_rename (struct inode * old_dir, struct dentry *old_dentry, - struct inode * new_dir, struct dentry *new_dentry ) -{ - int result; - - UFSD(("ENTER\n")) - - while (old_dir->i_sb->u.ufs_sb.s_rename_lock) - sleep_on (&old_dir->i_sb->u.ufs_sb.s_rename_wait); - old_dir->i_sb->u.ufs_sb.s_rename_lock = 1; - result = do_ufs_rename (old_dir, old_dentry, new_dir, new_dentry); - old_dir->i_sb->u.ufs_sb.s_rename_lock = 0; - wake_up (&old_dir->i_sb->u.ufs_sb.s_rename_wait); - - UFSD(("EXIT\n")) - - return result; -} - diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 1abdbe038..4fe11c564 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -125,7 +125,7 @@ void ufs_print_super_stuff(struct ufs_super_block_first * usb1, printk(" cssize: %u\n", SWAB32(usb1->fs_cssize)); printk(" cgsize: %u\n", SWAB32(usb1->fs_cgsize)); printk(" fstodb: %u\n", SWAB32(usb1->fs_fsbtodb)); - printk(" contigsumsize: %d\n", SWAB32(usb3->fs_u.fs_44.fs_contigsumsize)); + printk(" contigsumsize: %d\n", SWAB32(usb3->fs_u2.fs_44.fs_contigsumsize)); printk(" postblformat: %u\n", SWAB32(usb3->fs_postblformat)); printk(" nrpos: %u\n", SWAB32(usb3->fs_nrpos)); printk(" ndir %u\n", SWAB32(usb1->fs_cstotal.cs_ndir)); @@ -269,10 +269,12 @@ static int ufs_parse_options (char * options, unsigned * mount_options) ufs_set_opt (*mount_options, UFSTYPE_SUN); else if (!strcmp (value, "44bsd")) ufs_set_opt (*mount_options, UFSTYPE_44BSD); - else if (!strcmp (value, "next")) - ufs_set_opt (*mount_options, UFSTYPE_NEXT); + else if (!strcmp (value, "nextstep")) + ufs_set_opt (*mount_options, UFSTYPE_NEXTSTEP); else if (!strcmp (value, "openstep")) ufs_set_opt (*mount_options, UFSTYPE_OPENSTEP); + else if (!strcmp (value, "sunx86")) + ufs_set_opt (*mount_options, UFSTYPE_SUNx86); else { printk ("UFS-fs: Invalid type option: %s\n", value); return 0; @@ -463,7 +465,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data, } if (!(sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE)) { printk("You didn't specify the type of your ufs filesystem\n\n" - " mount -t ufs -o ufstype=sun|44bsd|old|next|openstep ....\n\n" + " mount -t ufs -o ufstype=sun|sunx86|44bsd|old|nextstep|openstep ....\n\n" ">>>WARNING<<< Wrong ufstype may corrupt your filesystem, " "default is ufstype=old\n"); ufs_set_opt (sb->u.ufs_sb.s_mount_opt, UFSTYPE_OLD); @@ -495,6 +497,16 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data, flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN; break; + case UFS_MOUNT_UFSTYPE_SUNx86: + UFSD(("ufstype=sunx86\n")) + uspi->s_fsize = block_size = 1024; + uspi->s_fmask = ~(1024 - 1); + uspi->s_fshift = 10; + uspi->s_sbsize = super_block_size = 2048; + uspi->s_sbbase = 0; + flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN; + break; + case UFS_MOUNT_UFSTYPE_OLD: UFSD(("ufstype=old\n")) uspi->s_fsize = block_size = 1024; @@ -509,8 +521,8 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data, } break; - case UFS_MOUNT_UFSTYPE_NEXT: - UFSD(("ufstype=next\n")) + case UFS_MOUNT_UFSTYPE_NEXTSTEP: + UFSD(("ufstype=nextstep\n")) uspi->s_fsize = block_size = 1024; uspi->s_fmask = ~(1024 - 1); uspi->s_fshift = 10; @@ -518,7 +530,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data, uspi->s_sbbase = 0; flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; if (!(sb->s_flags & MS_RDONLY)) { - printk(KERN_INFO "ufstype=next is supported read-only\n"); + printk(KERN_INFO "ufstype=nextstep is supported read-only\n"); sb->s_flags |= MS_RDONLY; } break; @@ -579,10 +591,9 @@ again: } #endif - if ((((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) == - UFS_MOUNT_UFSTYPE_NEXT) || - ((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) == - UFS_MOUNT_UFSTYPE_OPENSTEP)) && uspi->s_sbbase < 256) { + if ((((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_NEXTSTEP) + || ((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_OPENSTEP)) + && uspi->s_sbbase < 256) { ubh_brelse_uspi(uspi); ubh = NULL; uspi->s_sbbase += 8; @@ -627,9 +638,10 @@ magic_found: * If not, make it read only. */ if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) || - ((flags & UFS_ST_MASK) == UFS_ST_OLD) || - (((flags & UFS_ST_MASK) == UFS_ST_SUN) && - (ufs_get_fs_state(usb3) == (UFS_FSOK - SWAB32(usb1->fs_time))))) { + ((flags & UFS_ST_MASK) == UFS_ST_OLD) || + (((flags & UFS_ST_MASK) == UFS_ST_SUN || + (flags & UFS_ST_MASK) == UFS_ST_SUNx86) && + (ufs_get_fs_state(usb1, usb3) == (UFS_FSOK - SWAB32(usb1->fs_time))))) { switch(usb1->fs_clean) { case UFS_FSCLEAN: UFSD(("fs is clean\n")) @@ -649,8 +661,7 @@ magic_found: sb->s_flags |= MS_RDONLY; break; default: - printk("ufs_read_super: can't grok fs_clean 0x%x\n", - usb1->fs_clean); + printk("ufs_read_super: can't grok fs_clean 0x%x\n", usb1->fs_clean); sb->s_flags |= MS_RDONLY; break; } @@ -694,7 +705,7 @@ magic_found: uspi->s_nindir = SWAB32(usb1->fs_nindir); uspi->s_inopb = SWAB32(usb1->fs_inopb); uspi->s_nspf = SWAB32(usb1->fs_nspf); - uspi->s_npsect = SWAB32(usb1->fs_npsect); + uspi->s_npsect = ufs_get_fs_npsect(usb1, usb3); uspi->s_interleave = SWAB32(usb1->fs_interleave); uspi->s_trackskew = SWAB32(usb1->fs_trackskew); uspi->s_csaddr = SWAB32(usb1->fs_csaddr); @@ -706,7 +717,7 @@ magic_found: uspi->s_ipg = SWAB32(usb1->fs_ipg); uspi->s_fpg = SWAB32(usb1->fs_fpg); uspi->s_cpc = SWAB32(usb2->fs_cpc); - uspi->s_contigsumsize = SWAB32(usb3->fs_u.fs_44.fs_contigsumsize); + uspi->s_contigsumsize = SWAB32(usb3->fs_u2.fs_44.fs_contigsumsize); uspi->s_qbmask = ufs_get_fs_qbmask(usb3); uspi->s_qfmask = ufs_get_fs_qfmask(usb3); uspi->s_postblformat = SWAB32(usb3->fs_postblformat); @@ -734,8 +745,6 @@ magic_found: sb->u.ufs_sb.s_flags = flags; sb->u.ufs_sb.s_swab = swab; - sb->u.ufs_sb.s_rename_lock = 0; - sb->u.ufs_sb.s_rename_wait = NULL; sb->s_root = d_alloc_root(iget(sb, UFS_ROOTINO), NULL); @@ -776,8 +785,9 @@ void ufs_write_super (struct super_block * sb) { if (!(sb->s_flags & MS_RDONLY)) { usb1->fs_time = SWAB32(CURRENT_TIME); - if (usb1->fs_clean == UFS_FSCLEAN && (flags&UFS_ST_MASK) == UFS_ST_SUN) - ufs_set_fs_state(usb3, UFS_FSOK - SWAB32(usb1->fs_time)); + if ((flags & UFS_ST_MASK) == UFS_ST_SUN + || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) + ufs_set_fs_state(usb1, usb3, UFS_FSOK - SWAB32(usb1->fs_time)); ubh_mark_buffer_dirty (USPI_UBH, 1); } sb->s_dirt = 0; @@ -842,8 +852,9 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data) if (*mount_flags & MS_RDONLY) { ufs_put_cylinder_structures(sb); usb1->fs_time = SWAB32(CURRENT_TIME); - if (usb1->fs_clean == UFS_FSCLEAN && (flags&UFS_ST_MASK) == UFS_ST_SUN) - ufs_set_fs_state(usb3, UFS_FSOK - SWAB32(usb1->fs_time)); + if ((flags & UFS_ST_MASK) == UFS_ST_SUN + || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) + ufs_set_fs_state(usb1, usb3, UFS_FSOK - SWAB32(usb1->fs_time)); ubh_mark_buffer_dirty (USPI_UBH, 1); sb->s_dirt = 0; sb->s_flags |= MS_RDONLY; diff --git a/fs/ufs/util.h b/fs/ufs/util.h index 02e6fe98a..cf26773ef 100644 --- a/fs/ufs/util.h +++ b/fs/ufs/util.h @@ -31,24 +31,46 @@ /* * macros used for accesing structures */ -#define ufs_get_fs_state(usb3) _ufs_get_fs_state_(usb3,flags,swab) -static inline __s32 _ufs_get_fs_state_(struct ufs_super_block_third * usb3, - unsigned flags, unsigned swab) +#define ufs_get_fs_state(usb1,usb3) _ufs_get_fs_state_(usb1,usb3,flags,swab) +static inline __s32 _ufs_get_fs_state_(struct ufs_super_block_first * usb1, + struct ufs_super_block_third * usb3, unsigned flags, unsigned swab) { - if ((flags & UFS_ST_MASK) == UFS_ST_SUN) - return SWAB32((usb3)->fs_u.fs_sun.fs_state); - else - return SWAB32((usb3)->fs_u.fs_44.fs_state); + switch (flags & UFS_ST_MASK) { + case UFS_ST_SUN: + return SWAB32((usb3)->fs_u2.fs_sun.fs_state); + case UFS_ST_SUNx86: + return SWAB32((usb1)->fs_u1.fs_sunx86.fs_state); + case UFS_ST_44BSD: + default: + return SWAB32((usb3)->fs_u2.fs_44.fs_state); + } +} + +#define ufs_set_fs_state(usb1,usb3,value) _ufs_set_fs_state_(usb1,usb3,value,flags,swab) +static inline void _ufs_set_fs_state_(struct ufs_super_block_first * usb1, + struct ufs_super_block_third * usb3, __s32 value, unsigned flags, unsigned swab) +{ + switch (flags & UFS_ST_MASK) { + case UFS_ST_SUN: + (usb3)->fs_u2.fs_sun.fs_state = SWAB32(value); + break; + case UFS_ST_SUNx86: + (usb1)->fs_u1.fs_sunx86.fs_state = SWAB32(value); + break; + case UFS_ST_44BSD: + (usb3)->fs_u2.fs_44.fs_state = SWAB32(value); + break; + } } -#define ufs_set_fs_state(usb3,value) _ufs_set_fs_state_(usb3,value,flags,swab) -static inline void _ufs_set_fs_state_(struct ufs_super_block_third * usb3, - __s32 value, unsigned flags, unsigned swab) +#define ufs_get_fs_npsect(usb1,usb3) _ufs_get_fs_npsect_(usb1,usb3,flags,swab) +static inline __u32 _ufs_get_fs_npsect_(struct ufs_super_block_first * usb1, + struct ufs_super_block_third * usb3, unsigned flags, unsigned swab) { - if ((flags & UFS_ST_MASK) == UFS_ST_SUN) - (usb3)->fs_u.fs_sun.fs_state = SWAB32(value); - else - (usb3)->fs_u.fs_44.fs_state = SWAB32(value); + if ((flags & UFS_ST_MASK) == UFS_ST_SUNx86) + return SWAB32((usb3)->fs_u2.fs_sunx86.fs_npsect); + else + return SWAB32((usb1)->fs_u1.fs_sun.fs_npsect); } #define ufs_get_fs_qbmask(usb3) _ufs_get_fs_qbmask_(usb3,flags,swab) @@ -56,13 +78,19 @@ static inline __u64 _ufs_get_fs_qbmask_(struct ufs_super_block_third * usb3, unsigned flags, unsigned swab) { __u64 tmp; - if ((flags & UFS_ST_MASK) == UFS_ST_SUN) { - ((u32 *)&tmp)[0] = usb3->fs_u.fs_sun.fs_qbmask[0]; - ((u32 *)&tmp)[1] = usb3->fs_u.fs_sun.fs_qbmask[1]; - } - else { - ((u32 *)&tmp)[0] = usb3->fs_u.fs_44.fs_qbmask[0]; - ((u32 *)&tmp)[1] = usb3->fs_u.fs_44.fs_qbmask[1]; + switch (flags & UFS_ST_MASK) { + case UFS_ST_SUN: + ((u32 *)&tmp)[0] = usb3->fs_u2.fs_sun.fs_qbmask[0]; + ((u32 *)&tmp)[1] = usb3->fs_u2.fs_sun.fs_qbmask[1]; + break; + case UFS_ST_SUNx86: + ((u32 *)&tmp)[0] = usb3->fs_u2.fs_sunx86.fs_qbmask[0]; + ((u32 *)&tmp)[1] = usb3->fs_u2.fs_sunx86.fs_qbmask[1]; + break; + case UFS_ST_44BSD: + ((u32 *)&tmp)[0] = usb3->fs_u2.fs_44.fs_qbmask[0]; + ((u32 *)&tmp)[1] = usb3->fs_u2.fs_44.fs_qbmask[1]; + break; } return SWAB64(tmp); } @@ -72,13 +100,19 @@ static inline __u64 _ufs_get_fs_qfmask_(struct ufs_super_block_third * usb3, unsigned flags, unsigned swab) { __u64 tmp; - if ((flags & UFS_ST_MASK) == UFS_ST_SUN) { - ((u32 *)&tmp)[0] = usb3->fs_u.fs_sun.fs_qfmask[0]; - ((u32 *)&tmp)[1] = usb3->fs_u.fs_sun.fs_qfmask[1]; - } - else { - ((u32 *)&tmp)[0] = usb3->fs_u.fs_44.fs_qfmask[0]; - ((u32 *)&tmp)[1] = usb3->fs_u.fs_44.fs_qfmask[1]; + switch (flags & UFS_ST_MASK) { + case UFS_ST_SUN: + ((u32 *)&tmp)[0] = usb3->fs_u2.fs_sun.fs_qfmask[0]; + ((u32 *)&tmp)[1] = usb3->fs_u2.fs_sun.fs_qfmask[1]; + break; + case UFS_ST_SUNx86: + ((u32 *)&tmp)[0] = usb3->fs_u2.fs_sunx86.fs_qfmask[0]; + ((u32 *)&tmp)[1] = usb3->fs_u2.fs_sunx86.fs_qfmask[1]; + break; + case UFS_ST_44BSD: + ((u32 *)&tmp)[0] = usb3->fs_u2.fs_44.fs_qfmask[0]; + ((u32 *)&tmp)[1] = usb3->fs_u2.fs_44.fs_qfmask[1]; + break; } return SWAB64(tmp); } |