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


Ignore:
Timestamp:
2011-04-01T17:07:59Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ebcb05a
Parents:
cfc3027 (diff), 0864122 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~vojtech-horky/helenos/ddf-fixes

File:
1 edited

Legend:

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

    rcfc3027 rbdbb6f6  
    248248        }
    249249       
     250        /* Check that function with same name is not there already. */
     251        if (find_fun_node_in_device(pdev, fun_name) != NULL) {
     252                fibril_rwlock_write_unlock(&tree->rwlock);
     253                async_answer_0(callid, EEXISTS);
     254                printf(NAME ": Warning, driver tried to register `%s' twice.\n",
     255                    fun_name);
     256                free(fun_name);
     257                return;
     258        }
     259
    250260        fun_node_t *fun = create_fun_node();
    251261        if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) {
     
    443453}
    444454
     455/** Find handle for the device instance identified by device class name. */
     456static void devman_function_get_handle_by_class(ipc_callid_t iid,
     457    ipc_call_t *icall)
     458{
     459        char *classname;
     460        char *devname;
     461
     462        int rc = async_data_write_accept((void **) &classname, true, 0, 0, 0, 0);
     463        if (rc != EOK) {
     464                async_answer_0(iid, rc);
     465                return;
     466        }
     467        rc = async_data_write_accept((void **) &devname, true, 0, 0, 0, 0);
     468        if (rc != EOK) {
     469                free(classname);
     470                async_answer_0(iid, rc);
     471                return;
     472        }
     473
     474
     475        fun_node_t *fun = find_fun_node_by_class(&class_list,
     476            classname, devname);
     477
     478        free(classname);
     479        free(devname);
     480
     481        if (fun == NULL) {
     482                async_answer_0(iid, ENOENT);
     483                return;
     484        }
     485
     486        async_answer_1(iid, EOK, fun->handle);
     487}
     488
    445489
    446490/** Function for handling connections from a client to the device manager. */
     
    461505                case DEVMAN_DEVICE_GET_HANDLE:
    462506                        devman_function_get_handle(callid, &call);
     507                        break;
     508                case DEVMAN_DEVICE_GET_HANDLE_BY_CLASS:
     509                        devman_function_get_handle_by_class(callid, &call);
    463510                        break;
    464511                default:
Note: See TracChangeset for help on using the changeset viewer.