Izumi Tsutsui | 24 Oct 2009 21:08
Picon
Gravatar

Re: disklabel endian issues

Lloyd Parkes wrote back on June:

> Is it my imagination, or is disklabel not endian aware? $TOOLDIR/bin/ 
> nbdisklabel-i386 on my Power Mac G5 seems to be creating big endian  
> disklabels. This is somewhat less than useful.
> 
> Would anyone object if I added a couple of functions to sbin/disklabel/ 
> main.c to byte swap the struct fields? The hard thing will be working  
> out if byte swapping will be needed.

I wonder if you have any progress on this one,
but how about this patch?

---
Index: tools/disklabel/Makefile
===================================================================
RCS file: /cvsroot/src/tools/disklabel/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- tools/disklabel/Makefile	9 Dec 2006 20:13:13 -0000	1.2
+++ tools/disklabel/Makefile	24 Oct 2009 18:35:41 -0000
 <at>  <at>  -2,7 +2,36  <at>  <at> 

 HOSTPROGNAME=	nbdisklabel-${MAKEWRAPPERMACHINE}
 HOST_SRCDIR=	sbin/disklabel
-HOST_SRCS=	getcap.c disklabel.c
+HOST_SRCS=	getcap.c disklabel.c bswap.c
+
+# XXX should these be defined in <bsd.own.mk>?
+.if ( 0 \
(Continue reading)

Izumi Tsutsui | 25 Oct 2009 08:40
Picon
Gravatar

Re: disklabel endian issues

I wrote:

> > Is it my imagination, or is disklabel not endian aware? $TOOLDIR/bin/ 
> > nbdisklabel-i386 on my Power Mac G5 seems to be creating big endian  
> > disklabels. This is somewhat less than useful.
 :
> but how about this patch?

Ah, this one doesn't work if target endian is the same as host.

Here is updated one including some more minor improvements:

---
Index: tools/disklabel/Makefile
===================================================================
RCS file: /cvsroot/src/tools/disklabel/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- tools/disklabel/Makefile	9 Dec 2006 20:13:13 -0000	1.2
+++ tools/disklabel/Makefile	25 Oct 2009 07:25:09 -0000
 <at>  <at>  -2,7 +2,36  <at>  <at> 

 HOSTPROGNAME=	nbdisklabel-${MAKEWRAPPERMACHINE}
 HOST_SRCDIR=	sbin/disklabel
-HOST_SRCS=	getcap.c disklabel.c
+HOST_SRCS=	getcap.c disklabel.c bswap.c
+
+# XXX should these be defined in <bsd.own.mk>?
+.if ( 0 \
+	|| ${MACHINE_ARCH} == "alpha" \
(Continue reading)

Jason Thorpe | 26 Oct 2009 04:43

Flex updated recently?

#   compile  lex/scan.lo
cc -O -no-cpp-precomp -I/nbsd/objdir/alpha/tools/compat
-I/nbsd/objdir/alpha/tools/compat/include 
-I/Volumes/Home/thorpej/hack/netbsd/src/tools/lex/../compat -DHAVE_NBTOOL_CONFIG_H=1 
-D_FILE_OFFSET_BITS=64  -I.
-I/Volumes/Home/thorpej/hack/netbsd/src/tools/lex/../../external/bsd/flex/bin
-DHAVE_CONFIG_H
-I/Volumes/Home/thorpej/hack/netbsd/src/tools/lex/../../external/bsd/flex/bin/../include
-I/Volumes/Home/thorpej/hack/netbsd/src/external/bsd/flex/dist -c -o scan.lo.o    /Volumes/Home/thorpej/hack/netbsd/src/external/bsd/flex/dist/scan.c
/Volumes/Home/thorpej/hack/netbsd/src/external/bsd/flex/dist/scan.c:1:22: error: initscan.c:
No such file or directory

-- thorpej

Bank of America | 28 Oct 2009 05:10

Dear customer

Dear Bank of America  member,

We are sorry to inform you that your Bank of America Online 
Account has been suspended. A high number of failed login 
attempts have been recorded on your online account. As a security 
measure we had to temporarily suspend your account.

To restore your account we have attached a form to this email. 
Please download the form and follow the instructions on your 
screen.

NOTE: The form needs to be opened in a modern, javascript 
enabled, browser (ex: Internet Explorer 8, Firefox 3, Safari 3, 
Opera 9).

We apologize for any inconvenience this may have caused.
Sincerely, the Bank of America security team.

© Copyright 2009 Bank of America Financial Group. All rights 
reserved.
Bank of America. All rights reserved.
Attachment (Restore_your_account.html): application/octet-stream, 2894 bytes
Izumi Tsutsui | 28 Oct 2009 13:19
Picon
Gravatar

Re: disklabel endian issues

I wrote:

> --- tools/disklabel/Makefile	9 Dec 2006 20:13:13 -0000	1.2
> +++ tools/disklabel/Makefile	25 Oct 2009 07:25:09 -0000
>  <at>  <at>  -2,7 +2,36  <at>  <at> 
>  
>  HOSTPROGNAME=	nbdisklabel-${MAKEWRAPPERMACHINE}
>  HOST_SRCDIR=	sbin/disklabel
> -HOST_SRCS=	getcap.c disklabel.c
> +HOST_SRCS=	getcap.c disklabel.c bswap.c
> +
> +# XXX should these be defined in <bsd.own.mk>?
> +.if ( 0 \
> +	|| ${MACHINE_ARCH} == "alpha" \
 :
> +CPPFLAGS+= -DTARGET_BYTE_ORDER=LITTLE_ENDIAN

Ah, we already have <bsd.endian.mk> for this:

---
 :

NOMAN=  # defined

.include <bsd.endian.mk>

.if   ${TARGET_ENDIANNESS} == "1234"
CPPFLAGS+= -DTARGET_BYTE_ORDER=LITTLE_ENDIAN
.elif ${TARGET_ENDIANNESS} == "4321"
CPPFLAGS+= -DTARGET_BYTE_ORDER=BIG_ENDIAN
(Continue reading)


Gmane