int socket_dev_init(void) { // create device node devfs_publish_device("net/socket", NULL, &socket_dev_hooks); return 0; }
static status_t publish_device(device_node *node, const char *path, const char *moduleName) { if (path == NULL || !path[0] || moduleName == NULL || !moduleName[0]) return B_BAD_VALUE; RecursiveLocker _(sLock); dprintf("publish device: node %p, path %s, module %s\n", node, path, moduleName); Device* device = new(std::nothrow) Device(node, moduleName); if (device == NULL) return B_NO_MEMORY; status_t status = device->InitCheck(); if (status == B_OK) status = devfs_publish_device(path, device); if (status != B_OK) { delete device; return status; } node->AddDevice(device); return B_OK; }
int dev_bootstrap(void) { if(module_get(ISA_MODULE_NAME, 0, (void **)&isa) < 0) { dprintf("keyboard dev_bootstrap: no isa bus found..\n"); return -1; } setup_keyboard(); int_set_io_interrupt_handler(1,&handle_keyboard_interrupt, NULL, "keyb"); devfs_publish_device("keyboard", NULL, &keyboard_hooks); return NO_ERROR; }