FreeBSD Bugzilla – Attachment 14172 Details for
Bug 26644
[PATCH] ATA/ATAPI driver doesn't implement CDIOCREADSUBCHANNEL correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.18 KB, created by
un1i
on 2001-04-17 13:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
un1i
Created:
2001-04-17 13:50:01 UTC
Size:
4.18 KB
patch
obsolete
>Index: atapi-cd.c >=================================================================== >RCS file: /ncvs/src/sys/dev/ata/atapi-cd.c,v >retrieving revision 1.88 >diff -u -r1.88 atapi-cd.c >--- atapi-cd.c 2001/04/05 11:17:33 1.88 >+++ atapi-cd.c 2001/04/17 12:25:23 >@@ -725,45 +725,57 @@ > { > struct ioc_read_subchannel *args = > (struct ioc_read_subchannel *)addr; >- struct cd_sub_channel_info data; >+ u_int8_t format; > int len = args->data_len; >- int32_t abslba, rellba; > int8_t ccb[16] = { ATAPI_READ_SUBCHANNEL, 0, 0x40, 1, 0, 0, 0, > sizeof(cdp->subchan)>>8, sizeof(cdp->subchan), > 0, 0, 0, 0, 0, 0, 0 }; > >- if (len > sizeof(data) || >+ if (len > sizeof(struct cd_sub_channel_info) || > len < sizeof(struct cd_sub_channel_header)) { > error = EINVAL; > break; > } > >+ format=args->data_format; >+ if ((format != CD_CURRENT_POSITION) && >+ (format != CD_MEDIA_CATALOG) && (format != CD_TRACK_INFO)) { >+ error = EINVAL; >+ break; >+ } >+ >+ ccb[1] = args->address_format & CD_MSF_FORMAT; >+ > if ((error = atapi_queue_cmd(cdp->atp, ccb, (caddr_t)&cdp->subchan, > sizeof(cdp->subchan), ATPR_F_READ, 10, > NULL, NULL))) { > break; > } >- abslba = cdp->subchan.abslba; >- rellba = cdp->subchan.rellba; >- if (args->address_format == CD_MSF_FORMAT) { >- lba2msf(ntohl(abslba), >- &data.what.position.absaddr.msf.minute, >- &data.what.position.absaddr.msf.second, >- &data.what.position.absaddr.msf.frame); >- lba2msf(ntohl(rellba), >- &data.what.position.reladdr.msf.minute, >- &data.what.position.reladdr.msf.second, >- &data.what.position.reladdr.msf.frame); >- } else { >- data.what.position.absaddr.lba = abslba; >- data.what.position.reladdr.lba = rellba; >+ >+ /* >+ * Ask for media catalogue or track info only if no audio play >+ * operation is in progress or the drive will return an error. >+ */ >+ >+ if ((format == CD_MEDIA_CATALOG) || (format == CD_TRACK_INFO)) { >+ if (cdp->subchan.header.audio_status == 0x11) { >+ error = EINVAL; >+ break; >+ } >+ >+ ccb[3] = format; >+ if (format == CD_TRACK_INFO) >+ ccb[6] = args->track; >+ >+ if ((error = atapi_queue_cmd(cdp->atp, ccb, >+ (caddr_t)&cdp->subchan, >+ sizeof(cdp->subchan), ATPR_F_READ, >+ 10, NULL, NULL))) { >+ break; >+ } > } >- data.header.audio_status = cdp->subchan.audio_status; >- data.what.position.control = cdp->subchan.control & 0xf; >- data.what.position.addr_type = cdp->subchan.control >> 4; >- data.what.position.track_number = cdp->subchan.track; >- data.what.position.index_number = cdp->subchan.indx; >- error = copyout(&data, args->data, len); >+ >+ error = copyout(&cdp->subchan, args->data, len); > break; > } > >Index: atapi-cd.h >=================================================================== >RCS file: /ncvs/src/sys/dev/ata/atapi-cd.h,v >retrieving revision 1.25 >diff -u -r1.25 atapi-cd.h >--- atapi-cd.h 2001/03/21 14:59:38 1.25 >+++ atapi-cd.h 2001/04/17 10:19:46 >@@ -311,16 +311,40 @@ > struct audiopage au; /* audio page info */ > struct audiopage aumask; /* audio page mask */ > struct cappage cap; /* capabilities page info */ >- struct { /* subchannel info */ >- u_int8_t void0; >- u_int8_t audio_status; >- u_int16_t data_length; >- u_int8_t data_format; >- u_int8_t control; >- u_int8_t track; >- u_int8_t indx; >- u_int32_t abslba; >- u_int32_t rellba; >+ struct { >+ struct { >+ u_int8_t void0; >+ u_int8_t audio_status; >+ u_int16_t data_length; >+ } header; >+ union { /* subchannel info */ >+ struct { >+ u_int8_t data_format; >+ u_int8_t control; >+ u_int8_t track; >+ u_int8_t indx; >+ u_int32_t abslba; >+ u_int32_t rellba; >+ } position; >+ struct { >+ u_int8_t data_format; >+ u_int8_t :8; >+ u_int8_t :8; >+ u_int8_t :8; >+ u_int8_t :7; >+ u_int8_t mc_valid:1; >+ u_int8_t mc_number[15]; >+ } media_catalog; >+ struct { >+ u_int8_t data_format; >+ u_int8_t control; >+ u_int8_t track; >+ u_int8_t :8; >+ u_int8_t :7; >+ u_int8_t ti_valid:1; >+ u_int8_t ti_number[15]; >+ } track_info; >+ } what; > } subchan; > struct changer *changer_info; /* changer info */ > struct acd_softc **driver; /* softc's of changer slots */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 26644
:
14171
| 14172