Dave Miller wrote on 04/25/2008 10:31:30 PM:Isn't that appropriate in the general case? If the architecture actually required 8-byte alignment to access the type and we only have 4-byte alignment because the app was compiled with different (32 bit) alignment rules, then we'd fault if we forced the alignment and accessed it directly. That's why we don't access it directly. In these, we're using the (byte) copy functions to get the (totally inappropriately aligned because it wasn't compiled in 64-bit mode) data to the well behaved and aligned in-kernel copy of the struct and from there (only) do we access them as structured objects. If the copy code is clever enough to use word copies when alignment allows, and byte copies for the ends, then all we have to care about is that the byte-offset we copy from is correct for the app-compiled architecture. I don't think the point is that important here, because all of these methods identically describe the 32-bit data layout (which is all we need-- could even use a char array for the source data since we know the offsets very well!), and we use the copy functions to get it to the layout we need. So I may be missing your point, but I don't need to belabor it all the same. :-) The only reason I didn't want to use aligned(4) for sockaddr_storage is because it's just another single-use declaration. It seems to me plain old packed is defined by the C language to have the proper offsets on all architectures for these declarations, and all of these others modifications are no better since they all lead to the same thing. But so would (char *)optval + 4; as the start of the gr_group, say. We don't use the compat struct's for anything but a handy way to describe those byte offsets. Anyway, I belabored. I'll change to aligned(4) with compat_sockaddr_storage declaration... If I did see that plain old structure field __attribute((4))__ wasn't correct (still padded), and gcc docs use the same language to define the behavior for structure field attribute "aligned" and type attribute "aligned" (at least with my limited research). So, it surprised me that the field attribute results in pad and the type attribute doesn't, and I wonder if it's good to rely on that difference given the same documentation for both as "minimum alignment". But if the compiler changes its notion of when to pad this in a way that breaks it, we can always revisit it later. :-) +-DLS -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
git: | |
| Elijah Newren | Trying to use git-filter-branch to compress history by removing large, obsolete bi... |
| Raimund Bauer | [wishlist] graphical diff |
| Paolo Ciarrocchi | git --version |
| Junio C Hamano | Re: Implementing branch attributes in git config |
| Renato S. Yamane | Error -71 on device descriptor read/all |
| Luke -Jr | Re: bcm33xx port |
| Rik van Riel | [PATCH -mm 00/24] VM pageout scalability improvements (V12) |
| Willy Tarreau | Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS] |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| qw er | OpenBSD sucks |
| Predrag Punosevac | Re: cwm keybindings misbehavior |
| Steve B | Intel Atom and D945GCLF2 |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| C Wayne Huling | Re: Can males come from... |
| David Willmore | Re: Intel, the Pentium and Linux |
| Al Billings | Porting MUDS |
