[Libguestfs] Patch to build hivex lib on Windows

Richard W.M. Jones rjones at redhat.com
Tue Sep 6 12:51:10 UTC 2011


On Sat, Sep 03, 2011 at 10:46:30PM +0200, Gillen Daniel wrote:
> mmap is exactly the problem. I didn't find it in gnulib or somewhere else.
> 
> I did some more research on how it could be done and I came up with
> the following. Definitely less invasive :) and full_read and
> full_write can be used again.
> 
> What do you think about that one?

The way to do this [mmap] patch less invasively is to use an autoconf
replacement function.  (Well actually a better way would be to add the
needed features to gnulib, but I'll assume that you don't want to do
that).

It's all documented here:

https://www.gnu.org/s/hello/manual/autoconf/Generic-Functions.html
https://www.gnu.org/s/hello/manual/automake/LIBOBJS.html

(see AC_LIBOBJ, AC_REPLACE_FUNCS etc).

>From upstream (ie. our) point of view, it means the replacement is
stuffed into another file that is only used on Windows and that we
don't have to worry about.  From your point of view the advantage is
that you can [in the replacement file] go wild with whatever Windows
specific includes and Win32 APIs you want.

> Oh, and there is another problem which I encountered while building
> on Windows and on Osx 10.7.
> 
> In Linux, "include/bits/byteswap.h" define __bswap_* functions and
> "include/byteswap.h" define those as bswap_*. Your
> "lib/byte_conversions.h" file uses the __bswap_* functions but when
> compiling on a system where byteswap.h does not exist and the gnulib
> byteswap.h file is used, there are no __bswap_* functions defined
> anymore resulting in the lib not being able to link.
> 
> Is there a special reason the __bswap_* functions were used and not
> the bswap_* ones?

The "reason" is probably "because it worked on Linux" :-)

I'll have a look at the other patch you posted.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list