summaryrefslogtreecommitdiffstats
path: root/sbin/fsdb
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2011-09-28 18:53:36 +0000
committered <ed@FreeBSD.org>2011-09-28 18:53:36 +0000
commit2a84e78d2ee67e2efdc4107a8a067cca7f435e1c (patch)
treeefc748c3ad32a5751cb0627cfa2b151f69147a78 /sbin/fsdb
parentce36da245f8d051544101d1b63405860d1e57c4b (diff)
downloadFreeBSD-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 'sbin/fsdb')
-rw-r--r--sbin/fsdb/fsdbutil.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c
index 2c5710a..7ed78a7 100644
--- a/sbin/fsdb/fsdbutil.c
+++ b/sbin/fsdb/fsdbutil.c
@@ -126,12 +126,10 @@ printstat(const char *cp, ino_t inum, union dinode *dp)
puts("regular file");
break;
case IFBLK:
- printf("block special (%d,%d)",
- major(DIP(dp, di_rdev)), minor(DIP(dp, di_rdev)));
+ printf("block special (%#jx)", (uintmax_t)DIP(dp, di_rdev));
break;
case IFCHR:
- printf("character special (%d,%d)",
- major(DIP(dp, di_rdev)), minor(DIP(dp, di_rdev)));
+ printf("character special (%#jx)", DIP(dp, di_rdev));
break;
case IFLNK:
fputs("symlink",stdout);
OpenPOWER on IntegriCloud