Changeset 9e195e2c in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2011-05-12T09:03:00Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d59d0bb
Parents:
456aea3 (diff), c372e03 (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 development

File:
1 edited

Legend:

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

    r456aea3 r9e195e2c  
    515515}
    516516
     517/** Find device path by its handle. */
     518static void devman_get_device_path_by_handle(ipc_callid_t iid,
     519    ipc_call_t *icall)
     520{
     521        devman_handle_t handle = IPC_GET_ARG1(*icall);
     522
     523        fun_node_t *fun = find_fun_node(&device_tree, handle);
     524        if (fun == NULL) {
     525                async_answer_0(iid, ENOMEM);
     526                return;
     527        }
     528
     529        ipc_callid_t data_callid;
     530        size_t data_len;
     531        if (!async_data_read_receive(&data_callid, &data_len)) {
     532                async_answer_0(iid, EINVAL);
     533                return;
     534        }
     535
     536        void *buffer = malloc(data_len);
     537        if (buffer == NULL) {
     538                async_answer_0(data_callid, ENOMEM);
     539                async_answer_0(iid, ENOMEM);
     540                return;
     541        }
     542
     543        size_t sent_length = str_size(fun->pathname);
     544        if (sent_length > data_len) {
     545                sent_length = data_len;
     546        }
     547
     548        async_data_read_finalize(data_callid, fun->pathname, sent_length);
     549        async_answer_0(iid, EOK);
     550
     551        free(buffer);
     552}
     553
    517554
    518555/** Function for handling connections from a client to the device manager. */
     
    536573                case DEVMAN_DEVICE_GET_HANDLE_BY_CLASS:
    537574                        devman_function_get_handle_by_class(callid, &call);
     575                        break;
     576                case DEVMAN_DEVICE_GET_DEVICE_PATH:
     577                        devman_get_device_path_by_handle(callid, &call);
    538578                        break;
    539579                default:
Note: See TracChangeset for help on using the changeset viewer.