mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-05 12:56:08 +00:00
Make sure that stat(2) and friends always return a valid st_dev field.
Pseudo-FS need not fill in the va_fsid anymore, the syscall code will use the first half of the fsid, which now looks like a udev_t with major 255.
This commit is contained in:
parent
eb0fde47f8
commit
8947a90a90
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48468
@ -35,7 +35,7 @@
|
||||
*
|
||||
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
|
||||
*
|
||||
* $Id: fdesc_vnops.c,v 1.41 1999/01/27 22:42:06 dillon Exp $
|
||||
* $Id: fdesc_vnops.c,v 1.42 1999/05/31 11:27:49 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -460,7 +460,6 @@ fdesc_getattr(ap)
|
||||
}
|
||||
vap->va_uid = 0;
|
||||
vap->va_gid = 0;
|
||||
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
vap->va_blocksize = DEV_BSIZE;
|
||||
vap->va_atime.tv_sec = boottime.tv_sec;
|
||||
vap->va_atime.tv_nsec = 0;
|
||||
|
@ -37,11 +37,11 @@
|
||||
*
|
||||
* Ancestors:
|
||||
* @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92
|
||||
* $Id: null_vnops.c,v 1.32 1999/01/28 00:57:50 dillon Exp $
|
||||
* $Id: null_vnops.c,v 1.33 1999/06/16 23:27:38 mckusick Exp $
|
||||
* ...and...
|
||||
* @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
|
||||
*
|
||||
* $Id: null_vnops.c,v 1.32 1999/01/28 00:57:50 dillon Exp $
|
||||
* $Id: null_vnops.c,v 1.33 1999/06/16 23:27:38 mckusick Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -452,8 +452,6 @@ null_getattr(ap)
|
||||
|
||||
if ((error = null_bypass((struct vop_generic_args *)ap)) != 0)
|
||||
return (error);
|
||||
/* Requires that arguments be restored. */
|
||||
ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
*
|
||||
* @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
*
|
||||
* $Id: portal_vnops.c,v 1.34 1998/12/07 21:58:32 archie Exp $
|
||||
* $Id: portal_vnops.c,v 1.35 1999/01/12 11:49:30 eivind Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -449,7 +449,6 @@ portal_getattr(ap)
|
||||
vattr_null(vap);
|
||||
vap->va_uid = 0;
|
||||
vap->va_gid = 0;
|
||||
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
vap->va_size = DEV_BSIZE;
|
||||
vap->va_blocksize = DEV_BSIZE;
|
||||
nanotime(&vap->va_atime);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)umap_vnops.c 8.6 (Berkeley) 5/22/95
|
||||
* $Id: umap_vnops.c,v 1.26 1998/12/07 21:58:34 archie Exp $
|
||||
* $Id: umap_vnops.c,v 1.27 1999/06/16 23:27:41 mckusick Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -294,8 +294,6 @@ umap_getattr(ap)
|
||||
error = umap_bypass((struct vop_generic_args *)ap);
|
||||
if (error)
|
||||
return (error);
|
||||
/* Requires that arguments be restored. */
|
||||
ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
|
||||
/*
|
||||
* Umap needs to map the uid and gid returned by a stat
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)union_vnops.c 8.32 (Berkeley) 6/23/95
|
||||
* $Id: union_vnops.c,v 1.60 1999/01/27 22:42:08 dillon Exp $
|
||||
* $Id: union_vnops.c,v 1.61 1999/06/16 23:27:43 mckusick Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -800,7 +800,6 @@ union_getattr(ap)
|
||||
if ((vap != ap->a_vap) && (vap->va_type == VDIR))
|
||||
ap->a_vap->va_nlink += vap->va_nlink;
|
||||
|
||||
ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.203 1999/06/26 02:46:10 mckusick Exp $
|
||||
* $Id: vfs_subr.c,v 1.204 1999/07/01 13:21:41 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -333,16 +333,17 @@ vfs_getnewfsid(mp)
|
||||
|
||||
simple_lock(&mntid_slock);
|
||||
mtype = mp->mnt_vfc->vfc_typenum;
|
||||
mp->mnt_stat.f_fsid.val[0] = (256 + mtype) * 256;
|
||||
mp->mnt_stat.f_fsid.val[0] = umakedev(255, mtype);
|
||||
mp->mnt_stat.f_fsid.val[1] = mtype;
|
||||
if (xxxfs_mntid == 0)
|
||||
++xxxfs_mntid;
|
||||
tfsid.val[0] = (256 + mtype) * 256 | xxxfs_mntid;
|
||||
tfsid.val[0] = umakedev(255, mtype + (xxxfs_mntid << 16));
|
||||
tfsid.val[1] = mtype;
|
||||
if (mountlist.cqh_first != (void *)&mountlist) {
|
||||
while (vfs_getvfs(&tfsid)) {
|
||||
tfsid.val[0]++;
|
||||
xxxfs_mntid++;
|
||||
tfsid.val[0] = umakedev(255,
|
||||
mtype + (xxxfs_mntid << 16));
|
||||
}
|
||||
}
|
||||
mp->mnt_stat.f_fsid.val[0] = tfsid.val[0];
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.203 1999/06/26 02:46:10 mckusick Exp $
|
||||
* $Id: vfs_subr.c,v 1.204 1999/07/01 13:21:41 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -333,16 +333,17 @@ vfs_getnewfsid(mp)
|
||||
|
||||
simple_lock(&mntid_slock);
|
||||
mtype = mp->mnt_vfc->vfc_typenum;
|
||||
mp->mnt_stat.f_fsid.val[0] = (256 + mtype) * 256;
|
||||
mp->mnt_stat.f_fsid.val[0] = umakedev(255, mtype);
|
||||
mp->mnt_stat.f_fsid.val[1] = mtype;
|
||||
if (xxxfs_mntid == 0)
|
||||
++xxxfs_mntid;
|
||||
tfsid.val[0] = (256 + mtype) * 256 | xxxfs_mntid;
|
||||
tfsid.val[0] = umakedev(255, mtype + (xxxfs_mntid << 16));
|
||||
tfsid.val[1] = mtype;
|
||||
if (mountlist.cqh_first != (void *)&mountlist) {
|
||||
while (vfs_getvfs(&tfsid)) {
|
||||
tfsid.val[0]++;
|
||||
xxxfs_mntid++;
|
||||
tfsid.val[0] = umakedev(255,
|
||||
mtype + (xxxfs_mntid << 16));
|
||||
}
|
||||
}
|
||||
mp->mnt_stat.f_fsid.val[0] = tfsid.val[0];
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
|
||||
* $Id: vfs_vnops.c,v 1.67 1999/04/27 11:16:27 phk Exp $
|
||||
* $Id: vfs_vnops.c,v 1.68 1999/04/28 11:37:12 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -378,7 +378,10 @@ vn_stat(vp, sb, p)
|
||||
/*
|
||||
* Copy from vattr table
|
||||
*/
|
||||
sb->st_dev = vap->va_fsid;
|
||||
if (vap->va_fsid != VNOVAL)
|
||||
sb->st_dev = vap->va_fsid;
|
||||
else
|
||||
sb->st_dev = vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
sb->st_ino = vap->va_fileid;
|
||||
mode = vap->va_mode;
|
||||
switch (vap->va_type) {
|
||||
|
@ -35,7 +35,7 @@
|
||||
*
|
||||
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
|
||||
*
|
||||
* $Id: fdesc_vnops.c,v 1.41 1999/01/27 22:42:06 dillon Exp $
|
||||
* $Id: fdesc_vnops.c,v 1.42 1999/05/31 11:27:49 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -460,7 +460,6 @@ fdesc_getattr(ap)
|
||||
}
|
||||
vap->va_uid = 0;
|
||||
vap->va_gid = 0;
|
||||
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
vap->va_blocksize = DEV_BSIZE;
|
||||
vap->va_atime.tv_sec = boottime.tv_sec;
|
||||
vap->va_atime.tv_nsec = 0;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kernfs_vnops.c 8.15 (Berkeley) 5/21/95
|
||||
* $Id: kernfs_vnops.c,v 1.37 1998/12/07 21:58:31 archie Exp $
|
||||
* $Id: kernfs_vnops.c,v 1.38 1999/01/27 22:42:06 dillon Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -378,7 +378,6 @@ kernfs_getattr(ap)
|
||||
vattr_null(vap);
|
||||
vap->va_uid = 0;
|
||||
vap->va_gid = 0;
|
||||
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
vap->va_size = 0;
|
||||
vap->va_blocksize = DEV_BSIZE;
|
||||
nanotime(&vap->va_atime);
|
||||
|
@ -37,11 +37,11 @@
|
||||
*
|
||||
* Ancestors:
|
||||
* @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92
|
||||
* $Id: null_vnops.c,v 1.32 1999/01/28 00:57:50 dillon Exp $
|
||||
* $Id: null_vnops.c,v 1.33 1999/06/16 23:27:38 mckusick Exp $
|
||||
* ...and...
|
||||
* @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
|
||||
*
|
||||
* $Id: null_vnops.c,v 1.32 1999/01/28 00:57:50 dillon Exp $
|
||||
* $Id: null_vnops.c,v 1.33 1999/06/16 23:27:38 mckusick Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -452,8 +452,6 @@ null_getattr(ap)
|
||||
|
||||
if ((error = null_bypass((struct vop_generic_args *)ap)) != 0)
|
||||
return (error);
|
||||
/* Requires that arguments be restored. */
|
||||
ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
*
|
||||
* @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
*
|
||||
* $Id: portal_vnops.c,v 1.34 1998/12/07 21:58:32 archie Exp $
|
||||
* $Id: portal_vnops.c,v 1.35 1999/01/12 11:49:30 eivind Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -449,7 +449,6 @@ portal_getattr(ap)
|
||||
vattr_null(vap);
|
||||
vap->va_uid = 0;
|
||||
vap->va_gid = 0;
|
||||
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
vap->va_size = DEV_BSIZE;
|
||||
vap->va_blocksize = DEV_BSIZE;
|
||||
nanotime(&vap->va_atime);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)umap_vnops.c 8.6 (Berkeley) 5/22/95
|
||||
* $Id: umap_vnops.c,v 1.26 1998/12/07 21:58:34 archie Exp $
|
||||
* $Id: umap_vnops.c,v 1.27 1999/06/16 23:27:41 mckusick Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -294,8 +294,6 @@ umap_getattr(ap)
|
||||
error = umap_bypass((struct vop_generic_args *)ap);
|
||||
if (error)
|
||||
return (error);
|
||||
/* Requires that arguments be restored. */
|
||||
ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
|
||||
/*
|
||||
* Umap needs to map the uid and gid returned by a stat
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)union_vnops.c 8.32 (Berkeley) 6/23/95
|
||||
* $Id: union_vnops.c,v 1.60 1999/01/27 22:42:08 dillon Exp $
|
||||
* $Id: union_vnops.c,v 1.61 1999/06/16 23:27:43 mckusick Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -800,7 +800,6 @@ union_getattr(ap)
|
||||
if ((vap != ap->a_vap) && (vap->va_type == VDIR))
|
||||
ap->a_vap->va_nlink += vap->va_nlink;
|
||||
|
||||
ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user