Date: Sun, 31 Jan 2010 15:19:16 +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: r203292 - head/sys/fs/devfs Message-ID: <201001311519.o0VFJGkx061289@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Sun Jan 31 15:19:16 2010 New Revision: 203292 URL: http://svn.freebsd.org/changeset/base/203292 Log: Properly use dev_refl()/dev_rel() in kern.devname. While there, perform some clean-up fixes. Update some stale comments on struct cdev * instead of dev_t and devfs_random(). Also add some missing whitespace. MFC after: 1 week Modified: head/sys/fs/devfs/devfs_devs.c Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Sun Jan 31 15:07:38 2010 (r203291) +++ head/sys/fs/devfs/devfs_devs.c Sun Jan 31 15:19:16 2010 (r203292) @@ -72,8 +72,8 @@ SYSCTL_UINT(_vfs_devfs, OID_AUTO, rule_d &devfs_rule_depth, 0, "Max depth of ruleset include"); /* - * Helper sysctl for devname(3). We're given a struct cdev * and return - * the name, if any, registered by the device driver. + * Helper sysctl for devname(3). We're given a dev_t and return the + * name, if any, registered by the device driver. */ static int sysctl_devname(SYSCTL_HANDLER_ARGS) @@ -81,23 +81,26 @@ sysctl_devname(SYSCTL_HANDLER_ARGS) int error; dev_t ud; struct cdev_priv *cdp; + struct cdev *dev; error = SYSCTL_IN(req, &ud, sizeof (ud)); if (error) return (error); if (ud == NODEV) - return(EINVAL); -/* - ud ^ devfs_random(); -*/ + return (EINVAL); + dev = NULL; dev_lock(); TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) - if (cdp->cdp_inode == ud) + if (cdp->cdp_inode == ud) { + dev = &cdp->cdp_c; + dev_refl(dev); break; + } dev_unlock(); - if (cdp == NULL) - return(ENOENT); - return(SYSCTL_OUT(req, cdp->cdp_c.si_name, strlen(cdp->cdp_c.si_name) + 1)); + if (dev == NULL) + return (ENOENT); + error = SYSCTL_OUT(req, dev->si_name, strlen(dev->si_name) + 1); + dev_rel(dev); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001311519.o0VFJGkx061289>