Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102590622
D29937.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
97 KB
Referenced Files
None
Subscribers
None
D29937.diff
View Options
Index: share/man/man9/BUS_CHILD_LOCATION.9
===================================================================
--- /dev/null
+++ share/man/man9/BUS_CHILD_LOCATION.9
@@ -0,0 +1,61 @@
+.\"
+.\" Copyright (c) 2021 Netflix, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 22, 2021
+.Dt BUS_CHILD_LOCATION 9
+.Os
+.Sh NAME
+.Nm BUS_CHILD_LOCATION
+.Nd "obtain the location of a child on the bus."
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.In sys/sbuf.h
+.Ft void
+.Fn BUS_CHILD_LOCATION "device_t dev" "device_t child" "struct sbuf *sb"
+.Sh DESCRIPTION
+The
+.Fn BUS_CHILD_LOCATION
+method returns the location of the
+.Dv child
+device.
+This location is a series of key=value pairs.
+The string must be formatted as a space-separated list of key=value pairs.
+Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-').
+Values can contain any non-whitespace characters.
+Values containing whitespace can be quoted with double quotes ('"').
+Double quotes and backslashes in quoted values can be escaped with backslashes ('\').
+.Pp
+The location is defined as a series of characteristics of the
+.Dv child
+device that can be used to locate that device independent of what drivers are
+attached.
+Typically, these are slot numbers, bus addresses, or some topology formation.
+Where possible, buses are encouraged to provide locations that are stable from
+boot to boot and when other devices are added or removed.
+A location is not dependent on the kind of device at that location.
+.Sh SEE ALSO
+.Xr bus 9 ,
+.Xr device 9
Index: share/man/man9/BUS_CHILD_PNPINFO.9
===================================================================
--- /dev/null
+++ share/man/man9/BUS_CHILD_PNPINFO.9
@@ -0,0 +1,65 @@
+.\"
+.\" Copyright (c) 2021 Netflix, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 22, 2021
+.Dt BUS_CHILD_PNPINFO 9
+.Os
+.Sh NAME
+.Nm BUS_CHILD_PNPINFO
+.Nd "obtain the plug and play information from a device"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.In sys/sbuf.h
+.Ft void
+.Fn BUS_CHILD_PNPINFO "device_t dev" "device_t child" "struct sbuf *sb"
+.Sh DESCRIPTION
+The
+.Fn BUS_CHILD_LOCATION
+method returns the identifying information about the
+.Dv child
+device.
+This information is called the plug and play (pnp) details by some buses.
+This information is a series of key=value pairs.
+The string must be formatted as a space-separated list of key=value pairs.
+Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-').
+Values can contain any non-whitespace characters.
+Values containing whitespace can be quoted with double quotes ('"').
+Double quotes and backslashes in quoted values can be escaped with backslashes ('\').
+.Pp
+The pnpinfo is defined as a series of characteristics of the
+.Dv child
+device that are independent of which drivers are attached, but
+are used to allow drivers to claim a device.
+Typically, plug and play information encodes who made the device, what the model
+number is, and some generic details about the device.
+By convention, only the generic information about the device that's used by
+drivers on that bus to decide on accepting the device is reported.
+Other configuration information (such as the cache burst size) needed for the
+operation of the device, but that doesn't distinguish it broadly from other
+devices is not reported.
+.Sh SEE ALSO
+.Xr bus 9 ,
+.Xr device 9
Index: share/man/man9/Makefile
===================================================================
--- share/man/man9/Makefile
+++ share/man/man9/Makefile
@@ -34,6 +34,8 @@
bus_child_present.9 \
BUS_CHILD_DELETED.9 \
BUS_CHILD_DETACHED.9 \
+ BUS_CHILD_LOCATION.9 \
+ BUS_CHILD_PNPINFO.9 \
BUS_CONFIG_INTR.9 \
bus_delayed_attach_children.9 \
BUS_DESCRIBE_INTR.9 \
Index: sys/arm/allwinner/a10_ahci.c
===================================================================
--- sys/arm/allwinner/a10_ahci.c
+++ sys/arm/allwinner/a10_ahci.c
@@ -413,7 +413,7 @@
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD_END
};
Index: sys/arm/freescale/imx/imx6_ahci.c
===================================================================
--- sys/arm/freescale/imx/imx6_ahci.c
+++ sys/arm/freescale/imx/imx6_ahci.c
@@ -347,7 +347,7 @@
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD_END
};
Index: sys/arm/nvidia/tegra_ahci.c
===================================================================
--- sys/arm/nvidia/tegra_ahci.c
+++ sys/arm/nvidia/tegra_ahci.c
@@ -773,7 +773,7 @@
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
DEVMETHOD_END
Index: sys/dev/acpica/acpi.c
===================================================================
--- sys/dev/acpica/acpi.c
+++ sys/dev/acpica/acpi.c
@@ -177,10 +177,10 @@
static int acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_pm_func(u_long cmd, void *arg, ...);
-static int acpi_child_location_str_method(device_t acdev, device_t child,
- char *buf, size_t buflen);
-static int acpi_child_pnpinfo_str_method(device_t acdev, device_t child,
- char *buf, size_t buflen);
+static int acpi_child_location_method(device_t acdev, device_t child,
+ struct sbuf *sb);
+static int acpi_child_pnpinfo_method(device_t acdev, device_t child,
+ struct sbuf *sb);
static void acpi_enable_pcie(void);
static void acpi_hint_device_unit(device_t acdev, device_t child,
const char *name, int *unitp);
@@ -210,8 +210,8 @@
DEVMETHOD(bus_adjust_resource, acpi_adjust_resource),
DEVMETHOD(bus_release_resource, acpi_release_resource),
DEVMETHOD(bus_delete_resource, acpi_delete_resource),
- DEVMETHOD(bus_child_pnpinfo_str, acpi_child_pnpinfo_str_method),
- DEVMETHOD(bus_child_location_str, acpi_child_location_str_method),
+ DEVMETHOD(bus_child_pnpinfo, acpi_child_pnpinfo_method),
+ DEVMETHOD(bus_child_location, acpi_child_location_method),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
@@ -865,37 +865,32 @@
/* Location hint for devctl(8) */
static int
-acpi_child_location_str_method(device_t cbdev, device_t child, char *buf,
- size_t buflen)
+acpi_child_location_method(device_t cbdev, device_t child, struct sbuf *sb)
{
struct acpi_device *dinfo = device_get_ivars(child);
- char buf2[32];
int pxm;
if (dinfo->ad_handle) {
- snprintf(buf, buflen, "handle=%s", acpi_name(dinfo->ad_handle));
+ sbuf_printf(sb, "handle=%s", acpi_name(dinfo->ad_handle));
if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ad_handle, "_PXM", &pxm))) {
- snprintf(buf2, 32, " _PXM=%d", pxm);
- strlcat(buf, buf2, buflen);
- }
- } else {
- snprintf(buf, buflen, "");
+ sbuf_printf(sb, " _PXM=%d", pxm);
+ }
}
return (0);
}
/* PnP information for devctl(8) */
int
-acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen)
+acpi_pnpinfo(ACPI_HANDLE handle, struct sbuf *sb)
{
ACPI_DEVICE_INFO *adinfo;
if (ACPI_FAILURE(AcpiGetObjectInfo(handle, &adinfo))) {
- snprintf(buf, buflen, "unknown");
+ sbuf_printf(sb, "unknown");
return (0);
}
- snprintf(buf, buflen, "_HID=%s _UID=%lu _CID=%s",
+ sbuf_printf(sb, "_HID=%s _UID=%lu _CID=%s",
(adinfo->Valid & ACPI_VALID_HID) ?
adinfo->HardwareId.String : "none",
(adinfo->Valid & ACPI_VALID_UID) ?
@@ -909,12 +904,11 @@
}
static int
-acpi_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf,
- size_t buflen)
+acpi_child_pnpinfo_method(device_t cbdev, device_t child, struct sbuf *sb)
{
struct acpi_device *dinfo = device_get_ivars(child);
- return (acpi_pnpinfo_str(dinfo->ad_handle, buf, buflen));
+ return (acpi_pnpinfo(dinfo->ad_handle, sb));
}
/*
Index: sys/dev/acpica/acpi_pci.c
===================================================================
--- sys/dev/acpica/acpi_pci.c
+++ sys/dev/acpica/acpi_pci.c
@@ -38,6 +38,7 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/sbuf.h>
#include <sys/taskqueue.h>
#include <sys/tree.h>
@@ -78,8 +79,8 @@
static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev);
static int acpi_pci_attach(device_t dev);
static void acpi_pci_child_deleted(device_t dev, device_t child);
-static int acpi_pci_child_location_str_method(device_t cbdev,
- device_t child, char *buf, size_t buflen);
+static int acpi_pci_child_location_method(device_t cbdev,
+ device_t child, struct sbuf *sb);
static int acpi_pci_detach(device_t dev);
static int acpi_pci_probe(device_t dev);
static int acpi_pci_read_ivar(device_t dev, device_t child, int which,
@@ -103,7 +104,7 @@
DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar),
DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar),
DEVMETHOD(bus_child_deleted, acpi_pci_child_deleted),
- DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method),
+ DEVMETHOD(bus_child_location, acpi_pci_child_location_method),
DEVMETHOD(bus_get_cpus, acpi_get_cpus),
DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag),
DEVMETHOD(bus_get_domain, acpi_get_domain),
@@ -179,25 +180,20 @@
}
static int
-acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf,
- size_t buflen)
+acpi_pci_child_location_method(device_t cbdev, device_t child, struct sbuf *sb)
{
- struct acpi_pci_devinfo *dinfo = device_get_ivars(child);
- int pxm;
- char buf2[32];
-
- pci_child_location_str_method(cbdev, child, buf, buflen);
+ struct acpi_pci_devinfo *dinfo = device_get_ivars(child);
+ int pxm;
- if (dinfo->ap_handle) {
- strlcat(buf, " handle=", buflen);
- strlcat(buf, acpi_name(dinfo->ap_handle), buflen);
+ pci_child_location_method(cbdev, child, sb);
- if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ap_handle, "_PXM", &pxm))) {
- snprintf(buf2, 32, " _PXM=%d", pxm);
- strlcat(buf, buf2, buflen);
- }
- }
- return (0);
+ if (dinfo->ap_handle) {
+ sbuf_printf(sb, " handle=%s", acpi_name(dinfo->ap_handle));
+ if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ap_handle, "_PXM", &pxm))) {
+ sbuf_printf(sb, " _PXM=%d", pxm);
+ }
+ }
+ return (0);
}
/*
Index: sys/dev/acpica/acpivar.h
===================================================================
--- sys/dev/acpica/acpivar.h
+++ sys/dev/acpica/acpivar.h
@@ -236,8 +236,8 @@
* is compatible with ids parameter of ACPI_ID_PROBE bus method.
*
* XXX: While ACPI_ID_PROBE matches against _HID and all _CIDs, current
- * acpi_pnpinfo_str() exports only _HID and first _CID. That means second
- * and further _CIDs should be added to both acpi_pnpinfo_str() and
+ * acpi_pnpinfo() exports only _HID and first _CID. That means second
+ * and further _CIDs should be added to both acpi_pnpinfo() and
* ACPICOMPAT_PNP_INFO if device matching against them is required.
*/
#define ACPICOMPAT_PNP_INFO(t, busname) \
@@ -490,7 +490,7 @@
int sleep_result, int intr_enabled);
int acpi_table_quirks(int *quirks);
int acpi_machdep_quirks(int *quirks);
-int acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen);
+int acpi_pnpinfo(ACPI_HANDLE handle, struct sbuf *sb);
uint32_t hpet_get_uid(device_t dev);
Index: sys/dev/ahci/ahci.h
===================================================================
--- sys/dev/ahci/ahci.h
+++ sys/dev/ahci/ahci.h
@@ -663,8 +663,7 @@
void *argument, void **cookiep);
int ahci_teardown_intr(device_t dev, device_t child, struct resource *irq,
void *cookie);
-int ahci_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen);
+int ahci_child_location(device_t dev, device_t child, struct sbuf *sb);
bus_dma_tag_t ahci_get_dma_tag(device_t dev, device_t child);
int ahci_ctlr_reset(device_t dev);
int ahci_ctlr_setup(device_t dev);
Index: sys/dev/ahci/ahci.c
===================================================================
--- sys/dev/ahci/ahci.c
+++ sys/dev/ahci/ahci.c
@@ -39,6 +39,7 @@
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <machine/stdarg.h>
#include <machine/resource.h>
@@ -697,14 +698,13 @@
}
int
-ahci_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+ahci_child_location(device_t dev, device_t child, struct sbuf *sb)
{
intptr_t ivars;
ivars = (intptr_t)device_get_ivars(child);
if ((ivars & AHCI_EM_UNIT) == 0)
- snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT);
+ sbuf_printf(sb, "channel=%d", (int)ivars & AHCI_UNIT);
return (0);
}
Index: sys/dev/ahci/ahci_fsl_fdt.c
===================================================================
--- sys/dev/ahci/ahci_fsl_fdt.c
+++ sys/dev/ahci/ahci_fsl_fdt.c
@@ -406,7 +406,7 @@
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
DEVMETHOD(bus_print_child, ahci_print_child),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
DEVMETHOD_END
};
Index: sys/dev/ahci/ahci_generic.c
===================================================================
--- sys/dev/ahci/ahci_generic.c
+++ sys/dev/ahci/ahci_generic.c
@@ -182,7 +182,7 @@
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
DEVMETHOD_END
};
@@ -206,7 +206,7 @@
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
DEVMETHOD_END
};
Index: sys/dev/ahci/ahci_mv_fdt.c
===================================================================
--- sys/dev/ahci/ahci_mv_fdt.c
+++ sys/dev/ahci/ahci_mv_fdt.c
@@ -140,7 +140,7 @@
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr, ahci_teardown_intr),
DEVMETHOD(bus_print_child, ahci_print_child),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
DEVMETHOD_END
};
Index: sys/dev/ahci/ahci_pci.c
===================================================================
--- sys/dev/ahci/ahci_pci.c
+++ sys/dev/ahci/ahci_pci.c
@@ -740,7 +740,7 @@
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag),
DEVMETHOD_END
};
@@ -764,7 +764,7 @@
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
- DEVMETHOD(bus_child_location_str, ahci_child_location_str),
+ DEVMETHOD(bus_child_location, ahci_child_location),
DEVMETHOD_END
};
static driver_t ahci_ata_driver = {
Index: sys/dev/ata/ata-pci.h
===================================================================
--- sys/dev/ata/ata-pci.h
+++ sys/dev/ata/ata-pci.h
@@ -535,8 +535,7 @@
void ata_pci_write_config(device_t dev, device_t child, int reg,
uint32_t val, int width);
int ata_pci_print_child(device_t dev, device_t child);
-int ata_pci_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen);
+int ata_pci_child_location(device_t dev, device_t child, struct sbuf *sb);
struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags);
int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r);
int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep);
@@ -586,7 +585,7 @@
DEVMETHOD(pci_read_config, ata_pci_read_config), \
DEVMETHOD(pci_write_config, ata_pci_write_config), \
DEVMETHOD(bus_print_child, ata_pci_print_child), \
- DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \
+ DEVMETHOD(bus_child_location, ata_pci_child_location), \
DEVMETHOD_END \
}; \
static driver_t __CONCAT(dname,_driver) = { \
Index: sys/dev/ata/ata-pci.c
===================================================================
--- sys/dev/ata/ata-pci.c
+++ sys/dev/ata/ata-pci.c
@@ -37,6 +37,7 @@
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/malloc.h>
+#include <sys/sbuf.h>
#include <sys/sema.h>
#include <sys/taskqueue.h>
#include <vm/uma.h>
@@ -558,11 +559,10 @@
}
int
-ata_pci_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+ata_pci_child_location(device_t dev, device_t child, struct sbuf *sb)
{
- snprintf(buf, buflen, "channel=%d",
+ sbuf_printf(sb, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
@@ -595,7 +595,7 @@
DEVMETHOD(pci_read_config, ata_pci_read_config),
DEVMETHOD(pci_write_config, ata_pci_write_config),
DEVMETHOD(bus_print_child, ata_pci_print_child),
- DEVMETHOD(bus_child_location_str, ata_pci_child_location_str),
+ DEVMETHOD(bus_child_location, ata_pci_child_location),
DEVMETHOD(bus_get_dma_tag, ata_pci_get_dma_tag),
DEVMETHOD_END
Index: sys/dev/ata/chipsets/ata-fsl.c
===================================================================
--- sys/dev/ata/chipsets/ata-fsl.c
+++ sys/dev/ata/chipsets/ata-fsl.c
@@ -227,7 +227,7 @@
DEVMETHOD(pci_read_config, ata_pci_read_config),
DEVMETHOD(pci_write_config, ata_pci_write_config),
DEVMETHOD(bus_print_child, ata_pci_print_child),
- DEVMETHOD(bus_child_location_str, ata_pci_child_location_str),
+ DEVMETHOD(bus_child_location, ata_pci_child_location),
DEVMETHOD_END
};
static driver_t imx_ata_driver = {
Index: sys/dev/bhnd/bhnd.c
===================================================================
--- sys/dev/bhnd/bhnd.c
+++ sys/dev/bhnd/bhnd.c
@@ -58,6 +58,7 @@
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
+#include <sys/sbuf.h>
#include <sys/systm.h>
#include <machine/bus.h>
@@ -905,18 +906,15 @@
}
/**
- * Default implementation of BUS_CHILD_PNPINFO_STR().
+ * Default implementation of BUS_CHILD_PNPINFO().
*/
static int
-bhnd_child_pnpinfo_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+bhnd_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
{
- if (device_get_parent(child) != dev) {
- return (BUS_CHILD_PNPINFO_STR(device_get_parent(dev), child,
- buf, buflen));
- }
+ if (device_get_parent(child) != dev)
+ return (BUS_CHILD_PNPINFO(device_get_parent(dev), child, sb));
- snprintf(buf, buflen, "vendor=0x%hx device=0x%hx rev=0x%hhx",
+ sbuf_printf(sb, "vendor=0x%hx device=0x%hx rev=0x%hhx",
bhnd_get_vendor(child), bhnd_get_device(child),
bhnd_get_hwrev(child));
@@ -924,28 +922,21 @@
}
/**
- * Default implementation of BUS_CHILD_LOCATION_STR().
+ * Default implementation of BUS_CHILD_LOCATION().
*/
static int
-bhnd_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+bhnd_child_location(device_t dev, device_t child, struct sbuf *sb)
{
bhnd_addr_t addr;
bhnd_size_t size;
- if (device_get_parent(child) != dev) {
- return (BUS_CHILD_LOCATION_STR(device_get_parent(dev), child,
- buf, buflen));
- }
+ if (device_get_parent(child) != dev)
+ return (BUS_CHILD_LOCATION(device_get_parent(dev), child, sb));
- if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size)) {
- /* No device default port/region */
- if (buflen > 0)
- *buf = '\0';
+ if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size))
return (0);
- }
- snprintf(buf, buflen, "port0.0=0x%llx", (unsigned long long) addr);
+ sbuf_printf(sb, "port0.0=0x%llx", (unsigned long long) addr);
return (0);
}
@@ -1109,8 +1100,8 @@
DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted),
DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch),
DEVMETHOD(bus_print_child, bhnd_generic_print_child),
- DEVMETHOD(bus_child_pnpinfo_str, bhnd_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, bhnd_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, bhnd_child_pnpinfo),
+ DEVMETHOD(bus_child_location, bhnd_child_location),
DEVMETHOD(bus_suspend_child, bhnd_generic_suspend_child),
DEVMETHOD(bus_resume_child, bhnd_generic_resume_child),
Index: sys/dev/bhnd/bhndb/bhndb.c
===================================================================
--- sys/dev/bhnd/bhndb/bhndb.c
+++ sys/dev/bhnd/bhndb/bhndb.c
@@ -45,6 +45,7 @@
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
+#include <sys/sbuf.h>
#include <sys/systm.h>
#include <machine/bus.h>
@@ -168,22 +169,13 @@
}
static int
-bhndb_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
-{
- *buf = '\0';
- return (0);
-}
-
-static int
-bhndb_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+bhndb_child_location(device_t dev, device_t child, struct sbuf *sb)
{
struct bhndb_softc *sc;
sc = device_get_softc(dev);
- snprintf(buf, buflen, "base=0x%llx",
+ sbuf_printf(sb, "base=0x%llx",
(unsigned long long) sc->chipid.enum_addr);
return (0);
}
@@ -2215,8 +2207,7 @@
/* Bus interface */
DEVMETHOD(bus_probe_nomatch, bhndb_probe_nomatch),
DEVMETHOD(bus_print_child, bhndb_print_child),
- DEVMETHOD(bus_child_pnpinfo_str, bhndb_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, bhndb_child_location_str),
+ DEVMETHOD(bus_child_location, bhndb_child_location),
DEVMETHOD(bus_add_child, bhndb_add_child),
DEVMETHOD(bus_child_deleted, bhndb_child_deleted),
Index: sys/dev/bhnd/cores/chipc/chipc.c
===================================================================
--- sys/dev/bhnd/cores/chipc/chipc.c
+++ sys/dev/bhnd/cores/chipc/chipc.c
@@ -596,28 +596,6 @@
return (retval);
}
-static int
-chipc_child_pnpinfo_str(device_t dev, device_t child, char *buf,
- size_t buflen)
-{
- if (buflen == 0)
- return (EOVERFLOW);
-
- *buf = '\0';
- return (0);
-}
-
-static int
-chipc_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
-{
- if (buflen == 0)
- return (EOVERFLOW);
-
- *buf = '\0';
- return (ENXIO);
-}
-
static device_t
chipc_add_child(device_t dev, u_int order, const char *name, int unit)
{
@@ -1412,8 +1390,6 @@
/* Bus interface */
DEVMETHOD(bus_probe_nomatch, chipc_probe_nomatch),
DEVMETHOD(bus_print_child, chipc_print_child),
- DEVMETHOD(bus_child_pnpinfo_str, chipc_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, chipc_child_location_str),
DEVMETHOD(bus_add_child, chipc_add_child),
DEVMETHOD(bus_child_deleted, chipc_child_deleted),
Index: sys/dev/cxgbe/t4_main.c
===================================================================
--- sys/dev/cxgbe/t4_main.c
+++ sys/dev/cxgbe/t4_main.c
@@ -97,7 +97,7 @@
static int t4_probe(device_t);
static int t4_attach(device_t);
static int t4_detach(device_t);
-static int t4_child_location_str(device_t, device_t, char *, size_t);
+static int t4_child_location(device_t, device_t, struct sbuf *);
static int t4_ready(device_t);
static int t4_read_port_device(device_t, int, device_t *);
static device_method_t t4_methods[] = {
@@ -105,7 +105,7 @@
DEVMETHOD(device_attach, t4_attach),
DEVMETHOD(device_detach, t4_detach),
- DEVMETHOD(bus_child_location_str, t4_child_location_str),
+ DEVMETHOD(bus_child_location, t4_child_location),
DEVMETHOD(t4_is_main_ready, t4_ready),
DEVMETHOD(t4_read_port_device, t4_read_port_device),
@@ -166,7 +166,7 @@
DEVMETHOD(device_attach, t4_attach),
DEVMETHOD(device_detach, t4_detach),
- DEVMETHOD(bus_child_location_str, t4_child_location_str),
+ DEVMETHOD(bus_child_location, t4_child_location),
DEVMETHOD(t4_is_main_ready, t4_ready),
DEVMETHOD(t4_read_port_device, t4_read_port_device),
@@ -201,7 +201,7 @@
DEVMETHOD(device_attach, t4_attach),
DEVMETHOD(device_detach, t4_detach),
- DEVMETHOD(bus_child_location_str, t4_child_location_str),
+ DEVMETHOD(bus_child_location, t4_child_location),
DEVMETHOD(t4_is_main_ready, t4_ready),
DEVMETHOD(t4_read_port_device, t4_read_port_device),
@@ -1529,18 +1529,17 @@
}
static int
-t4_child_location_str(device_t bus, device_t dev, char *buf, size_t buflen)
+t4_child_location(device_t bus, device_t dev, struct sbuf *sb)
{
struct adapter *sc;
struct port_info *pi;
int i;
sc = device_get_softc(bus);
- buf[0] = '\0';
for_each_port(sc, i) {
pi = sc->port[i];
if (pi != NULL && pi->dev == dev) {
- snprintf(buf, buflen, "port=%d", pi->port_id);
+ sbuf_printf(sb, "port=%d", pi->port_id);
break;
}
}
Index: sys/dev/fdt/simplebus.c
===================================================================
--- sys/dev/fdt/simplebus.c
+++ sys/dev/fdt/simplebus.c
@@ -87,7 +87,7 @@
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(bus_get_resource_list, simplebus_get_resource_list),
/* ofw_bus interface */
Index: sys/dev/gpio/gpiobus.c
===================================================================
--- sys/dev/gpio/gpiobus.c
+++ sys/dev/gpio/gpiobus.c
@@ -39,6 +39,7 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/sbuf.h>
#include <dev/gpio/gpiobusvar.h>
@@ -51,7 +52,7 @@
#define dprintf(x, arg...)
#endif
-static void gpiobus_print_pins(struct gpiobus_ivar *, char *, size_t);
+static void gpiobus_print_pins(struct gpiobus_ivar *, struct sbuf *);
static int gpiobus_parse_pins(struct gpiobus_softc *, device_t, int);
static int gpiobus_probe(device_t);
static int gpiobus_attach(device_t);
@@ -60,8 +61,7 @@
static int gpiobus_resume(device_t);
static void gpiobus_probe_nomatch(device_t, device_t);
static int gpiobus_print_child(device_t, device_t);
-static int gpiobus_child_location_str(device_t, device_t, char *, size_t);
-static int gpiobus_child_pnpinfo_str(device_t, device_t, char *, size_t);
+static int gpiobus_child_location(device_t, device_t, struct sbuf *);
static device_t gpiobus_add_child(device_t, u_int, const char *, int);
static void gpiobus_hinted_child(device_t, const char *, int);
@@ -265,9 +265,8 @@
}
static void
-gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen)
+gpiobus_print_pins(struct gpiobus_ivar *devi, struct sbuf *sb)
{
- char tmp[128];
int i, range_start, range_stop, need_coma;
if (devi->npins == 0)
@@ -278,16 +277,11 @@
for (i = 1; i < devi->npins; i++) {
if (devi->pins[i] != (range_stop + 1)) {
if (need_coma)
- strlcat(buf, ",", buflen);
- memset(tmp, 0, sizeof(tmp));
+ sbuf_cat(sb, ",");
if (range_start != range_stop)
- snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
- range_start, range_stop);
+ sbuf_printf(sb, "%d-%d", range_start, range_stop);
else
- snprintf(tmp, sizeof(tmp) - 1, "%d",
- range_start);
- strlcat(buf, tmp, buflen);
-
+ sbuf_printf(sb, "%d", range_start);
range_start = range_stop = devi->pins[i];
need_coma = 1;
}
@@ -296,15 +290,11 @@
}
if (need_coma)
- strlcat(buf, ",", buflen);
- memset(tmp, 0, sizeof(tmp));
+ sbuf_cat(sb, ",");
if (range_start != range_stop)
- snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
- range_start, range_stop);
+ sbuf_printf(sb, "%d-%d", range_start, range_stop);
else
- snprintf(tmp, sizeof(tmp) - 1, "%d",
- range_start);
- strlcat(buf, tmp, buflen);
+ sbuf_printf(sb, "%d", range_start);
}
device_t
@@ -643,15 +633,15 @@
gpiobus_probe_nomatch(device_t dev, device_t child)
{
char pins[128];
+ struct sbuf sb;
struct gpiobus_ivar *devi;
devi = GPIOBUS_IVAR(child);
- memset(pins, 0, sizeof(pins));
- gpiobus_print_pins(devi, pins, sizeof(pins));
- if (devi->npins > 1)
- device_printf(dev, "<unknown device> at pins %s", pins);
- else
- device_printf(dev, "<unknown device> at pin %s", pins);
+ sbuf_new(&sb, pins, sizeof(pins), SBUF_FIXEDLEN);
+ gpiobus_print_pins(devi, &sb);
+ sbuf_finish(&sb);
+ device_printf(dev, "<unknown device> at pin%s %s",
+ devi->npins > 1 ? "s" : "", sbuf_data(&sb));
resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%jd");
printf("\n");
}
@@ -660,19 +650,21 @@
gpiobus_print_child(device_t dev, device_t child)
{
char pins[128];
+ struct sbuf sb;
int retval = 0;
struct gpiobus_ivar *devi;
devi = GPIOBUS_IVAR(child);
- memset(pins, 0, sizeof(pins));
retval += bus_print_child_header(dev, child);
if (devi->npins > 0) {
if (devi->npins > 1)
retval += printf(" at pins ");
else
retval += printf(" at pin ");
- gpiobus_print_pins(devi, pins, sizeof(pins));
- retval += printf("%s", pins);
+ sbuf_new(&sb, pins, sizeof(pins), SBUF_FIXEDLEN);
+ gpiobus_print_pins(devi, &sb);
+ sbuf_finish(&sb);
+ retval += printf("%s", sbuf_data(&sb));
}
resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%jd");
retval += bus_print_child_footer(dev, child);
@@ -681,27 +673,14 @@
}
static int
-gpiobus_child_location_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+gpiobus_child_location(device_t bus, device_t child, struct sbuf *sb)
{
struct gpiobus_ivar *devi;
devi = GPIOBUS_IVAR(child);
- if (devi->npins > 1)
- strlcpy(buf, "pins=", buflen);
- else
- strlcpy(buf, "pin=", buflen);
- gpiobus_print_pins(devi, buf, buflen);
-
- return (0);
-}
-
-static int
-gpiobus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
-{
+ sbuf_printf(sb, "pins=");
+ gpiobus_print_pins(devi, sb);
- *buf = '\0';
return (0);
}
@@ -1108,8 +1087,7 @@
DEVMETHOD(bus_rescan, gpiobus_rescan),
DEVMETHOD(bus_probe_nomatch, gpiobus_probe_nomatch),
DEVMETHOD(bus_print_child, gpiobus_print_child),
- DEVMETHOD(bus_child_pnpinfo_str, gpiobus_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, gpiobus_child_location_str),
+ DEVMETHOD(bus_child_location, gpiobus_child_location),
DEVMETHOD(bus_hinted_child, gpiobus_hinted_child),
DEVMETHOD(bus_read_ivar, gpiobus_read_ivar),
DEVMETHOD(bus_write_ivar, gpiobus_write_ivar),
Index: sys/dev/gpio/ofw_gpiobus.c
===================================================================
--- sys/dev/gpio/ofw_gpiobus.c
+++ sys/dev/gpio/ofw_gpiobus.c
@@ -493,7 +493,7 @@
DEVMETHOD(device_attach, ofw_gpiobus_attach),
/* Bus interface */
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(bus_add_child, ofw_gpiobus_add_child),
/* ofw_bus interface */
Index: sys/dev/hid/hidbus.c
===================================================================
--- sys/dev/hid/hidbus.c
+++ sys/dev/hid/hidbus.c
@@ -40,8 +40,9 @@
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/proc.h>
-#include <sys/systm.h>
+#include <sys/sbuf.h>
#include <sys/sx.h>
+#include <sys/systm.h>
#define HID_DEBUG_VAR hid_debug
#include <dev/hid/hid.h>
@@ -473,24 +474,22 @@
/* Location hint for devctl(8) */
static int
-hidbus_child_location_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+hidbus_child_location(device_t bus, device_t child, struct sbuf *sb)
{
struct hidbus_ivars *tlc = device_get_ivars(child);
- snprintf(buf, buflen, "index=%hhu", tlc->index);
+ sbuf_printf(sb, "index=%hhu", tlc->index);
return (0);
}
/* PnP information for devctl(8) */
static int
-hidbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+hidbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
{
struct hidbus_ivars *tlc = device_get_ivars(child);
struct hid_device_info *devinfo = device_get_ivars(bus);
- snprintf(buf, buflen, "page=0x%04x usage=0x%04x bus=0x%02hx "
+ sbuf_printf(sb, "page=0x%04x usage=0x%04x bus=0x%02hx "
"vendor=0x%04hx product=0x%04hx version=0x%04hx%s%s",
HID_GET_USAGE_PAGE(tlc->usage), HID_GET_USAGE(tlc->usage),
devinfo->idBus, devinfo->idVendor, devinfo->idProduct,
@@ -879,8 +878,8 @@
DEVMETHOD(bus_child_deleted, hidbus_child_deleted),
DEVMETHOD(bus_read_ivar, hidbus_read_ivar),
DEVMETHOD(bus_write_ivar, hidbus_write_ivar),
- DEVMETHOD(bus_child_pnpinfo_str,hidbus_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str,hidbus_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, hidbus_child_pnpinfo),
+ DEVMETHOD(bus_child_location, hidbus_child_location),
/* hid interface */
DEVMETHOD(hid_get_rdesc, hid_get_rdesc),
Index: sys/dev/hyperv/vmbus/vmbus.c
===================================================================
--- sys/dev/hyperv/vmbus/vmbus.c
+++ sys/dev/hyperv/vmbus/vmbus.c
@@ -40,6 +40,7 @@
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
+#include <sys/sbuf.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -80,8 +81,7 @@
static int vmbus_detach(device_t);
static int vmbus_read_ivar(device_t, device_t, int,
uintptr_t *);
-static int vmbus_child_pnpinfo_str(device_t, device_t,
- char *, size_t);
+static int vmbus_child_pnpinfo(device_t, device_t, struct sbuf *);
static struct resource *vmbus_alloc_resource(device_t dev,
device_t child, int type, int *rid,
rman_res_t start, rman_res_t end,
@@ -170,7 +170,7 @@
DEVMETHOD(bus_add_child, bus_generic_add_child),
DEVMETHOD(bus_print_child, bus_generic_print_child),
DEVMETHOD(bus_read_ivar, vmbus_read_ivar),
- DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, vmbus_child_pnpinfo),
DEVMETHOD(bus_alloc_resource, vmbus_alloc_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
@@ -1028,7 +1028,7 @@
}
static int
-vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen)
+vmbus_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
{
const struct vmbus_channel *chan;
char guidbuf[HYPERV_GUID_STRLEN];
@@ -1039,13 +1039,11 @@
return (0);
}
- strlcat(buf, "classid=", buflen);
hyperv_guid2str(&chan->ch_guid_type, guidbuf, sizeof(guidbuf));
- strlcat(buf, guidbuf, buflen);
+ sbuf_printf(sb, "classid=%s", guidbuf);
- strlcat(buf, " deviceid=", buflen);
hyperv_guid2str(&chan->ch_guid_inst, guidbuf, sizeof(guidbuf));
- strlcat(buf, guidbuf, buflen);
+ sbuf_printf(sb, " deviceid=%s", guidbuf);
return (0);
}
Index: sys/dev/iicbus/acpi_iicbus.c
===================================================================
--- sys/dev/iicbus/acpi_iicbus.c
+++ sys/dev/iicbus/acpi_iicbus.c
@@ -35,6 +35,7 @@
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/rman.h>
+#include <sys/sbuf.h>
#include <machine/resource.h>
@@ -709,54 +710,39 @@
/* Location hint for devctl(8). Concatenate IIC and ACPI hints. */
static int
-acpi_iicbus_child_location_str(device_t bus, device_t child,
- char *buf, size_t buflen)
+acpi_iicbus_child_location(device_t bus, device_t child, struct sbuf *sb)
{
struct acpi_iicbus_ivars *devi = device_get_ivars(child);
int error;
/* read IIC location hint string into the buffer. */
- error = iicbus_child_location_str(bus, child, buf, buflen);
+ error = iicbus_child_location(bus, child, sb);
if (error != 0)
return (error);
/* Place ACPI string right after IIC one's terminating NUL. */
- if (devi->handle != NULL &&
- ((buf[0] != '\0' && strlcat(buf, " ", buflen) >= buflen) ||
- strlcat(buf, "handle=", buflen) >= buflen ||
- strlcat(buf, acpi_name(devi->handle), buflen) >= buflen))
- return (EOVERFLOW);
+ if (devi->handle != NULL)
+ sbuf_printf(sb, " handle=%s", acpi_name(devi->handle));
return (0);
}
/* PnP information for devctl(8). Concatenate IIC and ACPI info strings. */
static int
-acpi_iicbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+acpi_iicbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
{
struct acpi_iicbus_ivars *devi = device_get_ivars(child);
- size_t acpi_offset;
int error;
/* read IIC PnP string into the buffer. */
- error = iicbus_child_pnpinfo_str(bus, child, buf, buflen);
+ error = iicbus_child_pnpinfo(bus, child, sb);
if (error != 0)
return (error);
if (devi->handle == NULL)
return (0);
- /* Place ACPI string right after IIC one's terminating NUL. */
- acpi_offset = strlen(buf);
- if (acpi_offset != 0)
- acpi_offset++;
- error = acpi_pnpinfo_str(devi->handle, buf + acpi_offset,
- buflen - acpi_offset);
-
- /* Coalesce both strings if they are not empty. */
- if (acpi_offset > 0 && acpi_offset < buflen && buf[acpi_offset] != 0)
- buf[acpi_offset - 1] = ' ';
+ error = acpi_pnpinfo(devi->handle, sb);
return (error);
}
@@ -776,8 +762,8 @@
DEVMETHOD(bus_child_deleted, acpi_iicbus_child_deleted),
DEVMETHOD(bus_read_ivar, acpi_iicbus_read_ivar),
DEVMETHOD(bus_write_ivar, acpi_iicbus_write_ivar),
- DEVMETHOD(bus_child_location_str,acpi_iicbus_child_location_str),
- DEVMETHOD(bus_child_pnpinfo_str,acpi_iicbus_child_pnpinfo_str),
+ DEVMETHOD(bus_child_location, acpi_iicbus_child_location),
+ DEVMETHOD(bus_child_pnpinfo, acpi_iicbus_child_pnpinfo),
DEVMETHOD_END,
};
Index: sys/dev/iicbus/iicbus.h
===================================================================
--- sys/dev/iicbus/iicbus.h
+++ sys/dev/iicbus/iicbus.h
@@ -95,10 +95,8 @@
uintptr_t *result);
int iicbus_write_ivar(device_t bus, device_t child, int which,
uintptr_t value);
-int iicbus_child_location_str(device_t bus, device_t child, char *buf,
- size_t buflen);
-int iicbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen);
+int iicbus_child_location(device_t bus, device_t child, struct sbuf *sb);
+int iicbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb);
extern driver_t iicbus_driver;
extern devclass_t iicbus_devclass;
Index: sys/dev/iicbus/iicbus.c
===================================================================
--- sys/dev/iicbus/iicbus.c
+++ sys/dev/iicbus/iicbus.c
@@ -36,13 +36,14 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/rman.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
-#include <sys/bus.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
@@ -176,20 +177,17 @@
}
int
-iicbus_child_location_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+iicbus_child_location(device_t bus, device_t child, struct sbuf *sb)
{
struct iicbus_ivar *devi = IICBUS_IVAR(child);
- snprintf(buf, buflen, "addr=%#x", devi->addr);
+ sbuf_printf(sb, "addr=%#x", devi->addr);
return (0);
}
int
-iicbus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+iicbus_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
{
- *buf = '\0';
return (0);
}
@@ -368,8 +366,8 @@
DEVMETHOD(bus_probe_nomatch, iicbus_probe_nomatch),
DEVMETHOD(bus_read_ivar, iicbus_read_ivar),
DEVMETHOD(bus_write_ivar, iicbus_write_ivar),
- DEVMETHOD(bus_child_pnpinfo_str, iicbus_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, iicbus_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, iicbus_child_pnpinfo),
+ DEVMETHOD(bus_child_location, iicbus_child_location),
DEVMETHOD(bus_hinted_child, iicbus_hinted_child),
/* iicbus interface */
Index: sys/dev/iicbus/ofw_iicbus.c
===================================================================
--- sys/dev/iicbus/ofw_iicbus.c
+++ sys/dev/iicbus/ofw_iicbus.c
@@ -57,7 +57,7 @@
DEVMETHOD(device_attach, ofw_iicbus_attach),
/* Bus interface */
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(bus_add_child, ofw_iicbus_add_child),
/* ofw_bus interface */
Index: sys/dev/mii/mii.c
===================================================================
--- sys/dev/mii/mii.c
+++ sys/dev/mii/mii.c
@@ -47,6 +47,7 @@
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/bus.h>
+#include <sys/sbuf.h>
#include <net/if.h>
#include <net/if_var.h>
@@ -61,8 +62,8 @@
static device_attach_t miibus_attach;
static bus_child_detached_t miibus_child_detached;
-static bus_child_location_str_t miibus_child_location_str;
-static bus_child_pnpinfo_str_t miibus_child_pnpinfo_str;
+static bus_child_location_t miibus_child_location;
+static bus_child_pnpinfo_t miibus_child_pnpinfo;
static device_detach_t miibus_detach;
static bus_hinted_child_t miibus_hinted_child;
static bus_print_child_t miibus_print_child;
@@ -87,8 +88,8 @@
DEVMETHOD(bus_print_child, miibus_print_child),
DEVMETHOD(bus_read_ivar, miibus_read_ivar),
DEVMETHOD(bus_child_detached, miibus_child_detached),
- DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, miibus_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, miibus_child_pnpinfo),
+ DEVMETHOD(bus_child_location, miibus_child_location),
DEVMETHOD(bus_hinted_child, miibus_hinted_child),
/* MII interface */
@@ -219,26 +220,24 @@
}
static int
-miibus_child_pnpinfo_str(device_t dev __unused, device_t child, char *buf,
- size_t buflen)
+miibus_child_pnpinfo(device_t dev __unused, device_t child, struct sbuf *sb)
{
struct mii_attach_args *ma;
ma = device_get_ivars(child);
- snprintf(buf, buflen, "oui=0x%x model=0x%x rev=0x%x",
+ sbuf_printf(sb, "oui=0x%x model=0x%x rev=0x%x",
MII_OUI(ma->mii_id1, ma->mii_id2),
MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
return (0);
}
static int
-miibus_child_location_str(device_t dev __unused, device_t child, char *buf,
- size_t buflen)
+miibus_child_location(device_t dev __unused, device_t child, struct sbuf *sb)
{
struct mii_attach_args *ma;
ma = device_get_ivars(child);
- snprintf(buf, buflen, "phyno=%d", ma->mii_phyno);
+ sbuf_printf(sb, "phyno=%d", ma->mii_phyno);
return (0);
}
Index: sys/dev/mmc/mmc.c
===================================================================
--- sys/dev/mmc/mmc.c
+++ sys/dev/mmc/mmc.c
@@ -65,6 +65,7 @@
#include <sys/mutex.h>
#include <sys/bus.h>
#include <sys/endian.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/time.h>
@@ -143,8 +144,7 @@
/* bus entry points */
static int mmc_acquire_bus(device_t busdev, device_t dev);
static int mmc_attach(device_t dev);
-static int mmc_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen);
+static int mmc_child_location(device_t dev, device_t child, struct sbuf *sb);
static int mmc_detach(device_t dev);
static int mmc_probe(device_t dev);
static int mmc_read_ivar(device_t bus, device_t child, int which,
@@ -2541,11 +2541,10 @@
}
static int
-mmc_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+mmc_child_location(device_t dev, device_t child, struct sbuf *sb)
{
- snprintf(buf, buflen, "rca=0x%04x", mmc_get_rca(child));
+ sbuf_printf(sb, "rca=0x%04x", mmc_get_rca(child));
return (0);
}
@@ -2560,7 +2559,7 @@
/* Bus interface */
DEVMETHOD(bus_read_ivar, mmc_read_ivar),
DEVMETHOD(bus_write_ivar, mmc_write_ivar),
- DEVMETHOD(bus_child_location_str, mmc_child_location_str),
+ DEVMETHOD(bus_child_location, mmc_child_location),
/* MMC Bus interface */
DEVMETHOD(mmcbus_retune_pause, mmc_retune_pause),
Index: sys/dev/mvs/mvs_pci.c
===================================================================
--- sys/dev/mvs/mvs_pci.c
+++ sys/dev/mvs/mvs_pci.c
@@ -38,6 +38,7 @@
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/sbuf.h>
#include <vm/uma.h>
#include <machine/stdarg.h>
#include <machine/resource.h>
@@ -483,11 +484,10 @@
}
static int
-mvs_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+mvs_child_location(device_t dev, device_t child, struct sbuf *sb)
{
- snprintf(buf, buflen, "channel=%d",
+ sbuf_printf(sb, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
@@ -510,7 +510,7 @@
DEVMETHOD(bus_release_resource, mvs_release_resource),
DEVMETHOD(bus_setup_intr, mvs_setup_intr),
DEVMETHOD(bus_teardown_intr,mvs_teardown_intr),
- DEVMETHOD(bus_child_location_str, mvs_child_location_str),
+ DEVMETHOD(bus_child_location, mvs_child_location),
DEVMETHOD(bus_get_dma_tag, mvs_get_dma_tag),
DEVMETHOD(mvs_edma, mvs_edma),
{ 0, 0 }
Index: sys/dev/mvs/mvs_soc.c
===================================================================
--- sys/dev/mvs/mvs_soc.c
+++ sys/dev/mvs/mvs_soc.c
@@ -43,6 +43,7 @@
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <sys/sbuf.h>
#include <arm/mv/mvreg.h>
#include <arm/mv/mvvar.h>
#include <dev/ofw/ofw_bus.h>
@@ -429,12 +430,10 @@
}
static int
-mvs_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+mvs_child_location(device_t dev, device_t child, struct sbuf *sb)
{
- snprintf(buf, buflen, "channel=%d",
- (int)(intptr_t)device_get_ivars(child));
+ sbuf_printf(sb, "channel=%d", (int)(intptr_t)device_get_ivars(child));
return (0);
}
@@ -456,7 +455,7 @@
DEVMETHOD(bus_release_resource, mvs_release_resource),
DEVMETHOD(bus_setup_intr, mvs_setup_intr),
DEVMETHOD(bus_teardown_intr,mvs_teardown_intr),
- DEVMETHOD(bus_child_location_str, mvs_child_location_str),
+ DEVMETHOD(bus_child_location, mvs_child_location),
DEVMETHOD(bus_get_dma_tag, mvs_get_dma_tag),
DEVMETHOD(mvs_edma, mvs_edma),
{ 0, 0 }
Index: sys/dev/ntb/ntb.h
===================================================================
--- sys/dev/ntb/ntb.h
+++ sys/dev/ntb/ntb.h
@@ -36,8 +36,7 @@
int ntb_register_device(device_t ntb);
int ntb_unregister_device(device_t ntb);
-int ntb_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen);
+int ntb_child_location(device_t dev, device_t child, struct sbuf *sb);
int ntb_print_child(device_t dev, device_t child);
bus_dma_tag_t ntb_get_dma_tag(device_t bus, device_t child);
Index: sys/dev/ntb/ntb.c
===================================================================
--- sys/dev/ntb/ntb.c
+++ sys/dev/ntb/ntb.c
@@ -34,6 +34,7 @@
#include <sys/rmlock.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include "ntb.h"
@@ -168,12 +169,11 @@
}
int
-ntb_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+ntb_child_location(device_t dev, device_t child, struct sbuf *sb)
{
struct ntb_child *nc = device_get_ivars(child);
- snprintf(buf, buflen, "function=%d", nc->function);
+ sbuf_printf(sb, "function=%d", nc->function);
return (0);
}
Index: sys/dev/ntb/ntb_hw/ntb_hw_amd.c
===================================================================
--- sys/dev/ntb/ntb_hw/ntb_hw_amd.c
+++ sys/dev/ntb/ntb_hw/ntb_hw_amd.c
@@ -1274,7 +1274,7 @@
DEVMETHOD(device_detach, amd_ntb_detach),
/* Bus interface */
- DEVMETHOD(bus_child_location_str, ntb_child_location_str),
+ DEVMETHOD(bus_child_location, ntb_child_location),
DEVMETHOD(bus_print_child, ntb_print_child),
DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag),
Index: sys/dev/ntb/ntb_hw/ntb_hw_intel.c
===================================================================
--- sys/dev/ntb/ntb_hw/ntb_hw_intel.c
+++ sys/dev/ntb/ntb_hw/ntb_hw_intel.c
@@ -3476,7 +3476,7 @@
DEVMETHOD(device_attach, intel_ntb_attach),
DEVMETHOD(device_detach, intel_ntb_detach),
/* Bus interface */
- DEVMETHOD(bus_child_location_str, ntb_child_location_str),
+ DEVMETHOD(bus_child_location, ntb_child_location),
DEVMETHOD(bus_print_child, ntb_print_child),
DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag),
/* NTB interface */
Index: sys/dev/ntb/ntb_hw/ntb_hw_plx.c
===================================================================
--- sys/dev/ntb/ntb_hw/ntb_hw_plx.c
+++ sys/dev/ntb/ntb_hw/ntb_hw_plx.c
@@ -1053,7 +1053,7 @@
DEVMETHOD(device_attach, ntb_plx_attach),
DEVMETHOD(device_detach, ntb_plx_detach),
/* Bus interface */
- DEVMETHOD(bus_child_location_str, ntb_child_location_str),
+ DEVMETHOD(bus_child_location, ntb_child_location),
DEVMETHOD(bus_print_child, ntb_print_child),
DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag),
/* NTB interface */
Index: sys/dev/ntb/ntb_transport.c
===================================================================
--- sys/dev/ntb/ntb_transport.c
+++ sys/dev/ntb/ntb_transport.c
@@ -52,6 +52,7 @@
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/queue.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
@@ -576,12 +577,11 @@
}
static int
-ntb_transport_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+ntb_transport_child_location(device_t dev, device_t child, struct sbuf *sb)
{
struct ntb_transport_child *nc = device_get_ivars(child);
- snprintf(buf, buflen, "consumer=%d", nc->consumer);
+ sbuf_printf(sb, "consumer=%d", nc->consumer);
return (0);
}
@@ -1684,7 +1684,7 @@
DEVMETHOD(device_attach, ntb_transport_attach),
DEVMETHOD(device_detach, ntb_transport_detach),
/* Bus interface */
- DEVMETHOD(bus_child_location_str, ntb_transport_child_location_str),
+ DEVMETHOD(bus_child_location, ntb_transport_child_location),
DEVMETHOD(bus_print_child, ntb_transport_print_child),
DEVMETHOD_END
};
Index: sys/dev/nvdimm/nvdimm_acpi.c
===================================================================
--- sys/dev/nvdimm/nvdimm_acpi.c
+++ sys/dev/nvdimm/nvdimm_acpi.c
@@ -41,6 +41,7 @@
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/sbuf.h>
#include <sys/uuid.h>
#include <contrib/dev/acpica/include/acpi.h>
@@ -245,20 +246,14 @@
}
static int
-nvdimm_root_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+nvdimm_root_child_location(device_t dev, device_t child, struct sbuf *sb)
{
ACPI_HANDLE handle;
- int res;
handle = nvdimm_root_get_acpi_handle(child);
if (handle != NULL)
- res = snprintf(buf, buflen, "handle=%s", acpi_name(handle));
- else
- res = snprintf(buf, buflen, "");
+ sbuf_printf(sb, "handle=%s", acpi_name(handle));
- if (res >= buflen)
- return (EOVERFLOW);
return (0);
}
@@ -269,7 +264,7 @@
DEVMETHOD(bus_add_child, bus_generic_add_child),
DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar),
DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar),
- DEVMETHOD(bus_child_location_str, nvdimm_root_child_location_str),
+ DEVMETHOD(bus_child_location, nvdimm_root_child_location),
DEVMETHOD_END
};
Index: sys/dev/ofw/ofw_bus_subr.h
===================================================================
--- sys/dev/ofw/ofw_bus_subr.h
+++ sys/dev/ofw/ofw_bus_subr.h
@@ -83,7 +83,7 @@
ofw_bus_get_type_t ofw_bus_gen_get_type;
/* Helper method to report interesting OF properties in pnpinfo */
-bus_child_pnpinfo_str_t ofw_bus_gen_child_pnpinfo_str;
+bus_child_pnpinfo_t ofw_bus_gen_child_pnpinfo;
/* Routines for processing firmware interrupt maps */
void ofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);
Index: sys/dev/ofw/ofw_cpu.c
===================================================================
--- sys/dev/ofw/ofw_cpu.c
+++ sys/dev/ofw/ofw_cpu.c
@@ -67,7 +67,7 @@
/* Bus interface */
DEVMETHOD(bus_add_child, bus_generic_add_child),
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, ofw_cpulist_get_devinfo),
Index: sys/dev/ow/ow.c
===================================================================
--- sys/dev/ow/ow.c
+++ sys/dev/ow/ow.c
@@ -37,6 +37,7 @@
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <dev/ow/ow.h>
@@ -589,27 +590,13 @@
return 0;
}
-/*
- * Not sure this is really needed. I'm having trouble figuring out what
- * location means in the context of the one wire bus.
- */
-static int
-ow_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
-{
-
- *buf = '\0';
- return (0);
-}
-
static int
-ow_child_pnpinfo_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+ow_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
{
struct ow_devinfo *di;
di = device_get_ivars(child);
- snprintf(buf, buflen, "romid=%8D", &di->romid, ":");
+ sbuf_printf(sb, "romid=%8D", &di->romid, ":");
return (0);
}
@@ -721,8 +708,7 @@
DEVMETHOD(device_detach, ow_detach),
/* Bus interface */
- DEVMETHOD(bus_child_pnpinfo_str, ow_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, ow_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, ow_child_pnpinfo),
DEVMETHOD(bus_read_ivar, ow_read_ivar),
DEVMETHOD(bus_write_ivar, ow_write_ivar),
DEVMETHOD(bus_print_child, ow_print_child),
Index: sys/dev/pccard/pccard.c
===================================================================
--- sys/dev/pccard/pccard.c
+++ sys/dev/pccard/pccard.c
@@ -1022,34 +1022,28 @@
}
static int
-pccard_child_location_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+pccard_child_location(device_t bus, device_t child, struct sbuf *sb)
{
struct pccard_ivar *devi = PCCARD_IVAR(child);
struct pccard_function *pf = devi->pf;
- snprintf(buf, buflen, "function=%d", pf->number);
+ sbuf_printf(sb, "function=%d", pf->number);
return (0);
}
static int
-pccard_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+pccard_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
{
struct pccard_ivar *devi = PCCARD_IVAR(child);
struct pccard_function *pf = devi->pf;
struct pccard_softc *sc = PCCARD_SOFTC(bus);
- struct sbuf sb;
- sbuf_new(&sb, buf, buflen, SBUF_FIXEDLEN | SBUF_INCLUDENUL);
- sbuf_printf(&sb, "manufacturer=0x%04x product=0x%04x "
+ sbuf_printf(sb, "manufacturer=0x%04x product=0x%04x "
"cisvendor=\"", sc->card.manufacturer, sc->card.product);
- devctl_safe_quote_sb(&sb, sc->card.cis1_info[0]);
- sbuf_printf(&sb, "\" cisproduct=\"");
- devctl_safe_quote_sb(&sb, sc->card.cis1_info[1]);
- sbuf_printf(&sb, "\" function_type=%d", pf->function);
- sbuf_finish(&sb);
- sbuf_delete(&sb);
+ devctl_safe_quote_sb(sb, sc->card.cis1_info[0]);
+ sbuf_printf(sb, "\" cisproduct=\"");
+ devctl_safe_quote_sb(sb, sc->card.cis1_info[1]);
+ sbuf_printf(sb, "\" function_type=%d", pf->function);
return (0);
}
@@ -1455,8 +1449,8 @@
DEVMETHOD(bus_delete_resource, pccard_delete_resource),
DEVMETHOD(bus_probe_nomatch, pccard_probe_nomatch),
DEVMETHOD(bus_read_ivar, pccard_read_ivar),
- DEVMETHOD(bus_child_pnpinfo_str, pccard_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, pccard_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, pccard_child_pnpinfo),
+ DEVMETHOD(bus_child_location, pccard_child_location),
/* Card Interface */
DEVMETHOD(card_set_res_flags, pccard_set_res_flags),
Index: sys/dev/pci/pci.c
===================================================================
--- sys/dev/pci/pci.c
+++ sys/dev/pci/pci.c
@@ -46,6 +46,7 @@
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/queue.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
@@ -174,8 +175,8 @@
DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
DEVMETHOD(bus_child_deleted, pci_child_deleted),
DEVMETHOD(bus_child_detached, pci_child_detached),
- DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method),
- DEVMETHOD(bus_child_location_str, pci_child_location_str_method),
+ DEVMETHOD(bus_child_pnpinfo, pci_child_pnpinfo_method),
+ DEVMETHOD(bus_child_location, pci_child_location_method),
DEVMETHOD(bus_hint_device_unit, pci_hint_device_unit),
DEVMETHOD(bus_remap_intr, pci_remap_intr_method),
DEVMETHOD(bus_suspend_child, pci_suspend_child),
@@ -5847,26 +5848,24 @@
}
int
-pci_child_location_str_method(device_t dev, device_t child, char *buf,
- size_t buflen)
+pci_child_location_method(device_t dev, device_t child, struct sbuf *sb)
{
- snprintf(buf, buflen, "slot=%d function=%d dbsf=pci%d:%d:%d:%d",
+ sbuf_printf(sb, "slot=%d function=%d dbsf=pci%d:%d:%d:%d",
pci_get_slot(child), pci_get_function(child), pci_get_domain(child),
pci_get_bus(child), pci_get_slot(child), pci_get_function(child));
return (0);
}
int
-pci_child_pnpinfo_str_method(device_t dev, device_t child, char *buf,
- size_t buflen)
+pci_child_pnpinfo_method(device_t dev, device_t child, struct sbuf *sb)
{
struct pci_devinfo *dinfo;
pcicfgregs *cfg;
dinfo = device_get_ivars(child);
cfg = &dinfo->cfg;
- snprintf(buf, buflen, "vendor=0x%04x device=0x%04x subvendor=0x%04x "
+ sbuf_printf(sb, "vendor=0x%04x device=0x%04x subvendor=0x%04x "
"subdevice=0x%04x class=0x%02x%02x%02x", cfg->vendor, cfg->device,
cfg->subvendor, cfg->subdevice, cfg->baseclass, cfg->subclass,
cfg->progif);
Index: sys/dev/pci/pci_private.h
===================================================================
--- sys/dev/pci/pci_private.h
+++ sys/dev/pci/pci_private.h
@@ -134,10 +134,10 @@
int pci_freecfg(struct pci_devinfo *dinfo);
void pci_child_deleted(device_t dev, device_t child);
void pci_child_detached(device_t dev, device_t child);
-int pci_child_location_str_method(device_t cbdev, device_t child,
- char *buf, size_t buflen);
-int pci_child_pnpinfo_str_method(device_t cbdev, device_t child,
- char *buf, size_t buflen);
+int pci_child_location_method(device_t cbdev, device_t child,
+ struct sbuf *sb);
+int pci_child_pnpinfo_method(device_t cbdev, device_t child,
+ struct sbuf *sb);
int pci_assign_interrupt_method(device_t dev, device_t child);
int pci_resume(device_t dev);
int pci_resume_child(device_t dev, device_t child);
Index: sys/dev/puc/puc.c
===================================================================
--- sys/dev/puc/puc.c
+++ sys/dev/puc/puc.c
@@ -36,6 +36,7 @@
#include <sys/conf.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <machine/bus.h>
@@ -748,23 +749,21 @@
}
int
-puc_bus_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+puc_bus_child_location(device_t dev, device_t child, struct sbuf *sb)
{
struct puc_port *port;
port = device_get_ivars(child);
- snprintf(buf, buflen, "port=%d", port->p_nr);
+ sbuf_printf(sb, "port=%d", port->p_nr);
return (0);
}
int
-puc_bus_child_pnpinfo_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+puc_bus_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
{
struct puc_port *port;
port = device_get_ivars(child);
- snprintf(buf, buflen, "type=%d", port->p_type);
+ sbuf_printf(sb, "type=%d", port->p_type);
return (0);
}
Index: sys/dev/puc/puc_bfe.h
===================================================================
--- sys/dev/puc/puc_bfe.h
+++ sys/dev/puc/puc_bfe.h
@@ -85,8 +85,8 @@
int puc_bfe_detach(device_t);
int puc_bfe_probe(device_t, const struct puc_cfg *);
-int puc_bus_child_location_str(device_t, device_t, char *, size_t);
-int puc_bus_child_pnpinfo_str(device_t, device_t, char *, size_t);
+int puc_bus_child_location(device_t, device_t, struct sbuf *sb);
+int puc_bus_child_pnpinfo(device_t, device_t, struct sbuf *sb);
struct resource *puc_bus_alloc_resource(device_t, device_t, int, int *,
rman_res_t, rman_res_t, rman_res_t, u_int);
int puc_bus_get_resource(device_t, device_t, int, int, rman_res_t *, rman_res_t *);
Index: sys/dev/puc/puc_pci.c
===================================================================
--- sys/dev/puc/puc_pci.c
+++ sys/dev/puc/puc_pci.c
@@ -185,8 +185,8 @@
DEVMETHOD(bus_setup_intr, puc_bus_setup_intr),
DEVMETHOD(bus_teardown_intr, puc_bus_teardown_intr),
DEVMETHOD(bus_print_child, puc_bus_print_child),
- DEVMETHOD(bus_child_pnpinfo_str, puc_bus_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, puc_bus_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, puc_bus_child_pnpinfo),
+ DEVMETHOD(bus_child_location, puc_bus_child_location),
DEVMETHOD_END
};
Index: sys/dev/pwm/ofw_pwmbus.c
===================================================================
--- sys/dev/pwm/ofw_pwmbus.c
+++ sys/dev/pwm/ofw_pwmbus.c
@@ -198,7 +198,7 @@
DEVMETHOD(device_attach, ofw_pwmbus_attach),
/* Bus interface */
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(bus_add_child, ofw_pwmbus_add_child),
DEVMETHOD(bus_child_deleted, ofw_pwmbus_child_deleted),
Index: sys/dev/pwm/pwmbus.c
===================================================================
--- sys/dev/pwm/pwmbus.c
+++ sys/dev/pwm/pwmbus.c
@@ -38,6 +38,7 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/sbuf.h>
#include <dev/pwm/pwmbus.h>
@@ -68,25 +69,17 @@
}
static int
-pwmbus_child_location_str(device_t dev, device_t child, char *buf, size_t blen)
+pwmbus_child_location(device_t dev, device_t child, struct sbuf *sb)
{
struct pwmbus_ivars *ivars;
ivars = device_get_ivars(child);
- snprintf(buf, blen, "hwdev=%s channel=%u",
+ sbuf_printf(sb, "hwdev=%s channel=%u",
device_get_nameunit(device_get_parent(dev)), ivars->pi_channel);
return (0);
}
-static int
-pwmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf,
- size_t buflen)
-{
- *buf = '\0';
- return (0);
-}
-
static void
pwmbus_hinted_child(device_t dev, const char *dname, int dunit)
{
@@ -261,8 +254,7 @@
/* bus_if */
DEVMETHOD(bus_add_child, pwmbus_add_child),
- DEVMETHOD(bus_child_location_str, pwmbus_child_location_str),
- DEVMETHOD(bus_child_pnpinfo_str, pwmbus_child_pnpinfo_str),
+ DEVMETHOD(bus_child_location, pwmbus_child_location),
DEVMETHOD(bus_hinted_child, pwmbus_hinted_child),
DEVMETHOD(bus_print_child, pwmbus_print_child),
DEVMETHOD(bus_probe_nomatch, pwmbus_probe_nomatch),
Index: sys/dev/siis/siis.c
===================================================================
--- sys/dev/siis/siis.c
+++ sys/dev/siis/siis.c
@@ -39,6 +39,7 @@
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/sbuf.h>
#include <sys/sema.h>
#include <sys/taskqueue.h>
#include <vm/uma.h>
@@ -407,11 +408,10 @@
}
static int
-siis_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+siis_child_location(device_t dev, device_t child, struct sbuf *sb)
{
- snprintf(buf, buflen, "channel=%d",
+ sbuf_printf(sb, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
@@ -435,7 +435,7 @@
DEVMETHOD(bus_release_resource, siis_release_resource),
DEVMETHOD(bus_setup_intr, siis_setup_intr),
DEVMETHOD(bus_teardown_intr,siis_teardown_intr),
- DEVMETHOD(bus_child_location_str, siis_child_location_str),
+ DEVMETHOD(bus_child_location, siis_child_location),
DEVMETHOD(bus_get_dma_tag, siis_get_dma_tag),
{ 0, 0 }
};
Index: sys/dev/smbus/smbus.c
===================================================================
--- sys/dev/smbus/smbus.c
+++ sys/dev/smbus/smbus.c
@@ -32,11 +32,12 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
-#include <sys/bus.h>
+#include <sys/sbuf.h>
#include <dev/smbus/smbconf.h>
#include <dev/smbus/smbus.h>
@@ -135,16 +136,13 @@
}
static int
-smbus_child_location_str(device_t parent, device_t child, char *buf,
- size_t buflen)
+smbus_child_location(device_t parent, device_t child, struct sbuf *sb)
{
struct smbus_ivar *devi;
devi = device_get_ivars(child);
if (devi->addr != 0)
- snprintf(buf, buflen, "addr=0x%x", devi->addr);
- else if (buflen)
- buf[0] = 0;
+ sbuf_printf(sb, "addr=0x%x", devi->addr);
return (0);
}
@@ -228,7 +226,7 @@
DEVMETHOD(bus_add_child, smbus_add_child),
DEVMETHOD(bus_hinted_child, smbus_hinted_child),
DEVMETHOD(bus_probe_nomatch, smbus_probe_nomatch),
- DEVMETHOD(bus_child_location_str, smbus_child_location_str),
+ DEVMETHOD(bus_child_location, smbus_child_location),
DEVMETHOD(bus_print_child, smbus_print_child),
DEVMETHOD(bus_read_ivar, smbus_read_ivar),
DEVMETHOD(bus_write_ivar, smbus_write_ivar),
Index: sys/dev/sound/pci/hda/hdaa.c
===================================================================
--- sys/dev/sound/pci/hda/hdaa.c
+++ sys/dev/sound/pci/hda/hdaa.c
@@ -6738,23 +6738,21 @@
}
static int
-hdaa_child_location_str(device_t dev, device_t child, char *buf,
- size_t buflen)
+hdaa_child_location(device_t dev, device_t child, struct sbuf *sb)
{
struct hdaa_devinfo *devinfo = device_get_softc(dev);
struct hdaa_pcm_devinfo *pdevinfo =
(struct hdaa_pcm_devinfo *)device_get_ivars(child);
struct hdaa_audio_as *as;
- int first = 1, i, len = 0;
+ int first = 1, i;
- len += snprintf(buf + len, buflen - len, "nid=");
+ sbuf_printf(sb, "nid=");
if (pdevinfo->playas >= 0) {
as = &devinfo->as[pdevinfo->playas];
for (i = 0; i < 16; i++) {
if (as->pins[i] <= 0)
continue;
- len += snprintf(buf + len, buflen - len,
- "%s%d", first ? "" : ",", as->pins[i]);
+ sbuf_printf(sb, "%s%d", first ? "" : ",", as->pins[i]);
first = 0;
}
}
@@ -6763,8 +6761,7 @@
for (i = 0; i < 16; i++) {
if (as->pins[i] <= 0)
continue;
- len += snprintf(buf + len, buflen - len,
- "%s%d", first ? "" : ",", as->pins[i]);
+ sbuf_printf(sb, "%s%d", first ? "" : ",", as->pins[i]);
first = 0;
}
}
@@ -6830,7 +6827,7 @@
DEVMETHOD(device_resume, hdaa_resume),
/* Bus interface */
DEVMETHOD(bus_print_child, hdaa_print_child),
- DEVMETHOD(bus_child_location_str, hdaa_child_location_str),
+ DEVMETHOD(bus_child_location, hdaa_child_location),
DEVMETHOD(hdac_stream_intr, hdaa_stream_intr),
DEVMETHOD(hdac_unsol_intr, hdaa_unsol_intr),
DEVMETHOD(hdac_pindump, hdaa_pindump),
Index: sys/dev/sound/pci/hda/hdac.c
===================================================================
--- sys/dev/sound/pci/hda/hdac.c
+++ sys/dev/sound/pci/hda/hdac.c
@@ -1774,21 +1774,20 @@
}
static int
-hdac_child_location_str(device_t dev, device_t child, char *buf, size_t buflen)
+hdac_child_location(device_t dev, device_t child, struct sbuf *sb)
{
- snprintf(buf, buflen, "cad=%d", (int)(intptr_t)device_get_ivars(child));
+ sbuf_printf(sb, "cad=%d", (int)(intptr_t)device_get_ivars(child));
return (0);
}
static int
-hdac_child_pnpinfo_str_method(device_t dev, device_t child, char *buf,
- size_t buflen)
+hdac_child_pnpinfo_method(device_t dev, device_t child, struct sbuf *sb)
{
struct hdac_softc *sc = device_get_softc(dev);
nid_t cad = (uintptr_t)device_get_ivars(child);
- snprintf(buf, buflen,
+ sbuf_printf(sb,
"vendor=0x%04x device=0x%04x revision=0x%02x stepping=0x%02x",
sc->codecs[cad].vendor_id, sc->codecs[cad].device_id,
sc->codecs[cad].revision_id, sc->codecs[cad].stepping_id);
@@ -2137,8 +2136,8 @@
/* Bus interface */
DEVMETHOD(bus_get_dma_tag, hdac_get_dma_tag),
DEVMETHOD(bus_print_child, hdac_print_child),
- DEVMETHOD(bus_child_location_str, hdac_child_location_str),
- DEVMETHOD(bus_child_pnpinfo_str, hdac_child_pnpinfo_str_method),
+ DEVMETHOD(bus_child_location, hdac_child_location),
+ DEVMETHOD(bus_child_pnpinfo, hdac_child_pnpinfo_method),
DEVMETHOD(bus_read_ivar, hdac_read_ivar),
DEVMETHOD(hdac_get_mtx, hdac_get_mtx),
DEVMETHOD(hdac_codec_command, hdac_codec_command),
Index: sys/dev/sound/pci/hda/hdacc.c
===================================================================
--- sys/dev/sound/pci/hda/hdacc.c
+++ sys/dev/sound/pci/hda/hdacc.c
@@ -542,21 +542,20 @@
}
static int
-hdacc_child_location_str(device_t dev, device_t child, char *buf, size_t buflen)
+hdacc_child_location(device_t dev, device_t child, struct sbuf *sb)
{
struct hdacc_fg *fg = device_get_ivars(child);
- snprintf(buf, buflen, "nid=%d", fg->nid);
+ sbuf_printf(sb, "nid=%d", fg->nid);
return (0);
}
static int
-hdacc_child_pnpinfo_str_method(device_t dev, device_t child, char *buf,
- size_t buflen)
+hdacc_child_pnpinfo_method(device_t dev, device_t child, struct sbuf *sb)
{
struct hdacc_fg *fg = device_get_ivars(child);
- snprintf(buf, buflen, "type=0x%02x subsystem=0x%08x",
+ sbuf_printf(sb, "type=0x%02x subsystem=0x%08x",
fg->type, fg->subsystem_id);
return (0);
}
@@ -766,8 +765,8 @@
DEVMETHOD(device_suspend, hdacc_suspend),
DEVMETHOD(device_resume, hdacc_resume),
/* Bus interface */
- DEVMETHOD(bus_child_location_str, hdacc_child_location_str),
- DEVMETHOD(bus_child_pnpinfo_str, hdacc_child_pnpinfo_str_method),
+ DEVMETHOD(bus_child_location, hdacc_child_location),
+ DEVMETHOD(bus_child_pnpinfo, hdacc_child_pnpinfo_method),
DEVMETHOD(bus_print_child, hdacc_print_child),
DEVMETHOD(bus_probe_nomatch, hdacc_probe_nomatch),
DEVMETHOD(bus_read_ivar, hdacc_read_ivar),
Index: sys/dev/spibus/ofw_spibus.c
===================================================================
--- sys/dev/spibus/ofw_spibus.c
+++ sys/dev/spibus/ofw_spibus.c
@@ -217,7 +217,7 @@
DEVMETHOD(device_attach, ofw_spibus_attach),
/* Bus interface */
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(bus_add_child, ofw_spibus_add_child),
DEVMETHOD(bus_get_resource_list, ofw_spibus_get_resource_list),
Index: sys/dev/spibus/spibus.c
===================================================================
--- sys/dev/spibus/spibus.c
+++ sys/dev/spibus/spibus.c
@@ -33,8 +33,8 @@
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/queue.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
-#include <sys/types.h>
#include <sys/bus.h>
#include <machine/bus.h>
@@ -119,22 +119,13 @@
}
static int
-spibus_child_location_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+spibus_child_location(device_t bus, device_t child, struct sbuf *sb)
{
struct spibus_ivar *devi = SPIBUS_IVAR(child);
int cs;
cs = devi->cs & ~SPIBUS_CS_HIGH; /* trim 'cs high' bit */
- snprintf(buf, buflen, "bus=%d cs=%d", device_get_unit(bus), cs);
- return (0);
-}
-
-static int
-spibus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
-{
- *buf = '\0';
+ sbuf_printf(sb, "bus=%d cs=%d", device_get_unit(bus), cs);
return (0);
}
@@ -270,8 +261,7 @@
DEVMETHOD(bus_probe_nomatch, spibus_probe_nomatch),
DEVMETHOD(bus_read_ivar, spibus_read_ivar),
DEVMETHOD(bus_write_ivar, spibus_write_ivar),
- DEVMETHOD(bus_child_pnpinfo_str, spibus_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, spibus_child_location_str),
+ DEVMETHOD(bus_child_location, spibus_child_location),
DEVMETHOD(bus_hinted_child, spibus_hinted_child),
/* spibus interface */
Index: sys/dev/superio/superio.c
===================================================================
--- sys/dev/superio/superio.c
+++ sys/dev/superio/superio.c
@@ -41,6 +41,7 @@
#include <sys/module.h>
#include <sys/proc.h>
#include <sys/rman.h>
+#include <sys/sbuf.h>
#include <sys/time.h>
#include <machine/bus.h>
@@ -802,24 +803,22 @@
}
static int
-superio_child_location_str(device_t parent, device_t child, char *buf,
- size_t buflen)
+superio_child_location(device_t parent, device_t child, struct sbuf *sb)
{
uint8_t ldn;
ldn = superio_get_ldn(child);
- snprintf(buf, buflen, "ldn=0x%02x", ldn);
+ sbuf_printf(sb, "ldn=0x%02x", ldn);
return (0);
}
static int
-superio_child_pnp_str(device_t parent, device_t child, char *buf,
- size_t buflen)
+superio_child_pnp(device_t parent, device_t child, struct sbuf *sb)
{
superio_dev_type_t type;
type = superio_get_type(child);
- snprintf(buf, buflen, "type=%s", devtype_to_str(type));
+ sbuf_printf(sb, "type=%s", devtype_to_str(type));
return (0);
}
@@ -1006,8 +1005,8 @@
DEVMETHOD(bus_add_child, superio_add_child),
DEVMETHOD(bus_child_detached, superio_child_detached),
- DEVMETHOD(bus_child_location_str, superio_child_location_str),
- DEVMETHOD(bus_child_pnpinfo_str, superio_child_pnp_str),
+ DEVMETHOD(bus_child_location, superio_child_location),
+ DEVMETHOD(bus_child_pnpinfo, superio_child_pnp),
DEVMETHOD(bus_print_child, superio_print_child),
DEVMETHOD(bus_read_ivar, superio_read_ivar),
DEVMETHOD(bus_write_ivar, superio_write_ivar),
Index: sys/dev/usb/usb_hub.c
===================================================================
--- sys/dev/usb/usb_hub.c
+++ sys/dev/usb/usb_hub.c
@@ -47,6 +47,7 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
@@ -117,7 +118,7 @@
static device_resume_t uhub_resume;
static bus_driver_added_t uhub_driver_added;
-static bus_child_pnpinfo_str_t uhub_child_pnpinfo_string;
+static bus_child_pnpinfo_t uhub_child_pnpinfo;
static usb_callback_t uhub_intr_callback;
#if USB_HAVE_TT_SUPPORT
@@ -166,8 +167,8 @@
DEVMETHOD(device_suspend, uhub_suspend),
DEVMETHOD(device_resume, uhub_resume),
- DEVMETHOD(bus_child_location_str, uhub_child_location_string),
- DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_string),
+ DEVMETHOD(bus_child_location, uhub_child_location),
+ DEVMETHOD(bus_child_pnpinfo, uhub_child_pnpinfo),
DEVMETHOD(bus_driver_added, uhub_driver_added),
DEVMETHOD_END
};
@@ -1638,18 +1639,14 @@
}
int
-uhub_child_location_string(device_t parent, device_t child,
- char *buf, size_t buflen)
+uhub_child_location(device_t parent, device_t child, struct sbuf *sb)
{
struct uhub_softc *sc;
struct usb_hub *hub;
struct hub_result res;
- if (!device_is_attached(parent)) {
- if (buflen)
- buf[0] = 0;
+ if (!device_is_attached(parent))
return (0);
- }
sc = device_get_softc(parent);
hub = sc->sc_udev->hub;
@@ -1658,12 +1655,9 @@
uhub_find_iface_index(hub, child, &res);
if (!res.udev) {
DPRINTF("device not on hub\n");
- if (buflen) {
- buf[0] = '\0';
- }
goto done;
}
- snprintf(buf, buflen, "bus=%u hubaddr=%u port=%u devaddr=%u"
+ sbuf_printf(sb, "bus=%u hubaddr=%u port=%u devaddr=%u"
" interface=%u"
#if USB_HAVE_UGEN
" ugen=%s"
@@ -1683,8 +1677,7 @@
}
static int
-uhub_child_pnpinfo_string(device_t parent, device_t child,
- char *buf, size_t buflen)
+uhub_child_pnpinfo(device_t parent, device_t child, struct sbuf*sb)
{
struct uhub_softc *sc;
struct usb_hub *hub;
@@ -1692,11 +1685,8 @@
struct hub_result res;
uint8_t do_unlock;
- if (!device_is_attached(parent)) {
- if (buflen)
- buf[0] = 0;
+ if (!device_is_attached(parent))
return (0);
- }
sc = device_get_softc(parent);
hub = sc->sc_udev->hub;
@@ -1705,9 +1695,6 @@
uhub_find_iface_index(hub, child, &res);
if (!res.udev) {
DPRINTF("device not on hub\n");
- if (buflen) {
- buf[0] = '\0';
- }
goto done;
}
iface = usbd_get_iface(res.udev, res.iface_index);
@@ -1715,7 +1702,7 @@
/* Make sure device information is not changed during the print. */
do_unlock = usbd_ctrl_lock(res.udev);
- snprintf(buf, buflen, "vendor=0x%04x product=0x%04x "
+ sbuf_printf(sb, "vendor=0x%04x product=0x%04x "
"devclass=0x%02x devsubclass=0x%02x "
"devproto=0x%02x "
"sernum=\"%s\" "
@@ -1739,11 +1726,6 @@
if (do_unlock)
usbd_ctrl_unlock(res.udev);
- } else {
- if (buflen) {
- buf[0] = '\0';
- }
- goto done;
}
done:
mtx_unlock(&Giant);
Index: sys/dev/usb/usb_hub_acpi.c
===================================================================
--- sys/dev/usb/usb_hub_acpi.c
+++ sys/dev/usb/usb_hub_acpi.c
@@ -541,18 +541,15 @@
}
static int
-acpi_uhub_child_location_string(device_t parent, device_t child,
- char *buf, size_t buflen)
+acpi_uhub_child_location(device_t parent, device_t child, struct sbuf *sb)
{
ACPI_HANDLE ah;
- uhub_child_location_string(parent, child, buf, buflen);
+ uhub_child_location(parent, child, sb);
ah = acpi_get_handle(child);
- if (ah != NULL) {
- strlcat(buf, " handle=", buflen);
- strlcat(buf, acpi_name(ah), buflen);
- }
+ if (ah != NULL)
+ sbuf_printf(sb, " handle=%s", acpi_name(ah));
return (0);
}
@@ -560,7 +557,7 @@
DEVMETHOD(device_probe, acpi_uhub_probe),
DEVMETHOD(device_attach, acpi_uhub_attach),
DEVMETHOD(device_detach, acpi_uhub_detach),
- DEVMETHOD(bus_child_location_str, acpi_uhub_child_location_string),
+ DEVMETHOD(bus_child_location, acpi_uhub_child_location),
DEVMETHOD(bus_read_ivar, acpi_uhub_read_ivar),
DEVMETHOD_END
@@ -571,7 +568,7 @@
DEVMETHOD(device_attach, acpi_uhub_root_attach),
DEVMETHOD(device_detach, acpi_uhub_detach),
DEVMETHOD(bus_read_ivar, acpi_uhub_read_ivar),
- DEVMETHOD(bus_child_location_str, acpi_uhub_child_location_string),
+ DEVMETHOD(bus_child_location, acpi_uhub_child_location),
DEVMETHOD_END
};
Index: sys/dev/usb/usb_hub_private.h
===================================================================
--- sys/dev/usb/usb_hub_private.h
+++ sys/dev/usb/usb_hub_private.h
@@ -80,6 +80,6 @@
device_probe_t uhub_probe;
device_attach_t uhub_attach;
device_detach_t uhub_detach;
-bus_child_location_str_t uhub_child_location_string;
+bus_child_location_t uhub_child_location;
#endif
Index: sys/dev/virtio/mmio/virtio_mmio.c
===================================================================
--- sys/dev/virtio/mmio/virtio_mmio.c
+++ sys/dev/virtio/mmio/virtio_mmio.c
@@ -146,7 +146,7 @@
/* Bus interface. */
DEVMETHOD(bus_driver_added, vtmmio_driver_added),
DEVMETHOD(bus_child_detached, vtmmio_child_detached),
- DEVMETHOD(bus_child_pnpinfo_str, virtio_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, virtio_child_pnpinfo),
DEVMETHOD(bus_read_ivar, vtmmio_read_ivar),
DEVMETHOD(bus_write_ivar, vtmmio_write_ivar),
@@ -382,7 +382,7 @@
case VIRTIO_IVAR_DEVICE:
/*
* Dummy value for fields not present in this bus. Used by
- * bus-agnostic virtio_child_pnpinfo_str.
+ * bus-agnostic virtio_child_pnpinfo.
*/
*result = 0;
break;
Index: sys/dev/virtio/pci/virtio_pci_legacy.c
===================================================================
--- sys/dev/virtio/pci/virtio_pci_legacy.c
+++ sys/dev/virtio/pci/virtio_pci_legacy.c
@@ -154,7 +154,7 @@
/* Bus interface. */
DEVMETHOD(bus_driver_added, vtpci_legacy_driver_added),
DEVMETHOD(bus_child_detached, vtpci_legacy_child_detached),
- DEVMETHOD(bus_child_pnpinfo_str, virtio_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, virtio_child_pnpinfo),
DEVMETHOD(bus_read_ivar, vtpci_legacy_read_ivar),
DEVMETHOD(bus_write_ivar, vtpci_legacy_write_ivar),
Index: sys/dev/virtio/pci/virtio_pci_modern.c
===================================================================
--- sys/dev/virtio/pci/virtio_pci_modern.c
+++ sys/dev/virtio/pci/virtio_pci_modern.c
@@ -206,7 +206,7 @@
/* Bus interface. */
DEVMETHOD(bus_driver_added, vtpci_modern_driver_added),
DEVMETHOD(bus_child_detached, vtpci_modern_child_detached),
- DEVMETHOD(bus_child_pnpinfo_str, virtio_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, virtio_child_pnpinfo),
DEVMETHOD(bus_read_ivar, vtpci_modern_read_ivar),
DEVMETHOD(bus_write_ivar, vtpci_modern_write_ivar),
Index: sys/dev/virtio/virtio.h
===================================================================
--- sys/dev/virtio/virtio.h
+++ sys/dev/virtio/virtio.h
@@ -113,8 +113,7 @@
int virtio_config_generation(device_t dev);
int virtio_reinit(device_t dev, uint64_t features);
void virtio_reinit_complete(device_t dev);
-int virtio_child_pnpinfo_str(device_t busdev, device_t child, char *buf,
- size_t buflen);
+int virtio_child_pnpinfo(device_t busdev, device_t child, struct sbuf *sb);
/*
* Read/write a variable amount from the device specific (ie, network)
Index: sys/dev/virtio/virtio.c
===================================================================
--- sys/dev/virtio/virtio.c
+++ sys/dev/virtio/virtio.c
@@ -329,8 +329,7 @@
}
int
-virtio_child_pnpinfo_str(device_t busdev __unused, device_t child, char *buf,
- size_t buflen)
+virtio_child_pnpinfo(device_t busdev __unused, device_t child, struct sbuf *sb)
{
/*
@@ -344,7 +343,7 @@
* see a lot of PNP utility in exposing the same value under a
* different name.
*/
- snprintf(buf, buflen, "vendor=0x%08x device=0x%04x subvendor=0x%04x "
+ sbuf_printf(sb, "vendor=0x%08x device=0x%04x subvendor=0x%04x "
"device_type=0x%08x", (unsigned)virtio_get_vendor(child),
(unsigned)virtio_get_device(child),
(unsigned)virtio_get_subvendor(child),
Index: sys/isa/isa_common.c
===================================================================
--- sys/isa/isa_common.c
+++ sys/isa/isa_common.c
@@ -73,6 +73,7 @@
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <machine/resource.h>
@@ -1032,30 +1033,26 @@
}
static int
-isa_child_pnpinfo_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+isa_child_pnpinfo(device_t bus, device_t child, struct sbuf *sb)
{
struct isa_device *idev = DEVTOISA(child);
if (idev->id_vendorid)
- snprintf(buf, buflen, "pnpid=%s",
+ sbuf_printf(sb, "pnpid=%s",
pnp_eisaformat(idev->id_vendorid));
return (0);
}
static int
-isa_child_location_str(device_t bus, device_t child, char *buf,
- size_t buflen)
+isa_child_location(device_t bus, device_t child, struct sbuf *sb)
{
#if 0
/* id_pnphandle isn't there yet */
struct isa_device *idev = DEVTOISA(child);
if (idev->id_vendorid)
- snprintf(buf, buflen, "pnphandle=%d", idev->id_pnphandle);
+ sbuf_printf(sbuf, "pnphandle=%d", idev->id_pnphandle);
#endif
- /* Nothing here yet */
- *buf = '\0';
return (0);
}
@@ -1087,8 +1084,8 @@
DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
- DEVMETHOD(bus_child_pnpinfo_str, isa_child_pnpinfo_str),
- DEVMETHOD(bus_child_location_str, isa_child_location_str),
+ DEVMETHOD(bus_child_pnpinfo, isa_child_pnpinfo),
+ DEVMETHOD(bus_child_location, isa_child_location),
DEVMETHOD(bus_hinted_child, isa_hinted_child),
DEVMETHOD(bus_hint_device_unit, isa_hint_device_unit),
Index: sys/kern/bus_if.m
===================================================================
--- sys/kern/bus_if.m
+++ sys/kern/bus_if.m
@@ -654,8 +654,7 @@
/**
* @brief Returns the pnp info for this device.
*
- * Return it as a string. If the storage is insufficient for the
- * string, then return EOVERFLOW.
+ * Return it as a string, appended to @p _sb
*
* The string must be formatted as a space-separated list of
* name=value pairs. Names may only contain alphanumeric characters,
@@ -666,22 +665,18 @@
*
* @param _dev the parent device of @p _child
* @param _child the device which is being examined
- * @param _buf the address of a buffer to receive the pnp
- * string
- * @param _buflen the size of the buffer pointed to by @p _buf
+ * @param _sb sbuf for results string
*/
-METHOD int child_pnpinfo_str {
+METHOD int child_pnpinfo {
device_t _dev;
device_t _child;
- char *_buf;
- size_t _buflen;
-};
+ struct sbuf *_sb;
+} DEFAULT bus_generic_child_pnpinfo;
/**
* @brief Returns the location for this device.
*
- * Return it as a string. If the storage is insufficient for the
- * string, then return EOVERFLOW.
+ * Return it as a string, appended to @p _sb
*
* The string must be formatted as a space-separated list of
* name=value pairs. Names may only contain alphanumeric characters,
@@ -692,16 +687,13 @@
*
* @param _dev the parent device of @p _child
* @param _child the device which is being examined
- * @param _buf the address of a buffer to receive the location
- * string
- * @param _buflen the size of the buffer pointed to by @p _buf
+ * @param _sb sbuf for results string
*/
-METHOD int child_location_str {
+METHOD int child_location {
device_t _dev;
device_t _child;
- char *_buf;
- size_t _buflen;
-};
+ struct sbuf *_sb;
+} DEFAULT bus_generic_child_location;
/**
* @brief Allow drivers to request that an interrupt be bound to a specific
Index: sys/kern/subr_bus.c
===================================================================
--- sys/kern/subr_bus.c
+++ sys/kern/subr_bus.c
@@ -159,8 +159,6 @@
EVENTHANDLER_LIST_DEFINE(device_detach);
EVENTHANDLER_LIST_DEFINE(dev_lookup);
-static int bus_child_location_sb(device_t child, struct sbuf *sb);
-static int bus_child_pnpinfo_sb(device_t child, struct sbuf *sb);
static void devctl2_init(void);
static bool device_frozen;
@@ -276,10 +274,10 @@
sbuf_cat(&sb, dev->driver ? dev->driver->name : "");
break;
case DEVICE_SYSCTL_LOCATION:
- bus_child_location_sb(dev, &sb);
+ bus_child_location(dev, &sb);
break;
case DEVICE_SYSCTL_PNPINFO:
- bus_child_pnpinfo_sb(dev, &sb);
+ bus_child_pnpinfo(dev, &sb);
break;
case DEVICE_SYSCTL_PARENT:
sbuf_cat(&sb, dev->parent ? dev->parent->nameunit : "");
@@ -736,11 +734,11 @@
sbuf_cat(&sb, " at ");
/* Add in the location */
- bus_child_location_sb(dev, &sb);
+ bus_child_location(dev, &sb);
sbuf_putc(&sb, ' ');
/* Add in pnpinfo */
- bus_child_pnpinfo_sb(dev, &sb);
+ bus_child_pnpinfo(dev, &sb);
/* Get the parent of this device, or / if high enough in the tree. */
if (device_get_parent(dev) == NULL)
@@ -4947,108 +4945,62 @@
}
/**
- * @brief Wrapper function for BUS_CHILD_PNPINFO_STR().
+ * @brief Wrapper function for BUS_CHILD_PNPINFO().
*
- * This function simply calls the BUS_CHILD_PNPINFO_STR() method of the
- * parent of @p dev.
+ * This function simply calls the BUS_CHILD_PNPINFO() method of the parent of @p
+ * dev.
*/
int
-bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen)
+bus_child_pnpinfo(device_t child, struct sbuf *sb)
{
device_t parent;
parent = device_get_parent(child);
- if (parent == NULL) {
- *buf = '\0';
+ if (parent == NULL)
return (0);
- }
- return (BUS_CHILD_PNPINFO_STR(parent, child, buf, buflen));
+ return (BUS_CHILD_PNPINFO(parent, child, sb));
}
/**
- * @brief Wrapper function for BUS_CHILD_LOCATION_STR().
+ * @brief Generic implementation that does nothing for bus_child_pnpinfo
*
- * This function simply calls the BUS_CHILD_LOCATION_STR() method of the
- * parent of @p dev.
+ * This function has the right signature and returns 0 since the sbuf is passed
+ * to us to append to.
*/
int
-bus_child_location_str(device_t child, char *buf, size_t buflen)
+bus_generic_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb)
{
- device_t parent;
-
- parent = device_get_parent(child);
- if (parent == NULL) {
- *buf = '\0';
- return (0);
- }
- return (BUS_CHILD_LOCATION_STR(parent, child, buf, buflen));
+ return (0);
}
/**
- * @brief Wrapper function for bus_child_pnpinfo_str using sbuf
+ * @brief Wrapper function for BUS_CHILD_LOCATION().
*
- * A convenient wrapper frunction for bus_child_pnpinfo_str that allows
- * us to splat that into an sbuf. It uses unholy knowledge of sbuf to
- * accomplish this, however. It is an interim function until we can convert
- * this interface more fully.
+ * This function simply calls the BUS_CHILD_LOCATION() method of the parent of
+ * @p dev.
*/
-/* Note: we reach inside of sbuf because it's API isn't rich enough to do this */
-#define SPACE(s) ((s)->s_size - (s)->s_len)
-#define EOB(s) ((s)->s_buf + (s)->s_len)
-
-static int
-bus_child_pnpinfo_sb(device_t dev, struct sbuf *sb)
+int
+bus_child_location(device_t child, struct sbuf *sb)
{
- char *p;
- ssize_t space;
+ device_t parent;
- MPASS((sb->s_flags & SBUF_INCLUDENUL) == 0);
- MPASS(sb->s_size >= sb->s_len);
- if (sb->s_error != 0)
- return (-1);
- space = SPACE(sb);
- if (space <= 1) {
- sb->s_error = ENOMEM;
- return (-1);
- }
- p = EOB(sb);
- *p = '\0'; /* sbuf buffer isn't NUL terminated until sbuf_finish() */
- bus_child_pnpinfo_str(dev, p, space);
- sb->s_len += strlen(p);
- return (0);
+ parent = device_get_parent(child);
+ if (parent == NULL)
+ return (0);
+ return (BUS_CHILD_LOCATION(parent, child, sb));
}
/**
- * @brief Wrapper function for bus_child_pnpinfo_str using sbuf
+ * @brief Generic implementation that does nothing for bus_child_location
*
- * A convenient wrapper frunction for bus_child_pnpinfo_str that allows
- * us to splat that into an sbuf. It uses unholy knowledge of sbuf to
- * accomplish this, however. It is an interim function until we can convert
- * this interface more fully.
+ * This function has the right signature and returns 0 since the sbuf is passed
+ * to us to append to.
*/
-static int
-bus_child_location_sb(device_t dev, struct sbuf *sb)
+int
+bus_generic_child_location(device_t dev, device_t child, struct sbuf *sb)
{
- char *p;
- ssize_t space;
-
- MPASS((sb->s_flags & SBUF_INCLUDENUL) == 0);
- MPASS(sb->s_size >= sb->s_len);
- if (sb->s_error != 0)
- return (-1);
- space = SPACE(sb);
- if (space <= 1) {
- sb->s_error = ENOMEM;
- return (-1);
- }
- p = EOB(sb);
- *p = '\0'; /* sbuf buffer isn't NUL terminated until sbuf_finish() */
- bus_child_location_str(dev, p, space);
- sb->s_len += strlen(p);
return (0);
}
-#undef SPACE
-#undef EOB
/**
* @brief Wrapper function for BUS_GET_CPUS().
@@ -5579,9 +5531,9 @@
if (dev->driver != NULL)
sbuf_cat(&sb, dev->driver->name);
sbuf_putc(&sb, '\0');
- bus_child_pnpinfo_sb(dev, &sb);
+ bus_child_pnpinfo(dev, &sb);
sbuf_putc(&sb, '\0');
- bus_child_location_sb(dev, &sb);
+ bus_child_location(dev, &sb);
sbuf_putc(&sb, '\0');
error = sbuf_finish(&sb);
if (error == 0)
Index: sys/powerpc/ofw/ofw_pcibus.c
===================================================================
--- sys/powerpc/ofw/ofw_pcibus.c
+++ sys/powerpc/ofw/ofw_pcibus.c
@@ -66,8 +66,8 @@
static pci_assign_interrupt_t ofw_pcibus_assign_interrupt;
static ofw_bus_get_devinfo_t ofw_pcibus_get_devinfo;
static bus_child_deleted_t ofw_pcibus_child_deleted;
-static int ofw_pcibus_child_pnpinfo_str_method(device_t cbdev, device_t child,
- char *buf, size_t buflen);
+static int ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child,
+ struct sbuf *sb);
static void ofw_pcibus_enum_devtree(device_t dev, u_int domain, u_int busno);
static void ofw_pcibus_enum_bus(device_t dev, u_int domain, u_int busno);
@@ -79,7 +79,7 @@
/* Bus interface */
DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted),
- DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_child_pnpinfo_str_method),
+ DEVMETHOD(bus_child_pnpinfo, ofw_pcibus_child_pnpinfo_method),
DEVMETHOD(bus_rescan, bus_null_rescan),
DEVMETHOD(bus_get_cpus, ofw_pcibus_get_cpus),
DEVMETHOD(bus_get_domain, ofw_pcibus_get_domain),
@@ -300,14 +300,13 @@
}
static int
-ofw_pcibus_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf,
- size_t buflen)
+ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child, struct sbuf *sb)
{
- pci_child_pnpinfo_str_method(cbdev, child, buf, buflen);
+ pci_child_pnpinfo_method(cbdev, child, sb);
if (ofw_bus_get_node(child) != -1) {
- strlcat(buf, " ", buflen); /* Separate info */
- ofw_bus_gen_child_pnpinfo_str(cbdev, child, buf, buflen);
+ sbuf_cat(sb, " "); /* Separate info */
+ ofw_bus_gen_child_pnpinfo(cbdev, child, sb);
}
return (0);
Index: sys/powerpc/powermac/macgpio.c
===================================================================
--- sys/powerpc/powermac/macgpio.c
+++ sys/powerpc/powermac/macgpio.c
@@ -104,7 +104,7 @@
DEVMETHOD(bus_deactivate_resource, macgpio_deactivate_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, macgpio_get_devinfo),
Index: sys/powerpc/powermac/macio.c
===================================================================
--- sys/powerpc/powermac/macio.c
+++ sys/powerpc/powermac/macio.c
@@ -114,7 +114,7 @@
DEVMETHOD(bus_deactivate_resource, macio_deactivate_resource),
DEVMETHOD(bus_get_resource_list, macio_get_resource_list),
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, macio_get_devinfo),
Index: sys/powerpc/powermac/smu.c
===================================================================
--- sys/powerpc/powermac/smu.c
+++ sys/powerpc/powermac/smu.c
@@ -196,7 +196,7 @@
DEVMETHOD(clock_settime, smu_settime),
/* ofw_bus interface */
- DEVMETHOD(bus_child_pnpinfo_str,ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(ofw_bus_get_devinfo, smu_get_devinfo),
DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat),
DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model),
Index: sys/powerpc/powermac/uninorth.c
===================================================================
--- sys/powerpc/powermac/uninorth.c
+++ sys/powerpc/powermac/uninorth.c
@@ -117,7 +117,7 @@
DEVMETHOD(bus_deactivate_resource, unin_chip_deactivate_resource),
DEVMETHOD(bus_get_resource_list, unin_chip_get_resource_list),
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, unin_chip_get_devinfo),
Index: sys/powerpc/powernv/opal_dev.c
===================================================================
--- sys/powerpc/powernv/opal_dev.c
+++ sys/powerpc/powernv/opal_dev.c
@@ -75,7 +75,7 @@
DEVMETHOD(clock_settime, opal_settime),
/* Bus interface */
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, opaldev_get_devinfo),
Index: sys/powerpc/pseries/vdevice.c
===================================================================
--- sys/powerpc/pseries/vdevice.c
+++ sys/powerpc/pseries/vdevice.c
@@ -71,7 +71,7 @@
/* Bus interface */
DEVMETHOD(bus_add_child, bus_generic_add_child),
- DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+ DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
DEVMETHOD(bus_print_child, vdevice_print_child),
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
Index: sys/sys/bus.h
===================================================================
--- sys/sys/bus.h
+++ sys/sys/bus.h
@@ -551,8 +551,8 @@
rman_res_t bus_get_resource_count(device_t dev, int type, int rid);
void bus_delete_resource(device_t dev, int type, int rid);
int bus_child_present(device_t child);
-int bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen);
-int bus_child_location_str(device_t child, char *buf, size_t buflen);
+int bus_child_pnpinfo(device_t child, struct sbuf *sb);
+int bus_child_location(device_t child, struct sbuf *sb);
void bus_enumerate_hinted_children(device_t bus);
int bus_delayed_attach_children(device_t bus);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 12:10 PM (15 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14641703
Default Alt Text
D29937.diff (97 KB)
Attached To
Mode
D29937: newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf
Attached
Detach File
Event Timeline
Log In to Comment