listdev: Style cleanup. No functional change.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
@@ -15,35 +21,44 @@
|
||||
status_t init_dm_wrapper(void)
|
||||
{
|
||||
uint32 version = 0;
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, B_SYSCALL_INFO, &version, sizeof(version));
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, B_SYSCALL_INFO,
|
||||
&version, sizeof(version));
|
||||
}
|
||||
|
||||
|
||||
status_t uninit_dm_wrapper(void)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
get_root(device_node_cookie *cookie)
|
||||
{
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_ROOT, cookie, sizeof(device_node_cookie));
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_ROOT,
|
||||
cookie, sizeof(device_node_cookie));
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
get_child(device_node_cookie *device)
|
||||
{
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_CHILD, device, sizeof(device_node_cookie));
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_CHILD,
|
||||
device, sizeof(device_node_cookie));
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
get_next_child(device_node_cookie *device)
|
||||
{
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_CHILD, device, sizeof(device_node_cookie));
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_CHILD,
|
||||
device, sizeof(device_node_cookie));
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
dm_get_next_attr(struct device_attr_info *attr)
|
||||
{
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_ATTRIBUTE, attr, sizeof(struct device_attr_info));
|
||||
return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_ATTRIBUTE,
|
||||
attr, sizeof(struct device_attr_info));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
/*
|
||||
* Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _DM_WRAPPER_H_
|
||||
#define _DM_WRAPPER_H_
|
||||
|
||||
|
||||
#include "device_manager_defs.h"
|
||||
|
||||
|
||||
status_t init_dm_wrapper(void);
|
||||
status_t uninit_dm_wrapper(void);
|
||||
|
||||
@@ -11,4 +17,5 @@ status_t get_child(device_node_cookie *cookie);
|
||||
status_t get_next_child(device_node_cookie *cookie);
|
||||
status_t dm_get_next_attr(struct device_attr_info *attr);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+22
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "pcihdr.h"
|
||||
#include "pci-utils.h"
|
||||
|
||||
|
||||
extern const char *__progname;
|
||||
|
||||
#define DUMP_MODE 0
|
||||
@@ -32,6 +33,7 @@ int gMode = USER_MODE;
|
||||
#define BUS_PCI 2
|
||||
#define BUS_SCSI 3
|
||||
|
||||
|
||||
static const char *
|
||||
get_scsi_device_type(uint8 type)
|
||||
{
|
||||
@@ -132,7 +134,7 @@ dump_nodes(device_node_cookie *node, uint8 level)
|
||||
return;
|
||||
|
||||
do {
|
||||
dump_nodes(&child, level+1);
|
||||
dump_nodes(&child, level + 1);
|
||||
} while ((err = get_next_child(&child)) == B_OK);
|
||||
|
||||
}
|
||||
@@ -235,15 +237,17 @@ display_device(device_node_cookie *node, uint8 level)
|
||||
|
||||
switch (bus) {
|
||||
case BUS_ISA:
|
||||
new_level=level+1;
|
||||
new_level = level + 1;
|
||||
break;
|
||||
case BUS_PCI:
|
||||
printf("\n");
|
||||
{
|
||||
char classInfo[64];
|
||||
get_class_info(pci_class_base_id, pci_class_sub_id, pci_class_api_id, classInfo, 64);
|
||||
get_class_info(pci_class_base_id, pci_class_sub_id,
|
||||
pci_class_api_id, classInfo, 64);
|
||||
put_level(level);
|
||||
printf("device %s [%x|%x|%x]\n", classInfo, pci_class_base_id, pci_class_sub_id, pci_class_api_id);
|
||||
printf("device %s [%x|%x|%x]\n", classInfo, pci_class_base_id,
|
||||
pci_class_sub_id, pci_class_api_id);
|
||||
}
|
||||
|
||||
put_level(level);
|
||||
@@ -252,23 +256,27 @@ display_device(device_node_cookie *node, uint8 level)
|
||||
if (!venShort && !venFull) {
|
||||
printf("vendor %04x: Unknown\n", pci_vendor_id);
|
||||
} else if (venShort && venFull) {
|
||||
printf("vendor %04x: %s - %s\n", pci_vendor_id, venShort, venFull);
|
||||
printf("vendor %04x: %s - %s\n", pci_vendor_id,
|
||||
venShort, venFull);
|
||||
} else {
|
||||
printf("vendor %04x: %s\n", pci_vendor_id, venShort ? venShort : venFull);
|
||||
printf("vendor %04x: %s\n", pci_vendor_id,
|
||||
venShort ? venShort : venFull);
|
||||
}
|
||||
|
||||
put_level(level);
|
||||
printf(" ");
|
||||
get_device_info(pci_vendor_id, pci_device_id, pci_subsystem_vendor_id, pci_subsystem_id,
|
||||
&devShort, &devFull);
|
||||
get_device_info(pci_vendor_id, pci_device_id,
|
||||
pci_subsystem_vendor_id, pci_subsystem_id, &devShort, &devFull);
|
||||
if (!devShort && !devFull) {
|
||||
printf("device %04x: Unknown\n", pci_device_id);
|
||||
} else if (devShort && devFull) {
|
||||
printf("device %04x: %s (%s)\n", pci_device_id, devShort, devFull);
|
||||
printf("device %04x: %s (%s)\n", pci_device_id,
|
||||
devShort, devFull);
|
||||
} else {
|
||||
printf("device %04x: %s\n", pci_device_id, devShort ? devShort : devFull);
|
||||
printf("device %04x: %s\n", pci_device_id,
|
||||
devShort ? devShort : devFull);
|
||||
}
|
||||
new_level = level+1;
|
||||
new_level = level + 1;
|
||||
break;
|
||||
case BUS_SCSI:
|
||||
if (scsi_type == 255)
|
||||
@@ -279,7 +287,7 @@ display_device(device_node_cookie *node, uint8 level)
|
||||
printf(" vendor %15s\tmodel %15s\ttype %s\n", scsi_vendor,
|
||||
scsi_product, get_scsi_device_type(scsi_type));
|
||||
|
||||
new_level = level+1;
|
||||
new_level = level + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -315,7 +323,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (argc > 2)
|
||||
usage();
|
||||
usage();
|
||||
|
||||
if (argc == 2) {
|
||||
if (!strcmp(argv[1], "-d")) {
|
||||
|
||||
Reference in New Issue
Block a user