struct _virDomain { unsigned int magic; /* specific value to check */ OK int uses; /* reference count */ OK virConnectPtr conn; /* pointer back to the connection */ OK char *name; /* the domain external name */ OK char *path; /* the domain internal path */This field is set in src/xs_internal.c, but nowhere in libvirt does it appear to be read. The only other time it is reference is in hash.c where it is freed if non-NULL.
int id; /* the domain ID */ OK int flags; /* extra flags */Apparently this field could be set to DOMAIN_IS_SHUTDOWN or DOMAIN_IS_DEFINED. However neither of these symbols are used, and moreover this structure field looks like it is never written or read.
unsigned char uuid[VIR_UUID_BUFLEN]; /* the domain unique identifier */ OK char *xml; /* the XML description for defined domains */This field is, as far as I can tell, never set anywhere. However the code in hash.c does check whether it is set and will free it upon destruction of the _virDomain object.
};With this analysis in mind, attached is a patch which removes these three fields (path, flags, xml) and the unused virDomainFlags, with no apparent ill-effects.
Rich. -- Emerging Technologies, Red Hat http://et.redhat.com/~rjones/ 64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421 Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland)
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/hash.c libvirt-domain-ptr-fields/src/hash.c --- libvirt-cvs/src/hash.c 2007-04-04 15:39:43.000000000 +0100 +++ libvirt-domain-ptr-fields/src/hash.c 2007-05-05 11:17:55.000000000 +0100 @@ -840,10 +840,6 @@ } domain->magic = -1; domain->id = -1; - if (domain->path != NULL) - free(domain->path); - if (domain->xml) - free(domain->xml); if (domain->name) free(domain->name); free(domain); diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/internal.h libvirt-domain-ptr-fields/src/internal.h --- libvirt-cvs/src/internal.h 2007-04-26 11:23:39.000000000 +0100 +++ libvirt-domain-ptr-fields/src/internal.h 2007-05-05 11:16:56.000000000 +0100 @@ -139,17 +139,6 @@ }; /** -* virDomainFlags: -* -* a set of special flag values associated to the domain -*/ - -enum virDomainFlags { - DOMAIN_IS_SHUTDOWN = (1 << 0), /* the domain is being shutdown */ - DOMAIN_IS_DEFINED = (1 << 1) /* the domain is defined not running */ -}; - -/** * _virDomain: * * Internal structure associated to a domain @@ -159,11 +148,8 @@ int uses; /* reference count */ virConnectPtr conn; /* pointer back to the connection */ char *name; /* the domain external name */ - char *path; /* the domain internal path */ int id; /* the domain ID */ - int flags; /* extra flags */ unsigned char uuid[VIR_UUID_BUFLEN]; /* the domain unique identifier */ - char *xml; /* the XML description for defined domains */ }; /** diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/xs_internal.c libvirt-domain-ptr-fields/src/xs_internal.c --- libvirt-cvs/src/xs_internal.c 2007-05-05 11:15:48.000000000 +0100 +++ libvirt-domain-ptr-fields/src/xs_internal.c 2007-05-05 11:17:24.000000000 +0100 @@ -651,7 +651,6 @@ goto done; } ret->id = id; - ret->path = path; done: if (xenddomain != NULL)
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature