diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2010-10-07 08:46:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:22:07 -0400 |
commit | 0a6a717ceff67f887b16783ce891f5dcf846f1fc (patch) | |
tree | 0c8ed32e970e9cbbb4cc64981cba9ae2694f6377 /drivers/usb/gadget/file_storage.c | |
parent | 0a2b8a0d1101179fdebc974a7c72b514aede9d9d (diff) |
USB: gadget: storage: reuse definitions from scsi.h header file
This commit changes storage_common.h, file_storage.c and
f_mass_storage.c to use definitions of SCSI commands from
scsi/scsi.h file instead of redefining the commands in
storage_common.c.
scsi/scsi.h header file was missing READ_FORMAT_CAPACITIES and
READ_HEADER so this commit also add those to the header.
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/file_storage.c')
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index ce437f5dd674..d4fdf65fb925 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -783,7 +783,7 @@ static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) | |||
783 | { | 783 | { |
784 | struct usb_request *req = fsg->ep0req; | 784 | struct usb_request *req = fsg->ep0req; |
785 | static u8 cbi_reset_cmnd[6] = { | 785 | static u8 cbi_reset_cmnd[6] = { |
786 | SC_SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff}; | 786 | SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff}; |
787 | 787 | ||
788 | /* Error in command transfer? */ | 788 | /* Error in command transfer? */ |
789 | if (req->status || req->length != req->actual || | 789 | if (req->status || req->length != req->actual || |
@@ -1135,7 +1135,7 @@ static int do_read(struct fsg_dev *fsg) | |||
1135 | 1135 | ||
1136 | /* Get the starting Logical Block Address and check that it's | 1136 | /* Get the starting Logical Block Address and check that it's |
1137 | * not too big */ | 1137 | * not too big */ |
1138 | if (fsg->cmnd[0] == SC_READ_6) | 1138 | if (fsg->cmnd[0] == READ_6) |
1139 | lba = get_unaligned_be24(&fsg->cmnd[1]); | 1139 | lba = get_unaligned_be24(&fsg->cmnd[1]); |
1140 | else { | 1140 | else { |
1141 | lba = get_unaligned_be32(&fsg->cmnd[2]); | 1141 | lba = get_unaligned_be32(&fsg->cmnd[2]); |
@@ -1270,7 +1270,7 @@ static int do_write(struct fsg_dev *fsg) | |||
1270 | 1270 | ||
1271 | /* Get the starting Logical Block Address and check that it's | 1271 | /* Get the starting Logical Block Address and check that it's |
1272 | * not too big */ | 1272 | * not too big */ |
1273 | if (fsg->cmnd[0] == SC_WRITE_6) | 1273 | if (fsg->cmnd[0] == WRITE_6) |
1274 | lba = get_unaligned_be24(&fsg->cmnd[1]); | 1274 | lba = get_unaligned_be24(&fsg->cmnd[1]); |
1275 | else { | 1275 | else { |
1276 | lba = get_unaligned_be32(&fsg->cmnd[2]); | 1276 | lba = get_unaligned_be32(&fsg->cmnd[2]); |
@@ -1578,7 +1578,7 @@ static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh) | |||
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | memset(buf, 0, 8); | 1580 | memset(buf, 0, 8); |
1581 | buf[0] = (mod_data.cdrom ? TYPE_CDROM : TYPE_DISK); | 1581 | buf[0] = (mod_data.cdrom ? TYPE_ROM : TYPE_DISK); |
1582 | if (mod_data.removable) | 1582 | if (mod_data.removable) |
1583 | buf[1] = 0x80; | 1583 | buf[1] = 0x80; |
1584 | buf[2] = 2; // ANSI SCSI level 2 | 1584 | buf[2] = 2; // ANSI SCSI level 2 |
@@ -1747,11 +1747,11 @@ static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) | |||
1747 | * The only variable value is the WriteProtect bit. We will fill in | 1747 | * The only variable value is the WriteProtect bit. We will fill in |
1748 | * the mode data length later. */ | 1748 | * the mode data length later. */ |
1749 | memset(buf, 0, 8); | 1749 | memset(buf, 0, 8); |
1750 | if (mscmnd == SC_MODE_SENSE_6) { | 1750 | if (mscmnd == MODE_SENSE) { |
1751 | buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA | 1751 | buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA |
1752 | buf += 4; | 1752 | buf += 4; |
1753 | limit = 255; | 1753 | limit = 255; |
1754 | } else { // SC_MODE_SENSE_10 | 1754 | } else { // MODE_SENSE_10 |
1755 | buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA | 1755 | buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA |
1756 | buf += 8; | 1756 | buf += 8; |
1757 | limit = 65535; // Should really be mod_data.buflen | 1757 | limit = 65535; // Should really be mod_data.buflen |
@@ -1791,7 +1791,7 @@ static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) | |||
1791 | } | 1791 | } |
1792 | 1792 | ||
1793 | /* Store the mode data length */ | 1793 | /* Store the mode data length */ |
1794 | if (mscmnd == SC_MODE_SENSE_6) | 1794 | if (mscmnd == MODE_SENSE) |
1795 | buf0[0] = len - 1; | 1795 | buf0[0] = len - 1; |
1796 | else | 1796 | else |
1797 | put_unaligned_be16(len - 2, buf0); | 1797 | put_unaligned_be16(len - 2, buf0); |
@@ -2316,7 +2316,7 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size, | |||
2316 | /* Check the LUN */ | 2316 | /* Check the LUN */ |
2317 | if (fsg->lun >= 0 && fsg->lun < fsg->nluns) { | 2317 | if (fsg->lun >= 0 && fsg->lun < fsg->nluns) { |
2318 | fsg->curlun = curlun = &fsg->luns[fsg->lun]; | 2318 | fsg->curlun = curlun = &fsg->luns[fsg->lun]; |
2319 | if (fsg->cmnd[0] != SC_REQUEST_SENSE) { | 2319 | if (fsg->cmnd[0] != REQUEST_SENSE) { |
2320 | curlun->sense_data = SS_NO_SENSE; | 2320 | curlun->sense_data = SS_NO_SENSE; |
2321 | curlun->sense_data_info = 0; | 2321 | curlun->sense_data_info = 0; |
2322 | curlun->info_valid = 0; | 2322 | curlun->info_valid = 0; |
@@ -2327,8 +2327,8 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size, | |||
2327 | 2327 | ||
2328 | /* INQUIRY and REQUEST SENSE commands are explicitly allowed | 2328 | /* INQUIRY and REQUEST SENSE commands are explicitly allowed |
2329 | * to use unsupported LUNs; all others may not. */ | 2329 | * to use unsupported LUNs; all others may not. */ |
2330 | if (fsg->cmnd[0] != SC_INQUIRY && | 2330 | if (fsg->cmnd[0] != INQUIRY && |
2331 | fsg->cmnd[0] != SC_REQUEST_SENSE) { | 2331 | fsg->cmnd[0] != REQUEST_SENSE) { |
2332 | DBG(fsg, "unsupported LUN %d\n", fsg->lun); | 2332 | DBG(fsg, "unsupported LUN %d\n", fsg->lun); |
2333 | return -EINVAL; | 2333 | return -EINVAL; |
2334 | } | 2334 | } |
@@ -2337,8 +2337,8 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size, | |||
2337 | /* If a unit attention condition exists, only INQUIRY and | 2337 | /* If a unit attention condition exists, only INQUIRY and |
2338 | * REQUEST SENSE commands are allowed; anything else must fail. */ | 2338 | * REQUEST SENSE commands are allowed; anything else must fail. */ |
2339 | if (curlun && curlun->unit_attention_data != SS_NO_SENSE && | 2339 | if (curlun && curlun->unit_attention_data != SS_NO_SENSE && |
2340 | fsg->cmnd[0] != SC_INQUIRY && | 2340 | fsg->cmnd[0] != INQUIRY && |
2341 | fsg->cmnd[0] != SC_REQUEST_SENSE) { | 2341 | fsg->cmnd[0] != REQUEST_SENSE) { |
2342 | curlun->sense_data = curlun->unit_attention_data; | 2342 | curlun->sense_data = curlun->unit_attention_data; |
2343 | curlun->unit_attention_data = SS_NO_SENSE; | 2343 | curlun->unit_attention_data = SS_NO_SENSE; |
2344 | return -EINVAL; | 2344 | return -EINVAL; |
@@ -2388,7 +2388,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2388 | down_read(&fsg->filesem); // We're using the backing file | 2388 | down_read(&fsg->filesem); // We're using the backing file |
2389 | switch (fsg->cmnd[0]) { | 2389 | switch (fsg->cmnd[0]) { |
2390 | 2390 | ||
2391 | case SC_INQUIRY: | 2391 | case INQUIRY: |
2392 | fsg->data_size_from_cmnd = fsg->cmnd[4]; | 2392 | fsg->data_size_from_cmnd = fsg->cmnd[4]; |
2393 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, | 2393 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, |
2394 | (1<<4), 0, | 2394 | (1<<4), 0, |
@@ -2396,7 +2396,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2396 | reply = do_inquiry(fsg, bh); | 2396 | reply = do_inquiry(fsg, bh); |
2397 | break; | 2397 | break; |
2398 | 2398 | ||
2399 | case SC_MODE_SELECT_6: | 2399 | case MODE_SELECT: |
2400 | fsg->data_size_from_cmnd = fsg->cmnd[4]; | 2400 | fsg->data_size_from_cmnd = fsg->cmnd[4]; |
2401 | if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, | 2401 | if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, |
2402 | (1<<1) | (1<<4), 0, | 2402 | (1<<1) | (1<<4), 0, |
@@ -2404,7 +2404,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2404 | reply = do_mode_select(fsg, bh); | 2404 | reply = do_mode_select(fsg, bh); |
2405 | break; | 2405 | break; |
2406 | 2406 | ||
2407 | case SC_MODE_SELECT_10: | 2407 | case MODE_SELECT_10: |
2408 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); | 2408 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); |
2409 | if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, | 2409 | if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, |
2410 | (1<<1) | (3<<7), 0, | 2410 | (1<<1) | (3<<7), 0, |
@@ -2412,7 +2412,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2412 | reply = do_mode_select(fsg, bh); | 2412 | reply = do_mode_select(fsg, bh); |
2413 | break; | 2413 | break; |
2414 | 2414 | ||
2415 | case SC_MODE_SENSE_6: | 2415 | case MODE_SENSE: |
2416 | fsg->data_size_from_cmnd = fsg->cmnd[4]; | 2416 | fsg->data_size_from_cmnd = fsg->cmnd[4]; |
2417 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, | 2417 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, |
2418 | (1<<1) | (1<<2) | (1<<4), 0, | 2418 | (1<<1) | (1<<2) | (1<<4), 0, |
@@ -2420,7 +2420,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2420 | reply = do_mode_sense(fsg, bh); | 2420 | reply = do_mode_sense(fsg, bh); |
2421 | break; | 2421 | break; |
2422 | 2422 | ||
2423 | case SC_MODE_SENSE_10: | 2423 | case MODE_SENSE_10: |
2424 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); | 2424 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); |
2425 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, | 2425 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, |
2426 | (1<<1) | (1<<2) | (3<<7), 0, | 2426 | (1<<1) | (1<<2) | (3<<7), 0, |
@@ -2428,7 +2428,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2428 | reply = do_mode_sense(fsg, bh); | 2428 | reply = do_mode_sense(fsg, bh); |
2429 | break; | 2429 | break; |
2430 | 2430 | ||
2431 | case SC_PREVENT_ALLOW_MEDIUM_REMOVAL: | 2431 | case ALLOW_MEDIUM_REMOVAL: |
2432 | fsg->data_size_from_cmnd = 0; | 2432 | fsg->data_size_from_cmnd = 0; |
2433 | if ((reply = check_command(fsg, 6, DATA_DIR_NONE, | 2433 | if ((reply = check_command(fsg, 6, DATA_DIR_NONE, |
2434 | (1<<4), 0, | 2434 | (1<<4), 0, |
@@ -2436,7 +2436,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2436 | reply = do_prevent_allow(fsg); | 2436 | reply = do_prevent_allow(fsg); |
2437 | break; | 2437 | break; |
2438 | 2438 | ||
2439 | case SC_READ_6: | 2439 | case READ_6: |
2440 | i = fsg->cmnd[4]; | 2440 | i = fsg->cmnd[4]; |
2441 | fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; | 2441 | fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; |
2442 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, | 2442 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, |
@@ -2445,7 +2445,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2445 | reply = do_read(fsg); | 2445 | reply = do_read(fsg); |
2446 | break; | 2446 | break; |
2447 | 2447 | ||
2448 | case SC_READ_10: | 2448 | case READ_10: |
2449 | fsg->data_size_from_cmnd = | 2449 | fsg->data_size_from_cmnd = |
2450 | get_unaligned_be16(&fsg->cmnd[7]) << 9; | 2450 | get_unaligned_be16(&fsg->cmnd[7]) << 9; |
2451 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, | 2451 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, |
@@ -2454,7 +2454,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2454 | reply = do_read(fsg); | 2454 | reply = do_read(fsg); |
2455 | break; | 2455 | break; |
2456 | 2456 | ||
2457 | case SC_READ_12: | 2457 | case READ_12: |
2458 | fsg->data_size_from_cmnd = | 2458 | fsg->data_size_from_cmnd = |
2459 | get_unaligned_be32(&fsg->cmnd[6]) << 9; | 2459 | get_unaligned_be32(&fsg->cmnd[6]) << 9; |
2460 | if ((reply = check_command(fsg, 12, DATA_DIR_TO_HOST, | 2460 | if ((reply = check_command(fsg, 12, DATA_DIR_TO_HOST, |
@@ -2463,7 +2463,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2463 | reply = do_read(fsg); | 2463 | reply = do_read(fsg); |
2464 | break; | 2464 | break; |
2465 | 2465 | ||
2466 | case SC_READ_CAPACITY: | 2466 | case READ_CAPACITY: |
2467 | fsg->data_size_from_cmnd = 8; | 2467 | fsg->data_size_from_cmnd = 8; |
2468 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, | 2468 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, |
2469 | (0xf<<2) | (1<<8), 1, | 2469 | (0xf<<2) | (1<<8), 1, |
@@ -2471,7 +2471,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2471 | reply = do_read_capacity(fsg, bh); | 2471 | reply = do_read_capacity(fsg, bh); |
2472 | break; | 2472 | break; |
2473 | 2473 | ||
2474 | case SC_READ_HEADER: | 2474 | case READ_HEADER: |
2475 | if (!mod_data.cdrom) | 2475 | if (!mod_data.cdrom) |
2476 | goto unknown_cmnd; | 2476 | goto unknown_cmnd; |
2477 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); | 2477 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); |
@@ -2481,7 +2481,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2481 | reply = do_read_header(fsg, bh); | 2481 | reply = do_read_header(fsg, bh); |
2482 | break; | 2482 | break; |
2483 | 2483 | ||
2484 | case SC_READ_TOC: | 2484 | case READ_TOC: |
2485 | if (!mod_data.cdrom) | 2485 | if (!mod_data.cdrom) |
2486 | goto unknown_cmnd; | 2486 | goto unknown_cmnd; |
2487 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); | 2487 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); |
@@ -2491,7 +2491,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2491 | reply = do_read_toc(fsg, bh); | 2491 | reply = do_read_toc(fsg, bh); |
2492 | break; | 2492 | break; |
2493 | 2493 | ||
2494 | case SC_READ_FORMAT_CAPACITIES: | 2494 | case READ_FORMAT_CAPACITIES: |
2495 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); | 2495 | fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); |
2496 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, | 2496 | if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, |
2497 | (3<<7), 1, | 2497 | (3<<7), 1, |
@@ -2499,7 +2499,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2499 | reply = do_read_format_capacities(fsg, bh); | 2499 | reply = do_read_format_capacities(fsg, bh); |
2500 | break; | 2500 | break; |
2501 | 2501 | ||
2502 | case SC_REQUEST_SENSE: | 2502 | case REQUEST_SENSE: |
2503 | fsg->data_size_from_cmnd = fsg->cmnd[4]; | 2503 | fsg->data_size_from_cmnd = fsg->cmnd[4]; |
2504 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, | 2504 | if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, |
2505 | (1<<4), 0, | 2505 | (1<<4), 0, |
@@ -2507,7 +2507,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2507 | reply = do_request_sense(fsg, bh); | 2507 | reply = do_request_sense(fsg, bh); |
2508 | break; | 2508 | break; |
2509 | 2509 | ||
2510 | case SC_START_STOP_UNIT: | 2510 | case START_STOP: |
2511 | fsg->data_size_from_cmnd = 0; | 2511 | fsg->data_size_from_cmnd = 0; |
2512 | if ((reply = check_command(fsg, 6, DATA_DIR_NONE, | 2512 | if ((reply = check_command(fsg, 6, DATA_DIR_NONE, |
2513 | (1<<1) | (1<<4), 0, | 2513 | (1<<1) | (1<<4), 0, |
@@ -2515,7 +2515,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2515 | reply = do_start_stop(fsg); | 2515 | reply = do_start_stop(fsg); |
2516 | break; | 2516 | break; |
2517 | 2517 | ||
2518 | case SC_SYNCHRONIZE_CACHE: | 2518 | case SYNCHRONIZE_CACHE: |
2519 | fsg->data_size_from_cmnd = 0; | 2519 | fsg->data_size_from_cmnd = 0; |
2520 | if ((reply = check_command(fsg, 10, DATA_DIR_NONE, | 2520 | if ((reply = check_command(fsg, 10, DATA_DIR_NONE, |
2521 | (0xf<<2) | (3<<7), 1, | 2521 | (0xf<<2) | (3<<7), 1, |
@@ -2523,7 +2523,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2523 | reply = do_synchronize_cache(fsg); | 2523 | reply = do_synchronize_cache(fsg); |
2524 | break; | 2524 | break; |
2525 | 2525 | ||
2526 | case SC_TEST_UNIT_READY: | 2526 | case TEST_UNIT_READY: |
2527 | fsg->data_size_from_cmnd = 0; | 2527 | fsg->data_size_from_cmnd = 0; |
2528 | reply = check_command(fsg, 6, DATA_DIR_NONE, | 2528 | reply = check_command(fsg, 6, DATA_DIR_NONE, |
2529 | 0, 1, | 2529 | 0, 1, |
@@ -2532,7 +2532,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2532 | 2532 | ||
2533 | /* Although optional, this command is used by MS-Windows. We | 2533 | /* Although optional, this command is used by MS-Windows. We |
2534 | * support a minimal version: BytChk must be 0. */ | 2534 | * support a minimal version: BytChk must be 0. */ |
2535 | case SC_VERIFY: | 2535 | case VERIFY: |
2536 | fsg->data_size_from_cmnd = 0; | 2536 | fsg->data_size_from_cmnd = 0; |
2537 | if ((reply = check_command(fsg, 10, DATA_DIR_NONE, | 2537 | if ((reply = check_command(fsg, 10, DATA_DIR_NONE, |
2538 | (1<<1) | (0xf<<2) | (3<<7), 1, | 2538 | (1<<1) | (0xf<<2) | (3<<7), 1, |
@@ -2540,7 +2540,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2540 | reply = do_verify(fsg); | 2540 | reply = do_verify(fsg); |
2541 | break; | 2541 | break; |
2542 | 2542 | ||
2543 | case SC_WRITE_6: | 2543 | case WRITE_6: |
2544 | i = fsg->cmnd[4]; | 2544 | i = fsg->cmnd[4]; |
2545 | fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; | 2545 | fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; |
2546 | if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, | 2546 | if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, |
@@ -2549,7 +2549,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2549 | reply = do_write(fsg); | 2549 | reply = do_write(fsg); |
2550 | break; | 2550 | break; |
2551 | 2551 | ||
2552 | case SC_WRITE_10: | 2552 | case WRITE_10: |
2553 | fsg->data_size_from_cmnd = | 2553 | fsg->data_size_from_cmnd = |
2554 | get_unaligned_be16(&fsg->cmnd[7]) << 9; | 2554 | get_unaligned_be16(&fsg->cmnd[7]) << 9; |
2555 | if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, | 2555 | if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, |
@@ -2558,7 +2558,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2558 | reply = do_write(fsg); | 2558 | reply = do_write(fsg); |
2559 | break; | 2559 | break; |
2560 | 2560 | ||
2561 | case SC_WRITE_12: | 2561 | case WRITE_12: |
2562 | fsg->data_size_from_cmnd = | 2562 | fsg->data_size_from_cmnd = |
2563 | get_unaligned_be32(&fsg->cmnd[6]) << 9; | 2563 | get_unaligned_be32(&fsg->cmnd[6]) << 9; |
2564 | if ((reply = check_command(fsg, 12, DATA_DIR_FROM_HOST, | 2564 | if ((reply = check_command(fsg, 12, DATA_DIR_FROM_HOST, |
@@ -2571,10 +2571,10 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2571 | * They don't mean much in this setting. It's left as an exercise | 2571 | * They don't mean much in this setting. It's left as an exercise |
2572 | * for anyone interested to implement RESERVE and RELEASE in terms | 2572 | * for anyone interested to implement RESERVE and RELEASE in terms |
2573 | * of Posix locks. */ | 2573 | * of Posix locks. */ |
2574 | case SC_FORMAT_UNIT: | 2574 | case FORMAT_UNIT: |
2575 | case SC_RELEASE: | 2575 | case RELEASE: |
2576 | case SC_RESERVE: | 2576 | case RESERVE: |
2577 | case SC_SEND_DIAGNOSTIC: | 2577 | case SEND_DIAGNOSTIC: |
2578 | // Fall through | 2578 | // Fall through |
2579 | 2579 | ||
2580 | default: | 2580 | default: |