--- pt.c Thu Jun 14 17:27:26 2001 +++ pt.c.working Thu Jun 14 17:08:34 2001 @@ -208,6 +208,13 @@ #define ATAPI_IDENTIFY 0x12 #define ATAPI_MODE_SENSE 0x1a #define ATAPI_LOG_SENSE 0x4d +#define ATAPI_ERASE 0x19 +#define ATAPI_UNLOAD 0x1b +#define ATAPI_LOCATE 0x2b +#define ATAPI_LOG_SELECT 0x4c +#define ATAPI_MODE_SELECT 0x15 +#define ATAPI_READ_POS 0x34 +#define ATAPI_SPACE 0x11 int pt_init(void); #ifdef MODULE @@ -520,6 +527,57 @@ pt_media_access_cmd(unit,PT_TMO,wm_cmd,"write filemark"); } +static void pt_erase( int unit ) + +{ char erase_cmd[12] = {ATAPI_ERASE,0,0,0,0,0,0,0,0,0,0,0}; + + pt_media_access_cmd(unit,PT_TMO,erase_cmd,"erase"); +} + +static void pt_unload( int unit ) + +{ char unload_cmd[12] = {ATAPI_UNLOAD,0,0,0,0,0,0,0,0,0,0,0}; + + pt_media_access_cmd(unit,PT_TMO,unload_cmd,"unload"); +} + +static void pt_reten( int unit ) + +{ char reten_cmd[12] = {ATAPI_UNLOAD,0,0,0,3,0,0,0,0,0,0,0}; + + pt_media_access_cmd(unit,PT_TMO,reten_cmd,"retension"); +} + +static void pt_load( int unit ) + +{ char load_cmd[12] = {ATAPI_UNLOAD,0,0,0,2,0,0,0,0,0,0,0}; + + pt_media_access_cmd(unit,PT_TMO,load_cmd,"load"); +} + +static void pt_eod( int unit ) + +{ char eod_cmd[12] = {ATAPI_SPACE,0x011b,0,0,0,0,0,0,0,0,0,0}; + + pt_media_access_cmd(unit,PT_TMO,eod_cmd,"eod"); +} + +static void pt_fsf( int unit, unsigned long arg ) + +{ char fsf_cmd[12] = {ATAPI_SPACE,0x001b,(arg >> 16),(arg >> 8),arg,0,0,0,0,0,0,0}; + + pt_media_access_cmd(unit,PT_TMO,fsf_cmd,"fsf"); +} + +static void pt_bsf( int unit, unsigned long arg ) + +{ long long_temp = (-arg); + char bsf_cmd[12] = {ATAPI_SPACE,0x001b,(long_temp >> 16),(long_temp >> 8),long_temp,0,0,0,0,0,0,0}; + + pt_media_access_cmd(unit,PT_TMO,bsf_cmd,"bsf"); +} + + #define DBMSG(msg) ((verbose>1)?(msg):NULL) static int pt_reset( int unit ) @@ -752,7 +810,39 @@ case MTREW: pt_rewind(unit); return 0; - + break; + case MTWEOF: + pt_write_fm(unit); + return 0; + break; + case MTERASE: + pt_erase(unit); + return 0; + break; + case MTLOAD: + pt_load(unit); + return 0; + break; + case MTUNLOAD: + pt_unload(unit); + return 0; + break; + case MTRETEN: + pt_reten(unit); + return 0; + break; + case MTEOM: + pt_eod(unit); + return 0; + break; + case MTFSF: + pt_fsf(unit,arg); + return 0; + break; + case MTBSF: + pt_bsf(unit,arg); + return 0; + break; default: printk("%s: Unimplemented mt_op %d\n",PT.name, mtop.mt_op);