Changes in uspace/drv/bus/usb/usbmast/scsi_ms.c [dd8b6a8:acdb5bac] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/scsi_ms.c
rdd8b6a8 racdb5bac 383 383 } 384 384 385 /** Perform SCSI Synchronize Cache command on USB mass storage device.386 *387 * @param mfun Mass storage function388 * @param ba Address of first block389 * @param nblocks Number of blocks to read390 * @param data Data to write391 *392 * @return Error code393 */394 int usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)395 {396 scsi_cmd_t cmd;397 scsi_cdb_sync_cache_10_t cdb;398 int rc;399 400 if (ba > UINT32_MAX)401 return ELIMIT;402 403 if (nblocks > UINT16_MAX)404 return ELIMIT;405 406 memset(&cdb, 0, sizeof(cdb));407 cdb.op_code = SCSI_CMD_SYNC_CACHE_10;408 cdb.lba = host2uint32_t_be(ba);409 cdb.numlb = host2uint16_t_be(nblocks);410 411 memset(&cmd, 0, sizeof(cmd));412 cmd.cdb = &cdb;413 cmd.cdb_size = sizeof(cdb);414 415 rc = usbmast_run_cmd(mfun, &cmd);416 417 if (rc != EOK) {418 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.\n",419 ddf_dev_get_name(mfun->mdev->ddf_dev), str_error(rc));420 return rc;421 }422 423 if (cmd.status != CMDS_GOOD) {424 usb_log_error("Synchronize Cache (10) command failed, device %s.\n",425 ddf_dev_get_name(mfun->mdev->ddf_dev));426 return EIO;427 }428 429 return EOK;430 }431 432 385 /** 433 386 * @}
Note:
See TracChangeset
for help on using the changeset viewer.