Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Nov 2009 11:41:21 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r198850 - head/sbin/sysctl
Message-ID:  <200911031141.nA3BfLNB090451@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911031141.nA3BfLNB090451>