Changeset 5a6cc679 in mainline for uspace/drv/block/usbmast/main.c
- Timestamp:
- 2018-01-31T02:21:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a0a9cc2
- Parents:
- 132ab5d1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/usbmast/main.c
r132ab5d1 r5a6cc679 77 77 }; 78 78 79 static int usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun);79 static errno_t usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun); 80 80 static void usbmast_bd_connection(ipc_callid_t iid, ipc_call_t *icall, 81 81 void *arg); 82 82 83 static int usbmast_bd_open(bd_srvs_t *, bd_srv_t *);84 static int usbmast_bd_close(bd_srv_t *);85 static int usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);86 static int usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);87 static int usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);88 static int usbmast_bd_get_block_size(bd_srv_t *, size_t *);89 static int usbmast_bd_get_num_blocks(bd_srv_t *, aoff64_t *);83 static errno_t usbmast_bd_open(bd_srvs_t *, bd_srv_t *); 84 static errno_t usbmast_bd_close(bd_srv_t *); 85 static errno_t usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); 86 static errno_t usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t); 87 static errno_t usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t); 88 static errno_t usbmast_bd_get_block_size(bd_srv_t *, size_t *); 89 static errno_t usbmast_bd_get_num_blocks(bd_srv_t *, aoff64_t *); 90 90 91 91 static bd_ops_t usbmast_bd_ops = { … … 109 109 * @return Error code. 110 110 */ 111 static int usbmast_device_gone(usb_device_t *dev)111 static errno_t usbmast_device_gone(usb_device_t *dev) 112 112 { 113 113 usbmast_dev_t *mdev = usb_device_data_get(dev); … … 115 115 116 116 for (size_t i = 0; i < mdev->lun_count; ++i) { 117 const int rc = ddf_fun_unbind(mdev->luns[i]);117 const errno_t rc = ddf_fun_unbind(mdev->luns[i]); 118 118 if (rc != EOK) { 119 119 usb_log_error("Failed to unbind LUN function %zu: " … … 133 133 * @return Error code. 134 134 */ 135 static int usbmast_device_remove(usb_device_t *dev)135 static errno_t usbmast_device_remove(usb_device_t *dev) 136 136 { 137 137 //TODO: flush buffers, or whatever. … … 145 145 * @return Error code. 146 146 */ 147 static int usbmast_device_add(usb_device_t *dev)148 { 149 int rc;147 static errno_t usbmast_device_add(usb_device_t *dev) 148 { 149 errno_t rc; 150 150 usbmast_dev_t *mdev = NULL; 151 151 unsigned i; … … 198 198 if (mdev->luns[i] == NULL) 199 199 continue; 200 const int rc = ddf_fun_unbind(mdev->luns[i]);200 const errno_t rc = ddf_fun_unbind(mdev->luns[i]); 201 201 if (rc != EOK) { 202 202 usb_log_warning("Failed to unbind LUN function %zu: " … … 217 217 * @return EOK on success or an error code. 218 218 */ 219 static int usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun)220 { 221 int rc;219 static errno_t usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun) 220 { 221 errno_t rc; 222 222 char *fun_name = NULL; 223 223 ddf_fun_t *fun = NULL; … … 326 326 327 327 /** Open device. */ 328 static int usbmast_bd_open(bd_srvs_t *bds, bd_srv_t *bd)328 static errno_t usbmast_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 329 329 { 330 330 return EOK; … … 332 332 333 333 /** Close device. */ 334 static int usbmast_bd_close(bd_srv_t *bd)334 static errno_t usbmast_bd_close(bd_srv_t *bd) 335 335 { 336 336 return EOK; … … 338 338 339 339 /** Read blocks from the device. */ 340 static int usbmast_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,340 static errno_t usbmast_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf, 341 341 size_t size) 342 342 { … … 350 350 351 351 /** Synchronize blocks to nonvolatile storage. */ 352 static int usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)352 static errno_t usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt) 353 353 { 354 354 usbmast_fun_t *mfun = bd_srv_usbmast(bd); … … 358 358 359 359 /** Write blocks to the device. */ 360 static int usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,360 static errno_t usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, 361 361 const void *buf, size_t size) 362 362 { … … 370 370 371 371 /** Get device block size. */ 372 static int usbmast_bd_get_block_size(bd_srv_t *bd, size_t *rsize)372 static errno_t usbmast_bd_get_block_size(bd_srv_t *bd, size_t *rsize) 373 373 { 374 374 usbmast_fun_t *mfun = bd_srv_usbmast(bd); … … 378 378 379 379 /** Get number of blocks on device. */ 380 static int usbmast_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)380 static errno_t usbmast_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb) 381 381 { 382 382 usbmast_fun_t *mfun = bd_srv_usbmast(bd);
Note:
See TracChangeset
for help on using the changeset viewer.