On Sat, May 05, 2007 at 11:25:00AM +0100, Richard W.M. Jones wrote:
Below is the definition of struct _virDomain from internal.h. I may
be
missing something big (well, it wouldn't be the first time), but as far
as I can see some of these fields are never used, and some are set but
can never be read.
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.
ACK, I'm all for removing code which isn't used. If we really need it
in the future its all there in CVS history / trivially re-introducable.
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 -=|