Changeset 8b1e15ac in mainline for uspace/drv/rootvirt/rootvirt.c
- Timestamp:
- 2011-02-11T22:26:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 68414f4a
- Parents:
- 1b367b4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/rootvirt/rootvirt.c
r1b367b4 r8b1e15ac 43 43 #define NAME "rootvirt" 44 44 45 /** Virtual device entry.*/45 /** Virtual function entry */ 46 46 typedef struct { 47 /** Device name.*/47 /** Function name */ 48 48 const char *name; 49 /** Device match id.*/49 /** Function match ID */ 50 50 const char *match_id; 51 } virtual_ device_t;51 } virtual_function_t; 52 52 53 /** List of existing virtual devices.*/54 virtual_ device_t virtual_devices[] = {53 /** List of existing virtual functions */ 54 virtual_function_t virtual_functions[] = { 55 55 #include "devices.def" 56 /* Terminating item .*/56 /* Terminating item */ 57 57 { 58 58 .name = NULL, … … 72 72 }; 73 73 74 /** Add childdevice.74 /** Add function to the virtual device. 75 75 * 76 * @param parent Parent device.77 * @param v irt_dev Virtual device to add.78 * @return Error code.76 * @param vdev The virtual device 77 * @param vfun Virtual function description 78 * @return EOK on success or negative error code. 79 79 */ 80 static int add_child(device_t * parent, virtual_device_t *virt_dev)80 static int add_child(device_t *vdev, virtual_function_t *vfun) 81 81 { 82 printf(NAME ": registering child device`%s' (match \"%s\")\n",83 v irt_dev->name, virt_dev->match_id);82 printf(NAME ": registering function `%s' (match \"%s\")\n", 83 vfun->name, vfun->match_id); 84 84 85 int rc = child_device_register_wrapper(parent, virt_dev->name,86 v irt_dev->match_id, 10);85 int rc = register_function_wrapper(vdev, vfun->name, 86 vfun->match_id, 10); 87 87 88 88 if (rc == EOK) { 89 89 printf(NAME ": registered child device `%s'\n", 90 v irt_dev->name);90 vfun->name); 91 91 } else { 92 92 printf(NAME ": failed to register child device `%s': %s\n", 93 v irt_dev->name, str_error(rc));93 vfun->name, str_error(rc)); 94 94 } 95 95 … … 109 109 } 110 110 111 printf(NAME ": add_device(name=\"%s\", handle=%d)\n", 112 dev->name, (int)dev->handle); 111 printf(NAME ": add_device(handle=%d)\n", (int)dev->handle); 113 112 114 113 /* 115 * Go through all virtual devices and try to add them.114 * Go through all virtual functions and try to add them. 116 115 * We silently ignore failures. 117 116 */ 118 virtual_ device_t *virt_dev = virtual_devices;119 while (v irt_dev->name != NULL) {120 (void) add_child(dev, v irt_dev);121 v irt_dev++;117 virtual_function_t *vfun = virtual_functions; 118 while (vfun->name != NULL) { 119 (void) add_child(dev, vfun); 120 vfun++; 122 121 } 123 122
Note:
See TracChangeset
for help on using the changeset viewer.