Changeset 903bac0a in mainline for uspace/lib/c/generic
- Timestamp:
- 2011-08-19T09:00:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e2ab36f1
- Parents:
- d894fbd (diff), 42a619b (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. - Location:
- uspace/lib/c/generic
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/devman.c
rd894fbd r903bac0a 271 271 } 272 272 273 int devman_add_device_to_c lass(devman_handle_t devman_handle,274 const char *c lass_name)273 int devman_add_device_to_category(devman_handle_t devman_handle, 274 const char *cat_name) 275 275 { 276 276 async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER); 277 277 278 278 ipc_call_t answer; 279 aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_C LASS,279 aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY, 280 280 devman_handle, &answer); 281 sysarg_t retval = async_data_write_start(exch, c lass_name,282 str_size(c lass_name));281 sysarg_t retval = async_data_write_start(exch, cat_name, 282 str_size(cat_name)); 283 283 284 284 devman_exchange_end(exch); … … 308 308 } 309 309 310 /** Remove function from device. 311 * 312 * Request devman to remove function owned by this driver task. 313 * @param funh Devman handle of the function 314 * 315 * @return EOK on success or negative error code. 316 */ 317 int devman_remove_function(devman_handle_t funh) 318 { 319 async_exch_t *exch; 320 sysarg_t retval; 321 322 exch = devman_exchange_begin_blocking(DEVMAN_DRIVER); 323 retval = async_req_1_0(exch, DEVMAN_REMOVE_FUNCTION, (sysarg_t) funh); 324 devman_exchange_end(exch); 325 326 return (int) retval; 327 } 328 310 329 async_sess_t *devman_parent_device_connect(exch_mgmt_t mgmt, 311 330 devman_handle_t handle, unsigned int flags) … … 333 352 exch = devman_exchange_begin(DEVMAN_CLIENT); 334 353 if (exch == NULL) 335 return errno;354 return ENOMEM; 336 355 } 337 356 … … 364 383 } 365 384 366 int devman_device_get_handle_by_class(const char *classname,367 const char *devname, devman_handle_t *handle, unsigned int flags)368 {369 async_exch_t *exch;370 371 if (flags & IPC_FLAG_BLOCKING)372 exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);373 else {374 exch = devman_exchange_begin(DEVMAN_CLIENT);375 if (exch == NULL)376 return errno;377 }378 379 ipc_call_t answer;380 aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,381 flags, &answer);382 sysarg_t retval = async_data_write_start(exch, classname,383 str_size(classname));384 385 if (retval != EOK) {386 devman_exchange_end(exch);387 async_wait_for(req, NULL);388 return retval;389 }390 391 retval = async_data_write_start(exch, devname,392 str_size(devname));393 394 devman_exchange_end(exch);395 396 if (retval != EOK) {397 async_wait_for(req, NULL);398 return retval;399 }400 401 async_wait_for(req, &retval);402 403 if (retval != EOK) {404 if (handle != NULL)405 *handle = (devman_handle_t) -1;406 407 return retval;408 }409 410 if (handle != NULL)411 *handle = (devman_handle_t) IPC_GET_ARG1(answer);412 413 return retval;414 }415 416 385 int devman_get_device_path(devman_handle_t handle, char *path, size_t path_size) 417 386 { 418 387 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT); 419 388 if (exch == NULL) 420 return errno;389 return ENOMEM; 421 390 422 391 ipc_call_t answer; … … 463 432 } 464 433 434 int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle) 435 { 436 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT); 437 if (exch == NULL) 438 return ENOMEM; 439 440 sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE, 441 sid, handle); 442 443 devman_exchange_end(exch); 444 return (int) retval; 445 } 446 465 447 /** @} 466 448 */ -
uspace/lib/c/generic/io/io.c
rd894fbd r903bac0a 45 45 #include <vfs/vfs.h> 46 46 #include <vfs/vfs_sess.h> 47 #include <ipc/ devmap.h>47 #include <ipc/loc.h> 48 48 #include <adt/list.h> 49 49 #include "../private/io.h" -
uspace/lib/c/generic/vfs/vfs.c
rd894fbd r903bac0a 51 51 #include <assert.h> 52 52 #include <str.h> 53 #include < devmap.h>53 #include <loc.h> 54 54 #include <ipc/vfs.h> 55 #include <ipc/ devmap.h>55 #include <ipc/loc.h> 56 56 57 57 static FIBRIL_MUTEX_INITIALIZE(vfs_mutex); … … 142 142 } 143 143 144 int mount(const char *fs_name, const char *mp, const char *fq dn,144 int mount(const char *fs_name, const char *mp, const char *fqsn, 145 145 const char *opts, unsigned int flags) 146 146 { 147 147 int null_id = -1; 148 char null[ DEVMAP_NAME_MAXLEN];149 150 if (str_cmp(fq dn, "") == 0) {148 char null[LOC_NAME_MAXLEN]; 149 150 if (str_cmp(fqsn, "") == 0) { 151 151 /* No device specified, create a fresh 152 152 null/%d device instead */ 153 null_id = devmap_null_create();153 null_id = loc_null_create(); 154 154 155 155 if (null_id == -1) 156 156 return ENOMEM; 157 157 158 snprintf(null, DEVMAP_NAME_MAXLEN, "null/%d", null_id);159 fq dn = null;160 } 161 162 devmap_handle_t devmap_handle;163 int res = devmap_device_get_handle(fqdn, &devmap_handle, flags);158 snprintf(null, LOC_NAME_MAXLEN, "null/%d", null_id); 159 fqsn = null; 160 } 161 162 service_id_t service_id; 163 int res = loc_service_get_id(fqsn, &service_id, flags); 164 164 if (res != EOK) { 165 165 if (null_id != -1) 166 devmap_null_destroy(null_id);166 loc_null_destroy(null_id); 167 167 168 168 return res; … … 173 173 if (!mpa) { 174 174 if (null_id != -1) 175 devmap_null_destroy(null_id);175 loc_null_destroy(null_id); 176 176 177 177 return ENOMEM; … … 181 181 182 182 sysarg_t rc_orig; 183 aid_t req = async_send_2(exch, VFS_IN_MOUNT, devmap_handle, flags, NULL);183 aid_t req = async_send_2(exch, VFS_IN_MOUNT, service_id, flags, NULL); 184 184 sysarg_t rc = async_data_write_start(exch, (void *) mpa, mpa_size); 185 185 if (rc != EOK) { … … 189 189 190 190 if (null_id != -1) 191 devmap_null_destroy(null_id);191 loc_null_destroy(null_id); 192 192 193 193 if (rc_orig == EOK) … … 204 204 205 205 if (null_id != -1) 206 devmap_null_destroy(null_id);206 loc_null_destroy(null_id); 207 207 208 208 if (rc_orig == EOK) … … 219 219 220 220 if (null_id != -1) 221 devmap_null_destroy(null_id);221 loc_null_destroy(null_id); 222 222 223 223 if (rc_orig == EOK) … … 235 235 236 236 if (null_id != -1) 237 devmap_null_destroy(null_id);237 loc_null_destroy(null_id); 238 238 239 239 if (rc_orig == EOK) … … 248 248 249 249 if ((rc != EOK) && (null_id != -1)) 250 devmap_null_destroy(null_id);250 loc_null_destroy(null_id); 251 251 252 252 return (int) rc; … … 792 792 } 793 793 794 if (!stat. device) {794 if (!stat.service) { 795 795 errno = ENOENT; 796 796 return NULL; 797 797 } 798 798 799 return devmap_device_connect(mgmt, stat.device, 0);799 return loc_service_connect(mgmt, stat.service, 0); 800 800 } 801 801
Note:
See TracChangeset
for help on using the changeset viewer.