static void cdrom_count_tracks(int fd, tracktype *tracks) { struct cdrom_tochdr header; struct cdrom_tocentry entry; int ret, i; bzero(tracks, sizeof (*tracks)); ret = cdrom_ioctl(fd, CDROMREADTOCHDR, &header); /* * This whole business is a crock anyhow so we don't bother distinguishing * between no media, drive not ready, etc and on any error just say we have * no info. */ if (ret) { tracks->error = CDS_NO_INFO; return; } entry.cdte_format = CDROM_MSF; for (i = header.cdth_trk0; i <= header.cdth_trk1; i++) { entry.cdte_track = i; if (cdrom_ioctl(fd, CDROMREADTOCENTRY, &entry)) { tracks->error = CDS_NO_INFO; return; } if (entry.cdte_ctrl & CDROM_DATA_TRACK) { if (entry.cdte_format == 0x10) tracks->cdi++; else if (entry.cdte_format == 0x20) tracks->xa++; else tracks->data++; } else tracks->audio++; } return; }
/* * This is the published entry point. Actually applications should simply * include <dvd.h> and not refer to this at all. */ int dvd_cdrom_ioctl(int fd, unsigned long cmd, void *arg) { switch (cmd) { case DVD_AUTH: case DVD_READ_STRUCT: return(dvd_ioctl(fd, cmd, arg)); case CDROMREADTOCHDR: case CDROMREADTOCENTRY: case CDROMEJECT: case CDROMREADRAW: case CDROMREADMODE1: case CDROMREADMODE2: case CDROMCLOSETRAY: case CDROM_DRIVE_STATUS: case CDROM_DISC_STATUS: return(cdrom_ioctl(fd, cmd, arg)); default: return(ioctl(fd, cmd, arg)); } }
static int mcdx_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, unsigned long arg) { struct s_drive_stuff *p = inode->i_bdev->bd_disk->private_data; return cdrom_ioctl(file, &p->info, inode, cmd, arg); }
static int mcd_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, unsigned long arg) { return cdrom_ioctl(file, &mcd_info, inode, cmd, arg); }