From owner-svn-src-head@FreeBSD.ORG Thu Feb 5 22:42:46 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B2BCA985; Thu, 5 Feb 2015 22:42:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9DE3FA04; Thu, 5 Feb 2015 22:42:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t15Mgk7J096533; Thu, 5 Feb 2015 22:42:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t15MgjAE096524; Thu, 5 Feb 2015 22:42:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201502052242.t15MgjAE096524@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Feb 2015 22:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278299 - in head: lib/libdevinfo sys/kern sys/sys usr.sbin/devinfo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2015 22:42:46 -0000 Author: jhb Date: Thu Feb 5 22:42:44 2015 New Revision: 278299 URL: https://svnweb.freebsd.org/changeset/base/278299 Log: Expose the constants for internal new-bus device flags to userland. The flag value is already exposed via dv_flags, just not the meaning of the flags themselves. Use these constants to annotate devices that are disabled or suspended in devinfo output. Modified: head/lib/libdevinfo/devinfo.h head/sys/kern/subr_bus.c head/sys/sys/bus.h head/usr.sbin/devinfo/devinfo.c Modified: head/lib/libdevinfo/devinfo.h ============================================================================== --- head/lib/libdevinfo/devinfo.h Thu Feb 5 22:34:29 2015 (r278298) +++ head/lib/libdevinfo/devinfo.h Thu Feb 5 22:42:44 2015 (r278299) @@ -50,7 +50,7 @@ struct devinfo_dev { char *dd_location; /* Where bus thinks dev at */ uint32_t dd_devflags; /* API flags */ uint16_t dd_flags; /* internal dev flags */ - devinfo_state_t dd_state; /* attacement state of dev */ + devinfo_state_t dd_state; /* attachment state of dev */ }; struct devinfo_rman { Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu Feb 5 22:34:29 2015 (r278298) +++ head/sys/kern/subr_bus.c Thu Feb 5 22:42:44 2015 (r278299) @@ -128,15 +128,6 @@ struct device { device_state_t state; /**< current device state */ uint32_t devflags; /**< api level flags for device_get_flags() */ u_int flags; /**< internal device flags */ -#define DF_ENABLED 0x01 /* device should be probed/attached */ -#define DF_FIXEDCLASS 0x02 /* devclass specified at create time */ -#define DF_WILDCARD 0x04 /* unit was originally wildcard */ -#define DF_DESCMALLOCED 0x08 /* description was malloced */ -#define DF_QUIET 0x10 /* don't print verbose attach message */ -#define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ -#define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ -#define DF_REBID 0x80 /* Can rebid after attach */ -#define DF_SUSPENDED 0x100 /* Device is suspended. */ u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Feb 5 22:34:29 2015 (r278298) +++ head/sys/sys/bus.h Thu Feb 5 22:42:44 2015 (r278299) @@ -70,11 +70,22 @@ struct u_device { char dv_pnpinfo[128]; /**< @brief Plug and play info */ char dv_location[128]; /**< @brief Where is the device? */ uint32_t dv_devflags; /**< @brief API Flags for device */ - uint16_t dv_flags; /**< @brief flags for dev date */ + uint16_t dv_flags; /**< @brief flags for dev state */ device_state_t dv_state; /**< @brief State of attachment */ /* XXX more driver info? */ }; +/* Flags exported via dv_flags. */ +#define DF_ENABLED 0x01 /* device should be probed/attached */ +#define DF_FIXEDCLASS 0x02 /* devclass specified at create time */ +#define DF_WILDCARD 0x04 /* unit was originally wildcard */ +#define DF_DESCMALLOCED 0x08 /* description was malloced */ +#define DF_QUIET 0x10 /* don't print verbose attach message */ +#define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ +#define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ +#define DF_REBID 0x80 /* Can rebid after attach */ +#define DF_SUSPENDED 0x100 /* Device is suspended. */ + #ifdef _KERNEL #include Modified: head/usr.sbin/devinfo/devinfo.c ============================================================================== --- head/usr.sbin/devinfo/devinfo.c Thu Feb 5 22:34:29 2015 (r278298) +++ head/usr.sbin/devinfo/devinfo.c Thu Feb 5 22:42:44 2015 (r278299) @@ -146,6 +146,10 @@ print_device(struct devinfo_dev *dev, vo printf(" pnpinfo %s", dev->dd_pnpinfo); if (vflag && *dev->dd_location) printf(" at %s", dev->dd_location); + if (!(dev->dd_flags & DF_ENABLED)) + printf(" (disabled)"); + else if (dev->dd_flags & DF_SUSPENDED) + printf(" (suspended)"); printf("\n"); if (rflag) { ia.indent = indent + 4;