From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 16:44:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ED08106566B; Sun, 15 Nov 2009 16:44:44 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D2838FC12; Sun, 15 Nov 2009 16:44:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAFGiiE9042742; Sun, 15 Nov 2009 16:44:44 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAFGiiOT042741; Sun, 15 Nov 2009 16:44:44 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200911151644.nAFGiiOT042741@svn.freebsd.org> From: Attilio Rao Date: Sun, 15 Nov 2009 16:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199291 - in head: lib/libdevinfo tools/tools/ncpus usr.sbin/bsnmpd/modules/snmp_hostres usr.sbin/devinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 15 Nov 2009 16:44:44 -0000 Author: attilio Date: Sun Nov 15 16:44:43 2009 New Revision: 199291 URL: http://svn.freebsd.org/changeset/base/199291 Log: Collapse devinfo_state_t with device_state_t in order to avoid a structure replication and improve manteneability. Reviewed by: jhb, imp Tested by: Riccardo Torrini Modified: head/lib/libdevinfo/devinfo.h head/tools/tools/ncpus/acpi.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c head/usr.sbin/devinfo/devinfo.c Modified: head/lib/libdevinfo/devinfo.h ============================================================================== --- head/lib/libdevinfo/devinfo.h Sun Nov 15 14:11:26 2009 (r199290) +++ head/lib/libdevinfo/devinfo.h Sun Nov 15 16:44:43 2009 (r199291) @@ -32,20 +32,12 @@ #include #include +#include typedef __uintptr_t devinfo_handle_t; #define DEVINFO_ROOT_DEVICE ((devinfo_handle_t)0) -/* - * State of the device. - */ -/* XXX not sure if I want a copy here, or expose sys/bus.h */ -typedef enum devinfo_state { - DIS_NOTPRESENT = 10, /* not probed or probe failed */ - DIS_ALIVE = 20, /* probe succeeded */ - DIS_ATTACHED = 30, /* attach method called */ - DIS_BUSY = 40 /* device is open */ -} devinfo_state_t; +typedef enum device_state devinfo_state_t; struct devinfo_dev { devinfo_handle_t dd_handle; /* device handle */ Modified: head/tools/tools/ncpus/acpi.c ============================================================================== --- head/tools/tools/ncpus/acpi.c Sun Nov 15 14:11:26 2009 (r199290) +++ head/tools/tools/ncpus/acpi.c Sun Nov 15 16:44:43 2009 (r199291) @@ -247,13 +247,13 @@ static const char * devstate(devinfo_state_t state) { switch (state) { - case DIS_NOTPRESENT: + case DS_NOTPRESENT: return "not-present"; - case DIS_ALIVE: + case DS_ALIVE: return "alive"; - case DIS_ATTACHED: + case DS_ATTACHED: return "attached"; - case DIS_BUSY: + case DS_BUSY: return "busy"; default: return "unknown-state"; @@ -266,8 +266,8 @@ acpi0_check(struct devinfo_dev *dd, void printf("%s: %s %s\n", __func__, dd->dd_name, devstate(dd->dd_state)); /* NB: device must be present AND attached */ if (strcmp(dd->dd_name, "acpi0") == 0) - return (dd->dd_state == DIS_ATTACHED || - dd->dd_state == DIS_BUSY); + return (dd->dd_state == DS_ATTACHED || + dd->dd_state == DS_BUSY); return devinfo_foreach_device_child(dd, acpi0_check, arg); } Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Sun Nov 15 14:11:26 2009 (r199290) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Sun Nov 15 16:44:43 2009 (r199291) @@ -352,11 +352,11 @@ device_get_status(struct devinfo_dev *de assert(dev != NULL); switch (dev->dd_state) { - case DIS_ALIVE: /* probe succeeded */ - case DIS_NOTPRESENT: /* not probed or probe failed */ + case DS_ALIVE: /* probe succeeded */ + case DS_NOTPRESENT: /* not probed or probe failed */ return (DS_DOWN); - case DIS_ATTACHED: /* attach method called */ - case DIS_BUSY: /* device is open */ + case DS_ATTACHED: /* attach method called */ + case DS_BUSY: /* device is open */ return (DS_RUNNING); default: return (DS_UNKNOWN); Modified: head/usr.sbin/devinfo/devinfo.c ============================================================================== --- head/usr.sbin/devinfo/devinfo.c Sun Nov 15 14:11:26 2009 (r199290) +++ head/usr.sbin/devinfo/devinfo.c Sun Nov 15 16:44:43 2009 (r199291) @@ -137,7 +137,7 @@ print_device(struct devinfo_dev *dev, vo struct indent_arg ia; int i, indent; - if (vflag || (dev->dd_name[0] != 0 && dev->dd_state >= DIS_ATTACHED)) { + if (vflag || (dev->dd_name[0] != 0 && dev->dd_state >= DS_ATTACHED)) { indent = (int)(intptr_t)arg; for (i = 0; i < indent; i++) printf(" ");