[libvirt] [PATCH] Add copy-on-write image support

Miloslav Trmač mitr at redhat.com
Mon Dec 15 14:54:25 UTC 2008


Daniel,
thanks for the review.

The attached patch should fix everything you pointed out, except for
this comment:
Daniel P. Berrange píše v St 10. 12. 2008 v 17:58 +0000:
> > +
> > +/**
> > + * Return an absolute path corresponding to PATH, which is absolute or relative
> > + * to the directory containing BASE_FILE, or NULL on error
> > + */
> > +static char *absolutePathFromBaseFile(const char *base_file, const char *path)
> > +{
> > +    size_t base_size, path_size;
> > +    char *res, *p;
> > +
> > +    if (*path == '/')
> > +	return strdup(path);
> > +
> > +    base_size = strlen(base_file) + 1;
> > +    path_size = strlen(path) + 1;
> > +    if (VIR_ALLOC_N(res, base_size - 1 + path_size) < 0)
> > +	return NULL;
> > +    memcpy(res, base_file, base_size);
> > +    p = strrchr(res, '/');
> > +    if (p != NULL)
> > +	p++;
> > +    else
> > +	p = res;
> > +    memcpy(p, path, path_size);
> > +    if (VIR_REALLOC_N(res, (p + path_size) - res) < 0) {
> > +	/* Ignore failure */
> > +    }
> > +    return res;
> > +}
> 
> Seeems like we could just call libc 'realpath' function here ?
realpath() is relative to the current directory, not to "path".
	Mirek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-cow2.patch
Type: text/x-patch
Size: 16495 bytes
Desc: 
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20081215/a87d6561/attachment-0001.bin>


More information about the libvir-list mailing list