Commit 5d5cdc9b authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: cdrom_generic_command split into kernel/user

The kernel instance (packet_command) has kernel pointers, userland one -
__user ones. Surprise.
parent 6e5243cc
...@@ -198,7 +198,7 @@ static int pcd_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn); ...@@ -198,7 +198,7 @@ static int pcd_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn);
static int pcd_audio_ioctl(struct cdrom_device_info *cdi, static int pcd_audio_ioctl(struct cdrom_device_info *cdi,
unsigned int cmd, void *arg); unsigned int cmd, void *arg);
static int pcd_packet(struct cdrom_device_info *cdi, static int pcd_packet(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc); struct packet_command *cgc);
static int pcd_detect(void); static int pcd_detect(void);
static void pcd_probe_capabilities(void); static void pcd_probe_capabilities(void);
...@@ -501,7 +501,7 @@ static int pcd_atapi(struct pcd_unit *cd, char *cmd, int dlen, char *buf, char * ...@@ -501,7 +501,7 @@ static int pcd_atapi(struct pcd_unit *cd, char *cmd, int dlen, char *buf, char *
return r; return r;
} }
static int pcd_packet(struct cdrom_device_info *cdi, struct cdrom_generic_command *cgc) static int pcd_packet(struct cdrom_device_info *cdi, struct packet_command *cgc)
{ {
return pcd_atapi(cdi->handle, cgc->cmd, cgc->buflen, cgc->buffer, return pcd_atapi(cdi->handle, cgc->cmd, cgc->buflen, cgc->buffer,
"generic packet"); "generic packet");
......
...@@ -455,7 +455,7 @@ int unregister_cdrom(struct cdrom_device_info *unreg) ...@@ -455,7 +455,7 @@ int unregister_cdrom(struct cdrom_device_info *unreg)
int cdrom_get_media_event(struct cdrom_device_info *cdi, int cdrom_get_media_event(struct cdrom_device_info *cdi,
struct media_event_desc *med) struct media_event_desc *med)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
unsigned char buffer[8]; unsigned char buffer[8];
struct event_header *eh = (struct event_header *) buffer; struct event_header *eh = (struct event_header *) buffer;
...@@ -482,7 +482,7 @@ int cdrom_get_media_event(struct cdrom_device_info *cdi, ...@@ -482,7 +482,7 @@ int cdrom_get_media_event(struct cdrom_device_info *cdi,
*/ */
int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi) int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
char buffer[16]; char buffer[16];
init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ);
...@@ -503,7 +503,7 @@ int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi) ...@@ -503,7 +503,7 @@ int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write) int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
struct mrw_feature_desc *mfd; struct mrw_feature_desc *mfd;
unsigned char buffer[16]; unsigned char buffer[16];
int ret; int ret;
...@@ -529,7 +529,7 @@ int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write) ...@@ -529,7 +529,7 @@ int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write)
static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont) static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
unsigned char buffer[12]; unsigned char buffer[12];
int ret; int ret;
...@@ -570,7 +570,7 @@ static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont) ...@@ -570,7 +570,7 @@ static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont)
static int cdrom_mrw_bgformat_susp(struct cdrom_device_info *cdi, int immed) static int cdrom_mrw_bgformat_susp(struct cdrom_device_info *cdi, int immed)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE); init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
cgc.cmd[0] = GPCMD_CLOSE_TRACK; cgc.cmd[0] = GPCMD_CLOSE_TRACK;
...@@ -588,7 +588,7 @@ static int cdrom_mrw_bgformat_susp(struct cdrom_device_info *cdi, int immed) ...@@ -588,7 +588,7 @@ static int cdrom_mrw_bgformat_susp(struct cdrom_device_info *cdi, int immed)
static int cdrom_flush_cache(struct cdrom_device_info *cdi) static int cdrom_flush_cache(struct cdrom_device_info *cdi)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE); init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
cgc.cmd[0] = GPCMD_FLUSH_CACHE; cgc.cmd[0] = GPCMD_FLUSH_CACHE;
...@@ -619,7 +619,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi) ...@@ -619,7 +619,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)
static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space) static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
struct mode_page_header *mph; struct mode_page_header *mph;
char buffer[16]; char buffer[16];
int ret, offset, size; int ret, offset, size;
...@@ -649,7 +649,7 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space) ...@@ -649,7 +649,7 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
int cdrom_get_random_writable(struct cdrom_device_info *cdi, int cdrom_get_random_writable(struct cdrom_device_info *cdi,
struct rwrt_feature_desc *rfd) struct rwrt_feature_desc *rfd)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
char buffer[24]; char buffer[24];
struct feature_header *fh; struct feature_header *fh;
int ret; int ret;
...@@ -677,7 +677,7 @@ int cdrom_get_random_writable(struct cdrom_device_info *cdi, ...@@ -677,7 +677,7 @@ int cdrom_get_random_writable(struct cdrom_device_info *cdi,
int cdrom_has_defect_mgt(struct cdrom_device_info *cdi) int cdrom_has_defect_mgt(struct cdrom_device_info *cdi)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
char buffer[16]; char buffer[16];
struct feature_header *fh; struct feature_header *fh;
__u16 *feature_code; __u16 *feature_code;
...@@ -785,7 +785,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi) ...@@ -785,7 +785,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
static int mo_open_write(struct cdrom_device_info *cdi) static int mo_open_write(struct cdrom_device_info *cdi)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
char buffer[255]; char buffer[255];
int ret; int ret;
...@@ -1102,7 +1102,7 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp) ...@@ -1102,7 +1102,7 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
static int cdrom_read_mech_status(struct cdrom_device_info *cdi, static int cdrom_read_mech_status(struct cdrom_device_info *cdi,
struct cdrom_changer_info *buf) struct cdrom_changer_info *buf)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
int length; int length;
...@@ -1185,7 +1185,7 @@ int cdrom_number_of_slots(struct cdrom_device_info *cdi) ...@@ -1185,7 +1185,7 @@ int cdrom_number_of_slots(struct cdrom_device_info *cdi)
/* If SLOT < 0, unload the current slot. Otherwise, try to load SLOT. */ /* If SLOT < 0, unload the current slot. Otherwise, try to load SLOT. */
static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot) static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
cdinfo(CD_CHANGER, "entering cdrom_load_unload()\n"); cdinfo(CD_CHANGER, "entering cdrom_load_unload()\n");
if (cdi->sanyo_slot && slot < 0) if (cdi->sanyo_slot && slot < 0)
...@@ -1384,10 +1384,10 @@ void sanitize_format(union cdrom_addr *addr, ...@@ -1384,10 +1384,10 @@ void sanitize_format(union cdrom_addr *addr,
*curr = requested; *curr = requested;
} }
void init_cdrom_command(struct cdrom_generic_command *cgc, void *buf, int len, void init_cdrom_command(struct packet_command *cgc, void *buf, int len,
int type) int type)
{ {
memset(cgc, 0, sizeof(struct cdrom_generic_command)); memset(cgc, 0, sizeof(struct packet_command));
if (buf) if (buf)
memset(buf, 0, len); memset(buf, 0, len);
cgc->buffer = (char *) buf; cgc->buffer = (char *) buf;
...@@ -1401,7 +1401,7 @@ void init_cdrom_command(struct cdrom_generic_command *cgc, void *buf, int len, ...@@ -1401,7 +1401,7 @@ void init_cdrom_command(struct cdrom_generic_command *cgc, void *buf, int len,
#define copy_key(dest,src) memcpy((dest), (src), sizeof(dvd_key)) #define copy_key(dest,src) memcpy((dest), (src), sizeof(dvd_key))
#define copy_chal(dest,src) memcpy((dest), (src), sizeof(dvd_challenge)) #define copy_chal(dest,src) memcpy((dest), (src), sizeof(dvd_challenge))
static void setup_report_key(struct cdrom_generic_command *cgc, unsigned agid, unsigned type) static void setup_report_key(struct packet_command *cgc, unsigned agid, unsigned type)
{ {
cgc->cmd[0] = GPCMD_REPORT_KEY; cgc->cmd[0] = GPCMD_REPORT_KEY;
cgc->cmd[10] = type | (agid << 6); cgc->cmd[10] = type | (agid << 6);
...@@ -1423,7 +1423,7 @@ static void setup_report_key(struct cdrom_generic_command *cgc, unsigned agid, u ...@@ -1423,7 +1423,7 @@ static void setup_report_key(struct cdrom_generic_command *cgc, unsigned agid, u
cgc->data_direction = CGC_DATA_READ; cgc->data_direction = CGC_DATA_READ;
} }
static void setup_send_key(struct cdrom_generic_command *cgc, unsigned agid, unsigned type) static void setup_send_key(struct packet_command *cgc, unsigned agid, unsigned type)
{ {
cgc->cmd[0] = GPCMD_SEND_KEY; cgc->cmd[0] = GPCMD_SEND_KEY;
cgc->cmd[10] = type | (agid << 6); cgc->cmd[10] = type | (agid << 6);
...@@ -1449,7 +1449,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) ...@@ -1449,7 +1449,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)
{ {
int ret; int ret;
u_char buf[20]; u_char buf[20];
struct cdrom_generic_command cgc; struct packet_command cgc;
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
rpc_state_t rpc_state; rpc_state_t rpc_state;
...@@ -1595,7 +1595,7 @@ static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s) ...@@ -1595,7 +1595,7 @@ static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s)
{ {
unsigned char buf[21], *base; unsigned char buf[21], *base;
struct dvd_layer *layer; struct dvd_layer *layer;
struct cdrom_generic_command cgc; struct packet_command cgc;
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
int ret, layer_num = s->physical.layer_num; int ret, layer_num = s->physical.layer_num;
...@@ -1645,7 +1645,7 @@ static int dvd_read_copyright(struct cdrom_device_info *cdi, dvd_struct *s) ...@@ -1645,7 +1645,7 @@ static int dvd_read_copyright(struct cdrom_device_info *cdi, dvd_struct *s)
{ {
int ret; int ret;
u_char buf[8]; u_char buf[8];
struct cdrom_generic_command cgc; struct packet_command cgc;
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ); init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);
...@@ -1668,7 +1668,7 @@ static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s) ...@@ -1668,7 +1668,7 @@ static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s)
{ {
int ret, size; int ret, size;
u_char *buf; u_char *buf;
struct cdrom_generic_command cgc; struct packet_command cgc;
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
size = sizeof(s->disckey.value) + 4; size = sizeof(s->disckey.value) + 4;
...@@ -1694,7 +1694,7 @@ static int dvd_read_bca(struct cdrom_device_info *cdi, dvd_struct *s) ...@@ -1694,7 +1694,7 @@ static int dvd_read_bca(struct cdrom_device_info *cdi, dvd_struct *s)
{ {
int ret; int ret;
u_char buf[4 + 188]; u_char buf[4 + 188];
struct cdrom_generic_command cgc; struct packet_command cgc;
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ); init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);
...@@ -1719,7 +1719,7 @@ static int dvd_read_manufact(struct cdrom_device_info *cdi, dvd_struct *s) ...@@ -1719,7 +1719,7 @@ static int dvd_read_manufact(struct cdrom_device_info *cdi, dvd_struct *s)
{ {
int ret = 0, size; int ret = 0, size;
u_char *buf; u_char *buf;
struct cdrom_generic_command cgc; struct packet_command cgc;
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
size = sizeof(s->manufact.value) + 4; size = sizeof(s->manufact.value) + 4;
...@@ -1777,7 +1777,7 @@ static int dvd_read_struct(struct cdrom_device_info *cdi, dvd_struct *s) ...@@ -1777,7 +1777,7 @@ static int dvd_read_struct(struct cdrom_device_info *cdi, dvd_struct *s)
} }
int cdrom_mode_sense(struct cdrom_device_info *cdi, int cdrom_mode_sense(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc, struct packet_command *cgc,
int page_code, int page_control) int page_code, int page_control)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
...@@ -1793,7 +1793,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi, ...@@ -1793,7 +1793,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
} }
int cdrom_mode_select(struct cdrom_device_info *cdi, int cdrom_mode_select(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc) struct packet_command *cgc)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
...@@ -1811,7 +1811,7 @@ static int cdrom_read_subchannel(struct cdrom_device_info *cdi, ...@@ -1811,7 +1811,7 @@ static int cdrom_read_subchannel(struct cdrom_device_info *cdi,
struct cdrom_subchnl *subchnl, int mcn) struct cdrom_subchnl *subchnl, int mcn)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc; struct packet_command cgc;
char buffer[32]; char buffer[32];
int ret; int ret;
...@@ -1845,7 +1845,7 @@ static int cdrom_read_subchannel(struct cdrom_device_info *cdi, ...@@ -1845,7 +1845,7 @@ static int cdrom_read_subchannel(struct cdrom_device_info *cdi,
* Specific READ_10 interface * Specific READ_10 interface
*/ */
static int cdrom_read_cd(struct cdrom_device_info *cdi, static int cdrom_read_cd(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc, int lba, struct packet_command *cgc, int lba,
int blocksize, int nblocks) int blocksize, int nblocks)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
...@@ -1865,7 +1865,7 @@ static int cdrom_read_cd(struct cdrom_device_info *cdi, ...@@ -1865,7 +1865,7 @@ static int cdrom_read_cd(struct cdrom_device_info *cdi,
/* very generic interface for reading the various types of blocks */ /* very generic interface for reading the various types of blocks */
static int cdrom_read_block(struct cdrom_device_info *cdi, static int cdrom_read_block(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc, struct packet_command *cgc,
int lba, int nblocks, int format, int blksize) int lba, int nblocks, int format, int blksize)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
...@@ -1899,7 +1899,7 @@ static int cdrom_read_block(struct cdrom_device_info *cdi, ...@@ -1899,7 +1899,7 @@ static int cdrom_read_block(struct cdrom_device_info *cdi,
static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
int lba, int nframes) int lba, int nframes)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
int nr, ret; int nr, ret;
memset(&cgc, 0, sizeof(cgc)); memset(&cgc, 0, sizeof(cgc));
...@@ -2446,7 +2446,7 @@ int msf_to_lba(char m, char s, char f) ...@@ -2446,7 +2446,7 @@ int msf_to_lba(char m, char s, char f)
static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size) static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc; struct packet_command cgc;
struct modesel_head mh; struct modesel_head mh;
memset(&mh, 0, sizeof(mh)); memset(&mh, 0, sizeof(mh));
...@@ -2472,7 +2472,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, ...@@ -2472,7 +2472,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc; struct packet_command cgc;
struct request_sense sense; struct request_sense sense;
char buffer[32]; char buffer[32];
int ret = 0; int ret = 0;
...@@ -2729,7 +2729,7 @@ static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8 ...@@ -2729,7 +2729,7 @@ static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8
track_information *ti) track_information *ti)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc; struct packet_command cgc;
int ret; int ret;
init_cdrom_command(&cgc, ti, 8, CGC_DATA_READ); init_cdrom_command(&cgc, ti, 8, CGC_DATA_READ);
...@@ -2757,7 +2757,7 @@ static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8 ...@@ -2757,7 +2757,7 @@ static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8
static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di) static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di)
{ {
struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_generic_command cgc; struct packet_command cgc;
int ret; int ret;
/* set up command and get the disc info */ /* set up command and get the disc info */
......
...@@ -2491,7 +2491,7 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int track, ...@@ -2491,7 +2491,7 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
/* the generic packet interface to cdrom.c */ /* the generic packet interface to cdrom.c */
static int ide_cdrom_packet(struct cdrom_device_info *cdi, static int ide_cdrom_packet(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc) struct packet_command *cgc)
{ {
struct request req; struct request req;
ide_drive_t *drive = (ide_drive_t*) cdi->handle; ide_drive_t *drive = (ide_drive_t*) cdi->handle;
...@@ -2524,7 +2524,7 @@ static ...@@ -2524,7 +2524,7 @@ static
int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi, int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
char buffer[16]; char buffer[16];
int stat; int stat;
...@@ -2908,7 +2908,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag ...@@ -2908,7 +2908,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *cdi = &info->devinfo; struct cdrom_device_info *cdi = &info->devinfo;
struct cdrom_generic_command cgc; struct packet_command cgc;
int stat, attempts = 3, size = sizeof(*cap); int stat, attempts = 3, size = sizeof(*cap);
/* /*
......
...@@ -99,7 +99,7 @@ static void get_sectorsize(struct scsi_cd *); ...@@ -99,7 +99,7 @@ static void get_sectorsize(struct scsi_cd *);
static void get_capabilities(struct scsi_cd *); static void get_capabilities(struct scsi_cd *);
static int sr_media_change(struct cdrom_device_info *, int); static int sr_media_change(struct cdrom_device_info *, int);
static int sr_packet(struct cdrom_device_info *, struct cdrom_generic_command *); static int sr_packet(struct cdrom_device_info *, struct packet_command *);
static struct cdrom_device_ops sr_dops = { static struct cdrom_device_ops sr_dops = {
.open = sr_open, .open = sr_open,
...@@ -908,7 +908,7 @@ static void get_capabilities(struct scsi_cd *cd) ...@@ -908,7 +908,7 @@ static void get_capabilities(struct scsi_cd *cd)
* by the Uniform CD-ROM layer. * by the Uniform CD-ROM layer.
*/ */
static int sr_packet(struct cdrom_device_info *cdi, static int sr_packet(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc) struct packet_command *cgc)
{ {
if (cgc->timeout <= 0) if (cgc->timeout <= 0)
cgc->timeout = IOCTL_TIMEOUT; cgc->timeout = IOCTL_TIMEOUT;
......
...@@ -43,7 +43,7 @@ typedef struct scsi_cd { ...@@ -43,7 +43,7 @@ typedef struct scsi_cd {
struct gendisk *disk; struct gendisk *disk;
} Scsi_CD; } Scsi_CD;
int sr_do_ioctl(Scsi_CD *, struct cdrom_generic_command *); int sr_do_ioctl(Scsi_CD *, struct packet_command *);
int sr_lock_door(struct cdrom_device_info *, int); int sr_lock_door(struct cdrom_device_info *, int);
int sr_tray_move(struct cdrom_device_info *, int); int sr_tray_move(struct cdrom_device_info *, int);
......
...@@ -34,7 +34,7 @@ static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti ...@@ -34,7 +34,7 @@ static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti
{ {
struct cdrom_tocentry trk0_te, trk1_te; struct cdrom_tocentry trk0_te, trk1_te;
struct cdrom_tochdr tochdr; struct cdrom_tochdr tochdr;
struct cdrom_generic_command cgc; struct packet_command cgc;
int ntracks, ret; int ntracks, ret;
if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCHDR, &tochdr))) if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCHDR, &tochdr)))
...@@ -57,7 +57,7 @@ static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti ...@@ -57,7 +57,7 @@ static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti
if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCENTRY, &trk1_te))) if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCENTRY, &trk1_te)))
return ret; return ret;
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_PLAY_AUDIO_MSF; cgc.cmd[0] = GPCMD_PLAY_AUDIO_MSF;
cgc.cmd[3] = trk0_te.cdte_addr.msf.minute; cgc.cmd[3] = trk0_te.cdte_addr.msf.minute;
cgc.cmd[4] = trk0_te.cdte_addr.msf.second; cgc.cmd[4] = trk0_te.cdte_addr.msf.second;
...@@ -74,7 +74,7 @@ static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti ...@@ -74,7 +74,7 @@ static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti
error code is. Normally the UNIT_ATTENTION code will automatically error code is. Normally the UNIT_ATTENTION code will automatically
clear after one error */ clear after one error */
int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc) int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
{ {
struct scsi_request *SRpnt; struct scsi_request *SRpnt;
struct scsi_device *SDev; struct scsi_device *SDev;
...@@ -178,9 +178,9 @@ int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc) ...@@ -178,9 +178,9 @@ int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc)
static int test_unit_ready(Scsi_CD *cd) static int test_unit_ready(Scsi_CD *cd)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_TEST_UNIT_READY; cgc.cmd[0] = GPCMD_TEST_UNIT_READY;
cgc.quiet = 1; cgc.quiet = 1;
cgc.data_direction = SCSI_DATA_NONE; cgc.data_direction = SCSI_DATA_NONE;
...@@ -191,9 +191,9 @@ static int test_unit_ready(Scsi_CD *cd) ...@@ -191,9 +191,9 @@ static int test_unit_ready(Scsi_CD *cd)
int sr_tray_move(struct cdrom_device_info *cdi, int pos) int sr_tray_move(struct cdrom_device_info *cdi, int pos)
{ {
Scsi_CD *cd = cdi->handle; Scsi_CD *cd = cdi->handle;
struct cdrom_generic_command cgc; struct packet_command cgc;
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_START_STOP_UNIT; cgc.cmd[0] = GPCMD_START_STOP_UNIT;
cgc.cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ; cgc.cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
cgc.data_direction = SCSI_DATA_NONE; cgc.data_direction = SCSI_DATA_NONE;
...@@ -269,11 +269,11 @@ int sr_get_last_session(struct cdrom_device_info *cdi, ...@@ -269,11 +269,11 @@ int sr_get_last_session(struct cdrom_device_info *cdi,
int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
{ {
Scsi_CD *cd = cdi->handle; Scsi_CD *cd = cdi->handle;
struct cdrom_generic_command cgc; struct packet_command cgc;
char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
int result; int result;
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_READ_SUBCHANNEL; cgc.cmd[0] = GPCMD_READ_SUBCHANNEL;
cgc.cmd[2] = 0x40; /* I do want the subchannel info */ cgc.cmd[2] = 0x40; /* I do want the subchannel info */
cgc.cmd[3] = 0x02; /* Give me medium catalog number info */ cgc.cmd[3] = 0x02; /* Give me medium catalog number info */
...@@ -299,14 +299,14 @@ int sr_reset(struct cdrom_device_info *cdi) ...@@ -299,14 +299,14 @@ int sr_reset(struct cdrom_device_info *cdi)
int sr_select_speed(struct cdrom_device_info *cdi, int speed) int sr_select_speed(struct cdrom_device_info *cdi, int speed)
{ {
Scsi_CD *cd = cdi->handle; Scsi_CD *cd = cdi->handle;
struct cdrom_generic_command cgc; struct packet_command cgc;
if (speed == 0) if (speed == 0)
speed = 0xffff; /* set to max */ speed = 0xffff; /* set to max */
else else
speed *= 177; /* Nx to kbyte/s */ speed *= 177; /* Nx to kbyte/s */
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_SET_SPEED; /* SET CD SPEED */ cgc.cmd[0] = GPCMD_SET_SPEED; /* SET CD SPEED */
cgc.cmd[2] = (speed >> 8) & 0xff; /* MSB for speed (in kbytes/sec) */ cgc.cmd[2] = (speed >> 8) & 0xff; /* MSB for speed (in kbytes/sec) */
cgc.cmd[3] = speed & 0xff; /* LSB */ cgc.cmd[3] = speed & 0xff; /* LSB */
...@@ -327,11 +327,11 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed) ...@@ -327,11 +327,11 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed)
int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
{ {
Scsi_CD *cd = cdi->handle; Scsi_CD *cd = cdi->handle;
struct cdrom_generic_command cgc; struct packet_command cgc;
int result; int result;
unsigned char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); unsigned char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.timeout = IOCTL_TIMEOUT; cgc.timeout = IOCTL_TIMEOUT;
switch (cmd) { switch (cmd) {
...@@ -428,14 +428,14 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) ...@@ -428,14 +428,14 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int blksize) static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int blksize)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
#ifdef DEBUG #ifdef DEBUG
printk("%s: sr_read_cd lba=%d format=%d blksize=%d\n", printk("%s: sr_read_cd lba=%d format=%d blksize=%d\n",
cd->cdi.name, lba, format, blksize); cd->cdi.name, lba, format, blksize);
#endif #endif
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_READ_CD; /* READ_CD */ cgc.cmd[0] = GPCMD_READ_CD; /* READ_CD */
cgc.cmd[1] = ((format & 7) << 2); cgc.cmd[1] = ((format & 7) << 2);
cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff; cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
...@@ -470,7 +470,7 @@ static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int ...@@ -470,7 +470,7 @@ static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int
static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest) static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest)
{ {
struct cdrom_generic_command cgc; struct packet_command cgc;
int rc; int rc;
/* we try the READ CD command first... */ /* we try the READ CD command first... */
...@@ -491,7 +491,7 @@ static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest ...@@ -491,7 +491,7 @@ static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest
printk("%s: sr_read_sector lba=%d blksize=%d\n", cd->cdi.name, lba, blksize); printk("%s: sr_read_sector lba=%d blksize=%d\n", cd->cdi.name, lba, blksize);
#endif #endif
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_READ_10; cgc.cmd[0] = GPCMD_READ_10;
cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff; cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff; cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff;
......
...@@ -107,7 +107,7 @@ void sr_vendor_init(Scsi_CD *cd) ...@@ -107,7 +107,7 @@ void sr_vendor_init(Scsi_CD *cd)
int sr_set_blocklength(Scsi_CD *cd, int blocklength) int sr_set_blocklength(Scsi_CD *cd, int blocklength)
{ {
unsigned char *buffer; /* the buffer for the ioctl */ unsigned char *buffer; /* the buffer for the ioctl */
struct cdrom_generic_command cgc; struct packet_command cgc;
struct ccs_modesel_head *modesel; struct ccs_modesel_head *modesel;
int rc, density = 0; int rc, density = 0;
...@@ -123,7 +123,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) ...@@ -123,7 +123,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength)
#ifdef DEBUG #ifdef DEBUG
printk("%s: MODE SELECT 0x%x/%d\n", cd->cdi.name, density, blocklength); printk("%s: MODE SELECT 0x%x/%d\n", cd->cdi.name, density, blocklength);
#endif #endif
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = MODE_SELECT; cgc.cmd[0] = MODE_SELECT;
cgc.cmd[1] = (1 << 4); cgc.cmd[1] = (1 << 4);
cgc.cmd[4] = 12; cgc.cmd[4] = 12;
...@@ -157,7 +157,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -157,7 +157,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
Scsi_CD *cd = cdi->handle; Scsi_CD *cd = cdi->handle;
unsigned long sector; unsigned long sector;
unsigned char *buffer; /* the buffer for the ioctl */ unsigned char *buffer; /* the buffer for the ioctl */
struct cdrom_generic_command cgc; struct packet_command cgc;
int rc, no_multi; int rc, no_multi;
if (cd->cdi.mask & CDC_MULTI_SESSION) if (cd->cdi.mask & CDC_MULTI_SESSION)
...@@ -171,7 +171,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -171,7 +171,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
no_multi = 0; /* flag: the drive can't handle multisession */ no_multi = 0; /* flag: the drive can't handle multisession */
rc = 0; rc = 0;
memset(&cgc, 0, sizeof(struct cdrom_generic_command)); memset(&cgc, 0, sizeof(struct packet_command));
switch (cd->vendor) { switch (cd->vendor) {
......
...@@ -280,17 +280,16 @@ struct cdrom_blk ...@@ -280,17 +280,16 @@ struct cdrom_blk
struct cdrom_generic_command struct cdrom_generic_command
{ {
unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char cmd[CDROM_PACKET_SIZE];
unsigned char *buffer; unsigned char __user *buffer;
unsigned int buflen; unsigned int buflen;
int stat; int stat;
struct request_sense *sense; struct request_sense __user *sense;
unsigned char data_direction; unsigned char data_direction;
int quiet; int quiet;
int timeout; int timeout;
void *reserved[1]; void __user *reserved[1]; /* unused, actually */
}; };
/* /*
* A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336,
* 2340, or 2352 bytes long. * 2340, or 2352 bytes long.
...@@ -907,6 +906,19 @@ struct mode_page_header { ...@@ -907,6 +906,19 @@ struct mode_page_header {
#include <linux/fs.h> /* not really needed, later.. */ #include <linux/fs.h> /* not really needed, later.. */
#include <linux/device.h> #include <linux/device.h>
struct packet_command
{
unsigned char cmd[CDROM_PACKET_SIZE];
unsigned char *buffer;
unsigned int buflen;
int stat;
struct request_sense *sense;
unsigned char data_direction;
int quiet;
int timeout;
void *reserved[1];
};
/* /*
* _OLD will use PIO transfer on atapi devices, _BPC_* will use DMA * _OLD will use PIO transfer on atapi devices, _BPC_* will use DMA
*/ */
...@@ -965,7 +977,7 @@ struct cdrom_device_ops { ...@@ -965,7 +977,7 @@ struct cdrom_device_ops {
int n_minors; /* number of active minor devices */ int n_minors; /* number of active minor devices */
/* handle uniform packets for scsi type devices (scsi,atapi) */ /* handle uniform packets for scsi type devices (scsi,atapi) */
int (*generic_packet) (struct cdrom_device_info *, int (*generic_packet) (struct cdrom_device_info *,
struct cdrom_generic_command *); struct packet_command *);
}; };
/* the general block_device operations structure: */ /* the general block_device operations structure: */
...@@ -990,11 +1002,11 @@ typedef struct { ...@@ -990,11 +1002,11 @@ typedef struct {
extern int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written); extern int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written);
extern int cdrom_number_of_slots(struct cdrom_device_info *cdi); extern int cdrom_number_of_slots(struct cdrom_device_info *cdi);
extern int cdrom_mode_select(struct cdrom_device_info *cdi, extern int cdrom_mode_select(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc); struct packet_command *cgc);
extern int cdrom_mode_sense(struct cdrom_device_info *cdi, extern int cdrom_mode_sense(struct cdrom_device_info *cdi,
struct cdrom_generic_command *cgc, struct packet_command *cgc,
int page_code, int page_control); int page_code, int page_control);
extern void init_cdrom_command(struct cdrom_generic_command *cgc, extern void init_cdrom_command(struct packet_command *cgc,
void *buffer, int len, int type); void *buffer, int len, int type);
/* The SCSI spec says there could be 256 slots. */ /* The SCSI spec says there could be 256 slots. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment