svn commit: r198850 - head/sbin/sysctl

Ed Schouten ed at FreeBSD.org
Tue Nov 3 11:41:21 UTC 2009


Author: ed
Date: Tue Nov  3 11:41:21 2009
New Revision: 198850
URL: http://svn.freebsd.org/changeset/base/198850

Log:
  Just use devname(3) to print device names.
  
  Right now sysctl just prints the major/minor numbers of a device.
  Instead of rolling our own routine for this, we'd better just call
  devname(3) to perform a translation to a device name for us.

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==============================================================================
--- head/sbin/sysctl/sysctl.c	Tue Nov  3 11:19:05 2009	(r198849)
+++ head/sbin/sysctl/sysctl.c	Tue Nov  3 11:41:21 2009	(r198850)
@@ -419,14 +419,7 @@ T_dev_t(int l2, void *p)
 		warnx("T_dev_T %d != %d", l2, sizeof(*d));
 		return (1);
 	}
-	if ((int)(*d) != -1) {
-		if (minor(*d) > 255 || minor(*d) < 0)
-			printf("{ major = %d, minor = 0x%x }",
-				major(*d), minor(*d));
-		else
-			printf("{ major = %d, minor = %d }",
-				major(*d), minor(*d));
-	}
+	printf("%s", devname(*d, S_IFCHR));
 	return (0);
 }
 


More information about the svn-src-head mailing list