Patch to mcdx.c to reload disk information

Geoff Hoff (ghoff@math.utk.edu)
Sat, 15 Nov 1997 14:47:23 -0500


------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6189.879623212.1@cotton.math.utk.edu>

Konrad <htw6966@htw-dresden.de> mentioned recently on this list that the mcdx
driver does not properly update information when a disk is changed. For
example, workman doesn't get new information when a disc is changed. Here is
a patch I threw together that seems to fix this. It works for Konrad and for
myself, but I'm not sure that what I have done is the best way to do it. If
you try this patch, please let me know your results. Also if you have any
suggestions to make this patch better, let me know. This should work in 2.0
and 2.1 series kernels.

The second patch fixes a bug in pause. I posted it before and it's already in
the 2.1 series, but I thought I'd repost it in case someone running 2.0 missed
it the first time.

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6189.879623212.2@cotton.math.utk.edu>
Content-Description: reload patch

--- linux/drivers/cdrom/mcdx.c.orig Tue May 20 20:52:37 1997
+++ linux/drivers/cdrom/mcdx.c Sun Nov 9 22:52:18 1997
@@ -302,4 +302,26 @@
if (!ip) return -EINVAL;

+ if (stuffp->xxx)
+ {
+ if(-1 == mcdx_requesttocdata(stuffp, &stuffp->di, 1))
+ {
+ stuffp->lastsector = -1;
+ }
+ else
+ {
+ stuffp->lastsector = (CD_FRAMESIZE / 512)
+ * msf2log(&stuffp->di.msf_leadout) - 1;
+ }
+
+ if (stuffp->toc)
+ {
+ kfree(stuffp->toc);
+ stuffp->toc = NULL;
+ if (-1 == mcdx_readtoc(stuffp)) return -1;
+ }
+
+ stuffp->xxx=0;
+ }
+
switch (cmd) {
case CDROMSTART: {

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6189.879623212.3@cotton.math.utk.edu>
Content-Description: pause patch

--- linux/drivers/cdrom/mcdx.c.orig Tue May 20 21:00:18 1997
+++ linux/drivers/cdrom/mcdx.c Tue May 20 21:06:01 1997
@@ -356,6 +356,10 @@
msf.cdmsf_sec1 = uint2bcd(msf.cdmsf_sec1);
msf.cdmsf_frame1 = uint2bcd(msf.cdmsf_frame1);

+ stuffp->stop.dt.minute = msf.cdmsf_min1;
+ stuffp->stop.dt.second = msf.cdmsf_sec1;
+ stuffp->stop.dt.frame = msf.cdmsf_frame1;
+
return mcdx_playmsf(stuffp, &msf);
}

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6189.879623212.4@cotton.math.utk.edu>

---
Geoff Hoff <ghoff@math.utk.edu>
Assistant Systems Administrator
Department of Mathematics, University of Tennessee Knoxville

------- =_aaaaaaaaaa0--