patch-2.1.71 linux/drivers/cdrom/cdrom.c
Next file: linux/drivers/char/Config.in
Previous file: linux/drivers/cdrom/aztcd.h
Back to the patch index
Back to the overall index
- Lines: 194
- Date:
Wed Dec 3 10:40:13 1997
- Orig file:
v2.1.70/linux/drivers/cdrom/cdrom.c
- Orig date:
Tue Dec 2 16:45:18 1997
diff -u --recursive --new-file v2.1.70/linux/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c
@@ -111,8 +111,6 @@
static int cdrom_ioctl(struct inode *ip, struct file *fp,
unsigned int cmd, unsigned long arg);
static int cdrom_media_changed(kdev_t dev);
-static int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
- void *buffer, size_t *lenp);
static int open_for_data(struct cdrom_device_info * cdi);
static int check_for_audio_disc(struct cdrom_device_info * cdi,
struct cdrom_device_ops * cdo);
@@ -307,11 +305,15 @@
ret=-ENOMEDIUM;
goto clean_up_and_return;
}
+#if 0
+ /* this breaks CD-Players which don't use O_NONBLOCK, workman
+ * for example, probably others too */
if (cdi->options & CDO_CHECK_TYPE && tracks.data==0) {
cdinfo(CD_OPEN, "bummer. wrong media type...\n");
ret=-EMEDIUMTYPE;
goto clean_up_and_return;
}
+#endif
cdinfo(CD_OPEN, "all seems well, opening the device...\n");
@@ -879,24 +881,85 @@
EXPORT_SYMBOL(cdrom_fops);
#ifdef CONFIG_SYSCTL
-#define CDROM_STR_SIZE 1000
-static char cdrom_drive_info[CDROM_STR_SIZE]="info\n";
-#ifdef MODULE
+#define CDROM_STR_SIZE 1000
-static struct ctl_table_header *cdrom_sysctl_header;
+static char cdrom_drive_info[CDROM_STR_SIZE]="info\n";
-static void cdrom_sysctl_register(void)
+int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
+ void *buffer, size_t *lenp)
{
- cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 0);
-}
+ int retv,pos;
+ struct cdrom_device_info *cdi;
-static void cdrom_sysctl_unregister(void)
-{
- unregister_sysctl_table(cdrom_sysctl_header);
-}
+ pos = sprintf(cdrom_drive_info, "CD-ROM information\n");
+
+ pos += sprintf(cdrom_drive_info+pos, "\ndrive name:\t");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%s", cdi->name);
+
+ pos += sprintf(cdrom_drive_info+pos, "\ndrive speed:\t");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d", cdi->speed);
+
+ pos += sprintf(cdrom_drive_info+pos, "\ndrive # of slots:");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d", cdi->capacity);
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan close tray:\t");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_CLOSE_TRAY)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan open tray:\t");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_OPEN_TRAY)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan lock tray:\t");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_LOCK)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan change speed:");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_SELECT_SPEED)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan select disk:");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_SELECT_DISC)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan read multisession:");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_MULTI_SESSION)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan read MCN:\t");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_MCN)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nReports media changed:");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_MEDIA_CHANGED)!=0));
+
+ pos += sprintf(cdrom_drive_info+pos, "\nCan play audio:\t");
+ for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
+ pos += sprintf(cdrom_drive_info+pos, "\t%d",
+ ((cdi->ops->capability & CDC_PLAY_AUDIO)!=0));
-#endif
+ strcpy(cdrom_drive_info+pos,"\n\n");
+ *lenp=pos+3;
+ if (!write) {
+ retv = proc_dostring(ctl, write, filp, buffer, lenp);
+ }
+ else
+ retv = proc_dostring(ctl, write, filp, buffer, lenp);
+ return retv;
+}
/* Place files in /proc/sys/dev/cdrom */
ctl_table cdrom_table[] = {
@@ -916,57 +979,26 @@
{0}
};
+#endif /* endif CONFIG_SYSCTL */
-int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
- void *buffer, size_t *lenp)
-{
- int retv;
- char buf[40];
- struct cdrom_device_info *cdi;
- sprintf(cdrom_drive_info, "CD-ROM information\n\n");
- for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next){
- sprintf(buf, "drive name:\t\t%s\n", cdi->name);
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "drive speed:\t\t%d\n", cdi->speed);
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "drive # of slots:\t%d\n", cdi->capacity);
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can close tray:\t\t%d\n", ((cdi->ops->capability & CDC_CLOSE_TRAY)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can open tray:\t\t%d\n", ((cdi->ops->capability & CDC_OPEN_TRAY)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can lock tray:\t\t%d\n", ((cdi->ops->capability & CDC_LOCK)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can change speed:\t%d\n", ((cdi->ops->capability & CDC_SELECT_SPEED)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can select disk:\t%d\n", ((cdi->ops->capability & CDC_SELECT_DISC)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can read multisession:\t%d\n", ((cdi->ops->capability & CDC_MULTI_SESSION)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can read MCN:\t\t%d\n", ((cdi->ops->capability & CDC_MCN)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Reports media changed:\t%d\n", ((cdi->ops->capability & CDC_MEDIA_CHANGED)!=0));
- strcat(cdrom_drive_info, buf);
- sprintf(buf, "Can play audio:\t\t%d\n", ((cdi->ops->capability & CDC_PLAY_AUDIO)!=0));
- strcat(cdrom_drive_info, buf);
- strcat(cdrom_drive_info, "\n\n");
- }
- *lenp=sizeof(cdrom_drive_info);
+#ifdef MODULE
- if (!write) {
- retv = proc_dostring(ctl, write, filp, buffer, lenp);
- }
- else
- retv = proc_dostring(ctl, write, filp, buffer, lenp);
- return retv;
-}
+#ifdef CONFIG_SYSCTL
+static struct ctl_table_header *cdrom_sysctl_header;
-#endif /* endif CONFIG_SYSCTL */
+static void cdrom_sysctl_register(void)
+{
+ cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 0);
+}
+static void cdrom_sysctl_unregister(void)
+{
+ unregister_sysctl_table(cdrom_sysctl_header);
+}
+#endif /* endif CONFIG_SYSCTL */
-#ifdef MODULE
int init_module(void)
{
cdrom_init();
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov