summaryrefslogtreecommitdiff
path: root/sys/dev/atapi/acd.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-11 03:48:25 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-11 03:48:25 +0000
commitdbfbe688d0bf0224d7a6db2371ca13dba041aecd (patch)
tree9a82795cf7377e085f7bb96251381639fb1e531e /sys/dev/atapi/acd.c
parent18573cdd82598a994be805bdadb79842dde7334b (diff)
always return TOC information in big-endian order; problem noted by
csapuntz@lcs.mit.edu
Diffstat (limited to 'sys/dev/atapi/acd.c')
-rw-r--r--sys/dev/atapi/acd.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/sys/dev/atapi/acd.c b/sys/dev/atapi/acd.c
index 43273d1cd5a..886f72de68c 100644
--- a/sys/dev/atapi/acd.c
+++ b/sys/dev/atapi/acd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acd.c,v 1.30 1998/06/09 13:29:57 provos Exp $ */
+/* $OpenBSD: acd.c,v 1.31 1998/07/11 03:48:24 deraadt Exp $ */
/*
* Copyright (c) 1996 Manuel Bouyer. All rights reserved.
@@ -796,12 +796,8 @@ acdioctl(dev, cmd, addr, flag, p)
error = acd_read_toc(acd, 0, 0, &hdr, sizeof(hdr));
if (error)
return error;
- if (acd->ad_link->quirks & AQUIRK_LITTLETOC) {
-#if BYTE_ORDER == BIG_ENDIAN
+ if (acd->ad_link->quirks & AQUIRK_LITTLETOC)
bswap((u_int8_t *)&hdr.len, sizeof(hdr.len));
-#endif
- } else
- hdr.len = ntohs(hdr.len);
bcopy(&hdr, addr, sizeof(hdr));
return 0;
}
@@ -830,26 +826,16 @@ acdioctl(dev, cmd, addr, flag, p)
th->ending_track - th->starting_track + 1;
ntracks >= 0; ntracks--) {
toc.tab[ntracks].addr_type = CD_LBA_FORMAT;
- if (acd->ad_link->quirks & AQUIRK_LITTLETOC) {
-#if BYTE_ORDER == BIG_ENDIAN
+ if (acd->ad_link->quirks & AQUIRK_LITTLETOC)
bswap((u_int8_t*)
&toc.tab[ntracks].addr.addr,
- sizeof(toc.tab[ntracks].addr.addr)
- );
-#endif
- } else
- toc.tab[ntracks].addr.lba =
- ntohl(toc.tab[ntracks].addr.lba);
+ sizeof(toc.tab[ntracks].addr.addr));
}
}
- if (acd->ad_link->quirks & AQUIRK_LITTLETOC) {
-#if BYTE_ORDER == BIG_ENDIAN
+ if (acd->ad_link->quirks & AQUIRK_LITTLETOC)
bswap((u_int8_t*)&th->len, sizeof(th->len));
-#endif
- } else
- th->len = ntohs(th->len);
- len = min(len, th->len - sizeof(struct ioc_toc_header));
+ len = min(len, ntohs(th->len) - sizeof(struct ioc_toc_header));
return copyout(toc.tab, te->data, len);
}