diff options
author | ed <ed@FreeBSD.org> | 2011-09-28 18:53:36 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2011-09-28 18:53:36 +0000 |
commit | 2a84e78d2ee67e2efdc4107a8a067cca7f435e1c (patch) | |
tree | efc748c3ad32a5751cb0627cfa2b151f69147a78 /usr.bin/fstat | |
parent | ce36da245f8d051544101d1b63405860d1e57c4b (diff) | |
download | FreeBSD-src-2a84e78d2ee67e2efdc4107a8a067cca7f435e1c.zip FreeBSD-src-2a84e78d2ee67e2efdc4107a8a067cca7f435e1c.tar.gz |
Get rid of major/minor number distinction.
As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.
Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):
"If the file is a character special or block special file, the
size of the file may be replaced with implementation-defined
information associated with the device in question."
This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.
Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).
Diffstat (limited to 'usr.bin/fstat')
-rw-r--r-- | usr.bin/fstat/fstat.1 | 4 | ||||
-rw-r--r-- | usr.bin/fstat/fstat.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/fstat/fstat.1 b/usr.bin/fstat/fstat.1 index e1f1c1b..7403a8e 100644 --- a/usr.bin/fstat/fstat.1 +++ b/usr.bin/fstat/fstat.1 @@ -28,7 +28,7 @@ .\" @(#)fstat.1 8.3 (Berkeley) 2/25/94 .\" $FreeBSD$ .\" -.Dd July 9, 2009 +.Dd September 28, 2011 .Dt FSTAT 1 .Os .Sh NAME @@ -142,7 +142,7 @@ pathname that the file system the file resides in is mounted on. If the .Fl n flag is specified, this header is present and is the -major/minor number of the device that this file resides in. +number of the device that this file resides in. .It Li INUM The inode number of the file. .It Li MODE diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 531eef2..c513a46 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -411,7 +411,7 @@ print_pts_info(struct procstat *procstat, struct filestat *fst) } printf("* pseudo-terminal master "); if (nflg || !*pts.devname) { - printf("%10d,%-2d", major(pts.dev), minor(pts.dev)); + printf("%#10jx", (uintmax_t)pts.dev); } else { printf("%10s", pts.devname); } @@ -441,7 +441,7 @@ print_vnode_info(struct procstat *procstat, struct filestat *fst) } if (nflg) - printf(" %2d,%-2d", major(vn.vn_fsid), minor(vn.vn_fsid)); + printf(" %#8jx", (uintmax_t)vn.vn_fsid); else if (vn.vn_mntdir != NULL) (void)printf(" %-8s", vn.vn_mntdir); @@ -457,7 +457,7 @@ print_vnode_info(struct procstat *procstat, struct filestat *fst) if (vn.vn_type == PS_FST_VTYPE_VBLK || vn.vn_type == PS_FST_VTYPE_VCHR) { if (nflg || !*vn.vn_devname) - printf(" %2d,%-2d", major(vn.vn_dev), minor(vn.vn_dev)); + printf(" %#6jx", (uintmax_t)vn.vn_dev); else { printf(" %6s", vn.vn_devname); } |