Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ufs Propagate fix from lfs:
details: https://anonhg.NetBSD.org/src/rev/92366173a99d
branches: trunk
changeset: 340334:92366173a99d
user: dholland <dholland%NetBSD.org@localhost>
date: Tue Sep 01 06:09:23 2015 +0000
description:
Propagate fix from lfs:
For non-devices, have getattr (and thus stat) produce NODEV in the
rdev field, instead of leaking the address of the first direct block.
diffstat:
sys/ufs/ufs/ufs_vnops.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
diffs (56 lines):
diff -r 005bb57c0ee2 -r 92366173a99d sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c Tue Sep 01 06:08:37 2015 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c Tue Sep 01 06:09:23 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_vnops.c,v 1.230 2015/04/20 23:03:09 riastradh Exp $ */
+/* $NetBSD: ufs_vnops.c,v 1.231 2015/09/01 06:09:23 dholland Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.230 2015/04/20 23:03:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.231 2015/09/01 06:09:23 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -378,8 +378,16 @@
vap->va_gid = ip->i_gid;
vap->va_size = vp->v_size;
if (ip->i_ump->um_fstype == UFS1) {
- vap->va_rdev = (dev_t)ufs_rw32(ip->i_ffs1_rdev,
- UFS_MPNEEDSWAP(ip->i_ump));
+ switch (vp->v_type) {
+ case VBLK:
+ case VCHR:
+ vap->va_rdev = (dev_t)ufs_rw32(ip->i_ffs1_rdev,
+ UFS_MPNEEDSWAP(ip->i_ump));
+ break;
+ default:
+ vap->va_rdev = NODEV;
+ break;
+ }
vap->va_atime.tv_sec = ip->i_ffs1_atime;
vap->va_atime.tv_nsec = ip->i_ffs1_atimensec;
vap->va_mtime.tv_sec = ip->i_ffs1_mtime;
@@ -390,8 +398,16 @@
vap->va_birthtime.tv_nsec = 0;
vap->va_bytes = dbtob((u_quad_t)ip->i_ffs1_blocks);
} else {
- vap->va_rdev = (dev_t)ufs_rw64(ip->i_ffs2_rdev,
- UFS_MPNEEDSWAP(ip->i_ump));
+ switch (vp->v_type) {
+ case VBLK:
+ case VCHR:
+ vap->va_rdev = (dev_t)ufs_rw64(ip->i_ffs2_rdev,
+ UFS_MPNEEDSWAP(ip->i_ump));
+ break;
+ default:
+ vap->va_rdev = NODEV;
+ break;
+ }
vap->va_atime.tv_sec = ip->i_ffs2_atime;
vap->va_atime.tv_nsec = ip->i_ffs2_atimensec;
vap->va_mtime.tv_sec = ip->i_ffs2_mtime;
Home |
Main Index |
Thread Index |
Old Index