diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2013-04-15 15:32:20 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2013-04-15 15:32:20 +0000 |
commit | fe915cc6dc03f86ee7339daa4ac45c90980b5481 (patch) | |
tree | 8fb04d8fb16c2c63fcefd0cfd0a04d80c0af3ad8 /sys/ufs | |
parent | f85d6054d53f84d310202c4342c2f64d0107d0a5 (diff) |
Add an f_mntfromspec member to struct statfs, which specifies the name of
the special provided when the mount was requested. This may be the same as
the special that was actually used for the mount (e.g. in the case of a
device node) or it may be different (e.g. in the case of a DUID).
Whilst here, change f_ctime to a 64 bit type and remove the pointless
f_spare members.
Compatibility goo courtesy of guenther@
ok krw@ millert@
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vfsops.c | 18 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 26 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vfsops.c | 6 |
3 files changed, 31 insertions, 19 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 9902670485f..84f392769b7 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.65 2012/09/10 11:11:00 jsing Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.66 2013/04/15 15:32:19 jsing Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -167,11 +167,12 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, struct ufs_args args; struct ufsmount *ump = NULL; struct m_ext2fs *fs; + char fname[MNAMELEN]; char fspec[MNAMELEN]; int error, flags; mode_t accessmode; - error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args)); + error = copyin(data, &args, sizeof(struct ufs_args)); if (error) return (error); @@ -238,9 +239,11 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, error = copyinstr(args.fspec, fspec, sizeof(fspec), NULL); if (error) goto error; - disk_map(fspec, fspec, MNAMELEN, DM_OPENBLCK); - NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, p); + if (disk_map(fspec, fname, MNAMELEN, DM_OPENBLCK) == -1) + bcopy(fspec, fname, sizeof(fname)); + + NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fname, p); if ((error = namei(ndp)) != 0) goto error; devvp = ndp->ni_vp; @@ -289,7 +292,9 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, } bcopy(fs->e2fs_fsmnt, mp->mnt_stat.f_mntonname, MNAMELEN); bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); - strlcpy(mp->mnt_stat.f_mntfromname, fspec, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromname, fname, MNAMELEN); + bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN); if (fs->e2fs_fmod != 0) { /* XXX */ fs->e2fs_fmod = 0; @@ -298,7 +303,7 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, else printf("%s: file system not clean; please fsck(8)\n", mp->mnt_stat.f_mntfromname); - (void)ext2fs_cgupdate(ump, MNT_WAIT); + ext2fs_cgupdate(ump, MNT_WAIT); } goto success; @@ -695,6 +700,7 @@ ext2fs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p) if (sbp != &mp->mnt_stat) { bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + bcopy(mp->mnt_stat.f_mntfromspec, sbp->f_mntfromspec, MNAMELEN); } strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); return (0); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 5c9e95c972a..aa9843cfe06 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.135 2012/09/10 11:11:00 jsing Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.136 2013/04/15 15:32:19 jsing Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -170,13 +170,13 @@ ffs_mount(struct mount *mp, const char *path, void *data, struct ufs_args args; struct ufsmount *ump = NULL; struct fs *fs; + char fname[MNAMELEN]; char fspec[MNAMELEN]; int error = 0, flags; int ronly; mode_t accessmode; - size_t size; - error = copyin(data, &args, sizeof (struct ufs_args)); + error = copyin(data, &args, sizeof(struct ufs_args)); if (error) return (error); @@ -336,10 +336,12 @@ ffs_mount(struct mount *mp, const char *path, void *data, */ error = copyinstr(args.fspec, fspec, sizeof(fspec), NULL); if (error) - goto error_1; - disk_map(fspec, fspec, MNAMELEN, DM_OPENBLCK); + goto error_1; + + if (disk_map(fspec, fname, MNAMELEN, DM_OPENBLCK) == -1) + bcopy(fspec, fname, sizeof(fname)); - NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, p); + NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fname, p); if ((error = namei(ndp)) != 0) goto error_1; @@ -392,10 +394,10 @@ ffs_mount(struct mount *mp, const char *path, void *data, /* * Save "mounted from" info for mount point (NULL pad) */ - size = strlcpy(mp->mnt_stat.f_mntfromname, fspec, - MNAMELEN - 1); - bzero(mp->mnt_stat.f_mntfromname + size, - MNAMELEN - size); + bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromname, fname, MNAMELEN); + bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN); } } else { /* @@ -407,7 +409,9 @@ ffs_mount(struct mount *mp, const char *path, void *data, bzero(mp->mnt_stat.f_mntonname, MNAMELEN); strlcpy(mp->mnt_stat.f_mntonname, path, MNAMELEN); bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); - strlcpy(mp->mnt_stat.f_mntfromname, fspec, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromname, fname, MNAMELEN); + bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN); error = ffs_mountfs(devvp, mp, p); } diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index c29b924d14b..f793a921704 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vfsops.c,v 1.45 2013/01/15 11:20:55 jsing Exp $ */ +/* $OpenBSD: mfs_vfsops.c,v 1.46 2013/04/15 15:32:19 jsing Exp $ */ /* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */ /* @@ -94,7 +94,7 @@ mfs_mount(struct mount *mp, const char *path, void *data, char fspec[MNAMELEN]; int flags, error; - error = copyin(data, (caddr_t)&args, sizeof(struct mfs_args)); + error = copyin(data, &args, sizeof(struct mfs_args)); if (error) return (error); @@ -152,6 +152,8 @@ mfs_mount(struct mount *mp, const char *path, void *data, bcopy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname, MNAMELEN); bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); strlcpy(mp->mnt_stat.f_mntfromname, fspec, MNAMELEN); + bzero(mp->mnt_stat.f_mntfromspec, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromspec, fspec, MNAMELEN); bcopy(&args, &mp->mnt_stat.mount_info.mfs_args, sizeof(args)); return (0); |