On 01/24/2011 08:13 AM, Daniel P. Berrange wrote: > A lock manager may operate in various modes. The direct mode of > operation is to obtain locks based on the resources associated > with devices in the XML. The indirect mode is where the app > creating the domain provides explicit leases for each resource > that needs to be locked. This XML extension allows for listing > resources in the XML > > <leases> > <lease> > <key>thequickbrownfoxjumpsoverthelazydog</key> > <target path='/some/lease/path' offset='23432' length='256'/> > </lease> > </leases> > > * docs/schemas/domain.rng: Add lease schema > * src/conf/domain_conf.c, src/conf/domain_conf.h: parsing and > formatting for leases > * tests/qemuxml2argvdata/qemuxml2argv-lease.args, > tests/qemuxml2argvdata/qemuxml2argv-lease.xml, > tests/qemuxml2xmltest.c: Test XML handling for leases > --- > docs/schemas/domain.rng | 32 ++++++
docs/formatdomain.html.in
You can't escape writing docs, no matter how hard you try :)
>
> +static void virDomainLeaseDefFree(virDomainLeaseDefPtr def)
> +{
> + if (!def)
> + return;
Add this to the free-like functions in cfg.mk.
> static int
> +virDomainLeaseDefFormat(virBufferPtr buf,
> + virDomainLeaseDefPtr def)
> +{
> + virBufferAddLit(buf, " <lease>\n");
> + virBufferEscapeString(buf, " <key>%s</key>\n", def->key);
> + virBufferEscapeString(buf, " <target path='%s'", def->path);
> + if (def->offset)
> + virBufferVSprintf(buf, " offset='%llu'", def->offset);
> + if (def->length)
> + virBufferVSprintf(buf, " length='%llu'", def->length);
> + virBufferAddLit(buf, "/>\n");
> + virBufferAddLit(buf, " </lease>\n");
The last two lines could be merged, but I'm not picky.
> +typedef virDomainLeaseDef *virDomainLeaseDefPtr;
> +struct _virDomainLeaseDef {
> + char *key;
> + char *path;
> + unsigned long long offset;
> + unsigned long long length;
Do we want to use off_t instead of unsigned long long? Then again, I
don't think it matters that much in practice (for all practical porting
targets, ull is 64-bits, and gnulib pretty much guarantees that off_t is
64-bits).
I'd like to ACK this with the nits fixed, but should I really do that
without documentation?...
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
