Return to BSD News archive
Newsgroups: comp.unix.bsd.freebsd.misc Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!howland.reston.ans.net!ix.netcom.com!netcom.com!kientzle From: kientzle@netcom.com Subject: Patch for `wcd.c' in 2.1R Message-ID: <kientzleDLvnoI.KwF@netcom.com> Summary: TOCENTRY mis-handles small requests, leadouts Organization: NETCOM On-line Communication Services (408 261-4700 guest) Date: Sun, 28 Jan 1996 06:07:30 GMT Lines: 70 Sender: kientzle@netcom13.netcom.com Not completely sure who to send this to, but I'm certain someone here can relay this to the right place: I ran into some trouble getting `xcdplayer' to work with an ATAPI CD-ROM drive. Comparing it's operation to `xcd' (which works fine), I narrowed down the problem to the handling of `ioctl(CDIOREADTOCENTRYS)' in `wcd.c'. Briefly, the 2.1R version doesn't honor requests for entry 170 (the leadout entry), and it fails to completely convert from LBA to MSF format for small requests. Here's the patch: %%%%%CUT%HERE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *** wcd.c.orig Fri Jan 26 20:30:25 1996 --- wcd.c Sat Jan 27 19:44:13 1996 *************** *** 733,744 **** struct toc buf; u_long len; if (! t->toc.hdr.ending_track) return (EIO); ! if (te->starting_track < toc->hdr.starting_track || ! te->starting_track > toc->hdr.ending_track) return (EINVAL); ! len = (toc->hdr.ending_track - te->starting_track + 2) * sizeof(toc->tab[0]); if (te->data_len < len) --- 733,749 ---- struct toc buf; u_long len; + u_char starting_track = te->starting_track; if (! t->toc.hdr.ending_track) return (EIO); ! ! if (starting_track == 170) /* Handle leadout request */ ! starting_track = toc->hdr.ending_track+1; ! ! if (starting_track < toc->hdr.starting_track || ! starting_track > toc->hdr.ending_track +1 ) return (EINVAL); ! len = (toc->hdr.ending_track - starting_track + 2) * sizeof(toc->tab[0]); if (te->data_len < len) *************** *** 754,763 **** toc = &buf; e = toc->tab + toc->hdr.ending_track - ! te->starting_track + 2; while (--e >= toc->tab) lba2msf (e->addr.lba, &e->addr.msf.minute, &e->addr.msf.second, &e->addr.msf.frame); } ! if (copyout (toc->tab + te->starting_track - toc->hdr.starting_track, te->data, len) != 0) error = EFAULT; --- 759,768 ---- toc = &buf; e = toc->tab + toc->hdr.ending_track - ! toc->hdr.starting_track + 2; while (--e >= toc->tab) lba2msf (e->addr.lba, &e->addr.msf.minute, &e->addr.msf.second, &e->addr.msf.frame); } ! if (copyout (toc->tab + starting_track - toc->hdr.starting_track, te->data, len) != 0) error = EFAULT; %%%%%CUT%HERE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%