Changeset fc8c2b6 in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2011-03-30T14:26:13Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e72fb34
Parents:
3fddb55
Message:

devman can tell device handle by its class path

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/main.c

    r3fddb55 rfc8c2b6  
    448448}
    449449
     450/** Find handle for the device instance identified by device class name. */
     451static void devman_function_get_handle_by_class(ipc_callid_t iid,
     452    ipc_call_t *icall)
     453{
     454        char *classname;
     455        char *devname;
     456
     457        int rc = async_data_write_accept((void **) &classname, true, 0, 0, 0, 0);
     458        if (rc != EOK) {
     459                async_answer_0(iid, rc);
     460                return;
     461        }
     462        rc = async_data_write_accept((void **) &devname, true, 0, 0, 0, 0);
     463        if (rc != EOK) {
     464                free(classname);
     465                async_answer_0(iid, rc);
     466                return;
     467        }
     468
     469
     470        fun_node_t *fun = find_fun_node_by_class(&class_list,
     471            classname, devname);
     472
     473        free(classname);
     474        free(devname);
     475
     476        if (fun == NULL) {
     477                async_answer_0(iid, ENOENT);
     478                return;
     479        }
     480
     481        async_answer_1(iid, EOK, fun->handle);
     482}
     483
    450484
    451485/** Function for handling connections from a client to the device manager. */
     
    466500                case DEVMAN_DEVICE_GET_HANDLE:
    467501                        devman_function_get_handle(callid, &call);
     502                        break;
     503                case DEVMAN_DEVICE_GET_HANDLE_BY_CLASS:
     504                        devman_function_get_handle_by_class(callid, &call);
    468505                        break;
    469506                default:
Note: See TracChangeset for help on using the changeset viewer.