diff options
author | sobomax <sobomax@FreeBSD.org> | 2001-09-19 12:35:51 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2001-09-19 12:35:51 +0000 |
commit | ff08d3d5ce2dd8e6468ad93b1ad22ca6ac1406e0 (patch) | |
tree | 8df483bc107b2e40f066e9dd4ea5a695ecf5cb91 /sys/compat/linux/linux_stats.c | |
parent | 42cbd97a488a3d16be0877edc6134dcf9672469e (diff) | |
download | FreeBSD-src-ff08d3d5ce2dd8e6468ad93b1ad22ca6ac1406e0.zip FreeBSD-src-ff08d3d5ce2dd8e6468ad93b1ad22ca6ac1406e0.tar.gz |
Fix abuse of vtagtype. In addition, after this the linux programs will be
able correctly distinguish ext2fs from the ufs filesystem (previously ext2fs
was indistinguishable from the ufs).
Reviewed by: phk, marcel
Diffstat (limited to 'sys/compat/linux/linux_stats.c')
-rw-r--r-- | sys/compat/linux/linux_stats.c | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index d0c8ea2..f7d5b39 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -187,10 +187,6 @@ struct l_statfs { l_int f_spare[6]; }; -#ifndef VT_NWFS -#define VT_NWFS VT_TFS /* XXX - bug compat. with sys/fs/nwfs/nwfs_node.h */ -#endif - #define LINUX_CODA_SUPER_MAGIC 0x73757245L #define LINUX_EXT2_SUPER_MAGIC 0xEF53L #define LINUX_HPFS_SUPER_MAGIC 0xf995e849L @@ -202,34 +198,26 @@ struct l_statfs { #define LINUX_PROC_SUPER_MAGIC 0x9fa0L #define LINUX_UFS_SUPER_MAGIC 0x00011954L /* XXX - UFS_MAGIC in Linux */ -/* - * ext2fs uses the VT_UFS tag. A mounted ext2 filesystem will therefore - * be seen as an ufs filesystem. - */ static long -bsd_to_linux_ftype(int tag) +bsd_to_linux_ftype(const char *fstypename) { - - switch (tag) { - case VT_CODA: - return (LINUX_CODA_SUPER_MAGIC); - case VT_HPFS: - return (LINUX_HPFS_SUPER_MAGIC); - case VT_ISOFS: - return (LINUX_ISOFS_SUPER_MAGIC); - case VT_MSDOSFS: - return (LINUX_MSDOS_SUPER_MAGIC); - case VT_NFS: - return (LINUX_NFS_SUPER_MAGIC); - case VT_NTFS: - return (LINUX_NTFS_SUPER_MAGIC); - case VT_NWFS: - return (LINUX_NCP_SUPER_MAGIC); - case VT_PROCFS: - return (LINUX_PROC_SUPER_MAGIC); - case VT_UFS: - return (LINUX_UFS_SUPER_MAGIC); - } + int i; + static struct {const char *bsd_name; long linux_type;} b2l_tbl[] = { + {"ufs", LINUX_UFS_SUPER_MAGIC}, + {"cd9660", LINUX_ISOFS_SUPER_MAGIC}, + {"nfs", LINUX_NFS_SUPER_MAGIC}, + {"ext2fs", LINUX_EXT2_SUPER_MAGIC}, + {"procfs", LINUX_PROC_SUPER_MAGIC}, + {"msdosfs", LINUX_MSDOS_SUPER_MAGIC}, + {"ntfs", LINUX_NTFS_SUPER_MAGIC}, + {"nwfs", LINUX_NCP_SUPER_MAGIC}, + {"hpfs", LINUX_HPFS_SUPER_MAGIC}, + {"coda", LINUX_CODA_SUPER_MAGIC}, + {NULL, 0L}}; + + for (i = 0; b2l_tbl[i].bsd_name != NULL; i++) + if (strcmp(b2l_tbl[i].bsd_name, fstypename) == 0) + return (b2l_tbl[i].linux_type); return (0L); } @@ -265,7 +253,7 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args) if (error) return error; bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - linux_statfs.f_type = bsd_to_linux_ftype(bsd_statfs->f_type); + linux_statfs.f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename); linux_statfs.f_bsize = bsd_statfs->f_bsize; linux_statfs.f_blocks = bsd_statfs->f_blocks; linux_statfs.f_bfree = bsd_statfs->f_bfree; @@ -301,7 +289,7 @@ linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args) if (error) return error; bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - linux_statfs.f_type = bsd_to_linux_ftype(bsd_statfs->f_type); + linux_statfs.f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename); linux_statfs.f_bsize = bsd_statfs->f_bsize; linux_statfs.f_blocks = bsd_statfs->f_blocks; linux_statfs.f_bfree = bsd_statfs->f_bfree; |