summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-10-11 11:31:44 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-10-11 11:31:44 +0000
commit87487d7b54bac7aef8877ef71eee5f8920679a1b (patch)
treefce11c2322e0d21cf2bd1ca1deaae14a7cee57d1 /sys
parent60a08f2e4f86a9ba058ac63569fae160de1218b6 (diff)
Change some byte shifting to _4btol() and swap32() calls.
ok hshoexer@
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/cd.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index aa1ccc76b92..96014a8dee3 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.93 2005/10/10 23:10:38 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.94 2005/10/11 11:31:43 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -1244,26 +1244,17 @@ cdgetdisklabel(dev, cd, lp, clp, spoofonly)
/* Create the partition table. */
/* Probably should sanity-check the drive's values */
ent = toc + TOC_HEADER_SZ;
- lba = ((cd->sc_link->quirks & ADEV_LITTLETOC) ?
- ent[TOC_ENTRY_MSF_LBA] | ent[TOC_ENTRY_MSF_LBA + 1] << 8 |
- ent[TOC_ENTRY_MSF_LBA + 2] << 16 |
- ent[TOC_ENTRY_MSF_LBA + 3] << 24 :
- ent[TOC_ENTRY_MSF_LBA] << 24 | ent[TOC_ENTRY_MSF_LBA + 1] << 16 |
- ent[TOC_ENTRY_MSF_LBA + 2] << 8 | ent[TOC_ENTRY_MSF_LBA + 3]);
+ lba = _4btol(&ent[TOC_ENTRY_MSF_LBA]);
+ if (cd->sc_link->quirks & ADEV_LITTLETOC)
+ lba = swap32(lba);
i = 0;
for (tocidx = 1; tocidx <= n; tocidx++) {
is_data = ent[TOC_ENTRY_CONTROL_ADDR_TYPE] & 4;
ent += TOC_ENTRY_SZ;
- nlba = ((cd->sc_link->quirks & ADEV_LITTLETOC) ?
- ent[TOC_ENTRY_MSF_LBA] |
- ent[TOC_ENTRY_MSF_LBA + 1] << 8 |
- ent[TOC_ENTRY_MSF_LBA + 2] << 16 |
- ent[TOC_ENTRY_MSF_LBA + 3] << 24 :
- ent[TOC_ENTRY_MSF_LBA] << 24 |
- ent[TOC_ENTRY_MSF_LBA + 1] << 16 |
- ent[TOC_ENTRY_MSF_LBA + 2] << 8 |
- ent[TOC_ENTRY_MSF_LBA + 3]);
+ nlba = _4btol(&ent[TOC_ENTRY_MSF_LBA]);
+ if (cd->sc_link->quirks & ADEV_LITTLETOC)
+ nlba = swap32(nlba);
lp->d_partitions[i].p_fstype =
is_data ? FS_UNUSED : FS_OTHER;