- switch (idetape_command_key) {
- case IDETAPE_TEST_UNIT_READY_CMD:
- return("TEST_UNIT_READY_CMD");
- case IDETAPE_REWIND_CMD:
- return("REWIND_CMD");
- case IDETAPE_REQUEST_SENSE_CMD:
- return("REQUEST_SENSE_CMD");
- case IDETAPE_READ_CMD:
- return("READ_CMD");
- case IDETAPE_WRITE_CMD:
- return("WRITE_CMD");
- case IDETAPE_WRITE_FILEMARK_CMD:
- return("WRITE_FILEMARK_CMD");
- case IDETAPE_SPACE_CMD:
- return("SPACE_CMD");
- case IDETAPE_INQUIRY_CMD:
- return("INQUIRY_CMD");
- case IDETAPE_ERASE_CMD:
- return("ERASE_CMD");
- case IDETAPE_MODE_SENSE_CMD:
- return("MODE_SENSE_CMD");
- case IDETAPE_MODE_SELECT_CMD:
- return("MODE_SELECT_CMD");
- case IDETAPE_LOAD_UNLOAD_CMD:
- return("LOAD_UNLOAD_CMD");
- case IDETAPE_PREVENT_CMD:
- return("PREVENT_CMD");
- case IDETAPE_LOCATE_CMD:
- return("LOCATE_CMD");
- case IDETAPE_READ_POSITION_CMD:
- return("READ_POSITION_CMD");
- case IDETAPE_READ_BUFFER_CMD:
- return("READ_BUFFER_CMD");
- case IDETAPE_SET_SPEED_CMD:
- return("SET_SPEED_CMD");
- default: {
- char buf[20];
- sprintf(buf, "CMD (0x%02x)", idetape_command_key);
- return(buf);
- }
- }
+ struct ide_tape_obj *tape = NULL;
+
+ mutex_lock(&idetape_ref_mutex);
+ tape = idetape_devs[i];
+ if (tape)
+ kref_get(&tape->kref);
+ mutex_unlock(&idetape_ref_mutex);
+ return tape;