[libvirt] [PATCHv5 01/28] storage: Implement virStorageFileCreate for local and gluster files

Eric Blake eblake at redhat.com
Mon Jul 7 22:55:32 UTC 2014


On 07/04/2014 05:29 AM, Peter Krempa wrote:
> Add backends for this frontend function so that we can use it in the
> snapshot creation code.
> ---
>  src/storage/storage_backend_fs.c      | 17 +++++++++++++++++
>  src/storage/storage_backend_gluster.c | 28 ++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
> 

>  static int
> +virStorageFileBackendGlusterCreate(virStorageSourcePtr src)
> +{
> +    virStorageFileBackendGlusterPrivPtr priv = src->drv->priv;
> +    glfs_fd_t *fd = NULL;
> +    int save_errno;
> +    int ret = -1;
> +
> +    if (!(fd = glfs_open(priv->vol, src->path, O_CREAT | O_TRUNC | O_WRONLY)))
> +        return -1;
> +
> +    if (src->drv->uid != 0 || src->drv->gid != 0) {

Isn't our sentinel value -1 for default? I think that comparison against
0 is likely to be wrong for running qemu:///session.

ACK with this change:

if (src->drv->uid != (uid_t)-1 || src->drv->gid != (gid_t)-1) {

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140707/0ef6df43/attachment-0001.sig>


More information about the libvir-list mailing list