On Thu, Nov 07, 2019 at 19:06:29 +0100, Martin Husemann wrote: > OK, why is it 8 byte aligned? Checking.... > > > revision 1.108 > > date: 2011-01-18 20:52:24 +0100; author: matt; state: Exp; lines: +2 -1; > > Make struct disklabel 8 byte aligned. This increases its size by 4 bytes > > on IPL32 platforms so add code in sys_ioctl (and netbsd32_ioctl) to deal > > with the older/smaller diskabel size. This change makes disklabel the > > same for both IPL32 and LP64 platforms. > > Argh! Somehow I dimly remember having been here already ... > I think I proposed to change the loop to 8 byte increments back then, but > noone knows what odd systems it will the stop working on (none at all is my > personal bet).
I gather the alignment mess is caused by pointers d_un.un_b.un_d_boot0 and d_un.un_b.un_d_boot1 that are inside the d_un union and are NOT part of the actual disklabel: "These are returned when using getdiskbyname(3) to retrieve the values from /etc/disktab." So that was completely self-inflicted. The loop is fine for the on-disk structure. Now the question is how to dig our way out of this, b/c unfortunately it's a public interface. But the mindless memcpy should be the last resort IMO. -uwe