Re: C bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 11, 2007 at 12:47:34PM +0000, Richard W.M. Jones wrote:
> Katti, Vadiraj (STSD-Openview) wrote:
> >Hi Richard,
> >
> >DOMFLAGS_DYING is available in dom0_ops.h
> >
> ># find /usr/include -name '*.h' | xargs grep DOMFLAGS_DYING
> >/usr/include/xen/dom0_ops.h:#define DOMFLAGS_DYING     (1<<0) /* Domain
> >is scheduled to die.             */
> 
> I'm pretty certain this is a bug in libvirt, introduced by this patch:
> 
> http://www.redhat.com/archives/libvir-list/2007-April/msg00078.html
> 
> I think Dan's probably the best one to tell us what's going on here, but 
> from my understanding the patch above is wrong and should have instead 
> added this:
> 
> #ifndef DOMFLAGS_HVM
> #define DOMFLAGS_HVM (1<<1)
> #endif

Well the existing code block is this

#ifndef DOMFLAGS_DYING
#define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
#define DOMFLAGS_HVM       (1<<1) /* Domain is HVM                           */
#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut down.             */
#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
#define DOMFLAGS_BLOCKED   (1<<4) /* Currently blocked pending an event.     */
#define DOMFLAGS_RUNNING   (1<<5) /* Domain is currently running.            */
#define DOMFLAGS_CPUMASK      255 /* CPU to which this domain is bound.      */
#define DOMFLAGS_CPUSHIFT       8
#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
#define DOMFLAGS_SHUTDOWNSHIFT 16
#endif

So, all the DOMFLAGS_* constants are defined if we don't already have
them. Current Xen headers don't define any of the DOMFLAGS_* values,
but it seems older headers do define some, but not all, which is why 
we end up missing the _HVM flag. 

To be honest, we should have simply #define'd them all ourselves with a
different namespace to the public Xen headers. We should't rely on any
stuff in the Xen headers since we know they chance that at will.

> #ifdef DOMFLAGS_HVM
> domain_flags &= ~DOMFLAGS_HVM; /* Mask out HVM flags */
> #endif

This #ifdef is unneccessary, since the code higher up should always
define DOMFLAGS_HVM.

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]