listdev: Style cleanup. No functional change.

This commit is contained in:
Alexander von Gluck IV
2012-04-01 13:40:19 -05:00
parent 91b523054f
commit 5cb635561c
3 changed files with 66 additions and 36 deletions
+21 -6
View File
@@ -1,3 +1,9 @@
/*
* Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
@@ -15,35 +21,44 @@
status_t init_dm_wrapper(void) status_t init_dm_wrapper(void)
{ {
uint32 version = 0; 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) status_t uninit_dm_wrapper(void)
{ {
return B_OK; return B_OK;
} }
status_t status_t
get_root(device_node_cookie *cookie) 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 status_t
get_child(device_node_cookie *device) 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 status_t
get_next_child(device_node_cookie *device) 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 status_t
dm_get_next_attr(struct device_attr_info *attr) 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));
} }
+7
View File
@@ -1,8 +1,14 @@
/*
* Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _DM_WRAPPER_H_ #ifndef _DM_WRAPPER_H_
#define _DM_WRAPPER_H_ #define _DM_WRAPPER_H_
#include "device_manager_defs.h" #include "device_manager_defs.h"
status_t init_dm_wrapper(void); status_t init_dm_wrapper(void);
status_t uninit_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 get_next_child(device_node_cookie *cookie);
status_t dm_get_next_attr(struct device_attr_info *attr); status_t dm_get_next_attr(struct device_attr_info *attr);
#endif #endif
+17 -9
View File
@@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -22,6 +22,7 @@
#include "pcihdr.h" #include "pcihdr.h"
#include "pci-utils.h" #include "pci-utils.h"
extern const char *__progname; extern const char *__progname;
#define DUMP_MODE 0 #define DUMP_MODE 0
@@ -32,6 +33,7 @@ int gMode = USER_MODE;
#define BUS_PCI 2 #define BUS_PCI 2
#define BUS_SCSI 3 #define BUS_SCSI 3
static const char * static const char *
get_scsi_device_type(uint8 type) get_scsi_device_type(uint8 type)
{ {
@@ -241,9 +243,11 @@ display_device(device_node_cookie *node, uint8 level)
printf("\n"); printf("\n");
{ {
char classInfo[64]; 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); 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); put_level(level);
@@ -252,21 +256,25 @@ display_device(device_node_cookie *node, uint8 level)
if (!venShort && !venFull) { if (!venShort && !venFull) {
printf("vendor %04x: Unknown\n", pci_vendor_id); printf("vendor %04x: Unknown\n", pci_vendor_id);
} else if (venShort && venFull) { } 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 { } 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); put_level(level);
printf(" "); printf(" ");
get_device_info(pci_vendor_id, pci_device_id, pci_subsystem_vendor_id, pci_subsystem_id, get_device_info(pci_vendor_id, pci_device_id,
&devShort, &devFull); pci_subsystem_vendor_id, pci_subsystem_id, &devShort, &devFull);
if (!devShort && !devFull) { if (!devShort && !devFull) {
printf("device %04x: Unknown\n", pci_device_id); printf("device %04x: Unknown\n", pci_device_id);
} else if (devShort && devFull) { } 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 { } 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; break;