[klibc] bunch of small fixes
Nigel Cunningham
ncunningham at crca.org.au
Fri Mar 28 18:18:58 PDT 2008
Hi again.
On Fri, 2008-03-28 at 16:30 -0700, H. Peter Anvin wrote:
> Nigel Cunningham wrote:
> >
> > Not being a shell guru, I'm not sure what the simplest way is to get
> > 0xedc302e99856e50c into the start of a file. Can you help there?
> >
>
> It depends on what byte order you want to use (it should match the byte
> order of the other fields), but for littleendian, you can do:
>
> printf '\x0c\xe5\x56\x98\xe9\x02\xc3\xed' > file
>
> or
>
> echo -ne '\x0c\xe5\x56\x98\xe9\x02\xc3\xed' > file
>
> What I mean with "match the byte order of the other fields" - if you
> have no fields which are host-byte-order-dependent, just pick a specific
> byte sequence (like the above one) and stick to it. If you *have*
> fields which are host-byte-order-dependent, then you probably want to
> have the magic be endian-sensitive too, unless you have a separate byte
> order field.
Thanks for the reply.
One more thing occurred to me while I was out. This signature, too,
changes at the moment when we have an image (TuxOnIce -> HaveImage). Are
you only interested in checking whether we have an image, or whether
there's a valid signature there as well?
If you're only interested in whether there's a valid signature, I could
keep this value constant and put the information as to whether there's
an image later. If you want to be able to tell if there's an image, I'll
do a separate (binary) value for when one does exist.
Regarding endianness, I don't think that's an issue here, since the
normal case is for the computer writing the data to be the one reading
it back. The only possibility I can see for an exception is some
debugging tool that hasn't yet been invented, but even then, I'd expect
it to run on the same computer. Am I missing anything? (I'm really just
a user who wanted a better hibernate implementation than swsusp - I've
no problem with admitting my ignorance of the fine details of computer
science!).
Nigel
More information about the klibc
mailing list