Subject: kern/2091: src/sys/cdio.h is depend on byte order
To: None <gnats-bugs@NetBSD.ORG>
From: Masaru Oki <oki@yk.rim.or.jp>
List: netbsd-bugs
Date: 02/17/1996 17:04:18
>Number:         2091
>Category:       kern
>Synopsis:       src/sys/cdio.h is depend on byte order
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 17 03:20:01 1996
>Last-Modified:
>Originator:     Masaru Oki
>Organization:
		personal
>Release:        1.1
>Environment:
	
System: NetBSD myname.yk.rim.or.jp 1.1 NetBSD 1.1 (ALL) #4: Thu Feb 15 23:08:53 JST 1996 oki@myname.my.domain:/var/sources/src/NetBSD-1.1/usr/src/sys/arch/x68k/compile/ALL x68k


>Description:
	
	some structures in src/sys/sys/cdio.h uses bit-field member, this is
	depends on byte order. This isn't work on big-endian machines.
>How-To-Repeat:
	
	running xcdplayer on big-endian machines (e.g. NetBSD/mac68k)
>Fix:
	
--- src/sys/sys/cdio.h.orig	Sat Oct 14 11:56:07 1995
+++ src/sys/sys/cdio.h		Thu Aug  3 08:13:34 1995
@@ -7,8 +7,14 @@
 
 struct cd_toc_entry {
 	u_char	nothing1;
+#if BYTE_ORDER == LITTLE_ENDIAN
 	u_char	control:4;
 	u_char	addr_type:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	u_char	addr_type:4;
+	u_char	control:4;
+#endif
 	u_char	track;
 	u_char	nothing2;
 	u_char	addr[4];
@@ -26,10 +32,50 @@
 	u_char	data_len[2];
 };
 
+struct cd_sub_channel_q_data {
+	u_char	data_format;
+#if BYTE_ORDER == LITTLE_ENDIAN
+	u_char	control:4;
+	u_char	addr_type:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	u_char	addr_type:4;
+	u_char	control:4;
+#endif
+	u_char	track_number;
+	u_char	index_number;
+	u_char	absaddr[4];
+	u_char	reladdr[4];
+#if BYTE_ORDER == LITTLE_ENDIAN
+        u_char  :7;
+        u_char  mc_valid:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+        u_char  mc_valid:1;
+        u_char  :7;
+#endif
+        u_char  mc_number[15]; 
+#if BYTE_ORDER == LITTLE_ENDIAN
+        u_char  :7;
+        u_char  ti_valid:1;   
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+        u_char  ti_valid:1;   
+        u_char  :7;
+#endif
+        u_char  ti_number[15]; 
+};
+
 struct cd_sub_channel_position_data {
 	u_char	data_format;
+#if BYTE_ORDER == LITTLE_ENDIAN
 	u_char	control:4;
 	u_char	addr_type:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	u_char	addr_type:4;
+	u_char	control:4;
+#endif
 	u_char	track_number;
 	u_char	index_number;
 	u_char	absaddr[4];
@@ -41,8 +87,14 @@
 	u_char	nothing1;
 	u_char	nothing2;
 	u_char	nothing3;
+#if BYTE_ORDER == LITTLE_ENDIAN
 	u_char	:7;
 	u_char	mc_valid:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	u_char	mc_valid:1;
+	u_char	:7;
+#endif
 	u_char	mc_number[15];
 };
 
@@ -51,14 +103,21 @@
 	u_char	nothing1;
 	u_char	track_number;
 	u_char	nothing2;
+#if BYTE_ORDER == LITTLE_ENDIAN
 	u_char	:7;
 	u_char	ti_valid:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+	u_char	ti_valid:1;
+	u_char	:7;
+#endif
 	u_char	ti_number[15];
 };
 
 struct cd_sub_channel_info {
 	struct cd_sub_channel_header header;
 	union {
+		struct cd_sub_channel_q_data q_data;
 		struct cd_sub_channel_position_data position;
 		struct cd_sub_channel_media_catalog media_catalog;
 		struct cd_sub_channel_track_info track_info;
>Audit-Trail:
>Unformatted: