From nobody Wed May 14 05:28:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524671571216807.3207119552881; Wed, 25 Apr 2018 08:52:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8EB2FC04B94A; Wed, 25 Apr 2018 15:52:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08EDB6B8C3; Wed, 25 Apr 2018 15:52:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1061818033EB; Wed, 25 Apr 2018 15:52:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFqkBI026740 for ; Wed, 25 Apr 2018 11:52:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87813202323A; Wed, 25 Apr 2018 15:52:46 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE2342023239; Wed, 25 Apr 2018 15:52:45 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 16:52:39 +0100 Message-Id: <20180425155243.23406-3-berrange@redhat.com> In-Reply-To: <20180425155243.23406-1-berrange@redhat.com> References: <20180425155243.23406-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/6] storage: split gluster storage file code from storage driver backend X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 25 Apr 2018 15:52:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 The storage file code needs to be run in the hypervisor drivers, while the storage backend code needs to be run in the storage driver. Split the source code as a preparatory step for creating separate loadable modules. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/storage/Makefile.inc.am | 2 + src/storage/storage_backend_gluster.c | 305 +--------------------------- src/storage/storage_backend_gluster.h | 2 +- src/storage/storage_file_gluster.c | 366 ++++++++++++++++++++++++++++++= ++++ src/storage/storage_file_gluster.h | 27 +++ 5 files changed, 399 insertions(+), 303 deletions(-) create mode 100644 src/storage/storage_file_gluster.c create mode 100644 src/storage/storage_file_gluster.h diff --git a/src/storage/Makefile.inc.am b/src/storage/Makefile.inc.am index ae9fdeb6a9..1e81249272 100644 --- a/src/storage/Makefile.inc.am +++ b/src/storage/Makefile.inc.am @@ -55,6 +55,8 @@ STORAGE_DRIVER_SHEEPDOG_SOURCES =3D \ STORAGE_DRIVER_GLUSTER_SOURCES =3D \ storage/storage_backend_gluster.h \ storage/storage_backend_gluster.c \ + storage/storage_file_gluster.h \ + storage/storage_file_gluster.c \ $(NULL) =20 STORAGE_DRIVER_ZFS_SOURCES =3D \ diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_ba= ckend_gluster.c index c6cc531e2f..aca772676c 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -1,7 +1,7 @@ /* * storage_backend_gluster.c: storage backend for Gluster handling * - * Copyright (C) 2013-2014 Red Hat, Inc. + * Copyright (C) 2013-2018 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,11 +24,11 @@ #include =20 #include "storage_backend_gluster.h" +#include "storage_file_gluster.h" #include "storage_conf.h" #include "viralloc.h" #include "virerror.h" #include "virlog.h" -#include "virstoragefilebackend.h" #include "virstring.h" #include "viruri.h" #include "storage_util.h" @@ -561,312 +561,13 @@ virStorageBackend virStorageBackendGluster =3D { }; =20 =20 -typedef struct _virStorageFileBackendGlusterPriv virStorageFileBackendGlus= terPriv; -typedef virStorageFileBackendGlusterPriv *virStorageFileBackendGlusterPriv= Ptr; - -struct _virStorageFileBackendGlusterPriv { - glfs_t *vol; - char *canonpath; -}; - - -static void -virStorageFileBackendGlusterDeinit(virStorageSourcePtr src) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - - VIR_DEBUG("deinitializing gluster storage file %p (gluster://%s:%u/%s%= s)", - src, src->hosts->name, src->hosts->port, src->volume, src->p= ath); - - if (priv->vol) - glfs_fini(priv->vol); - VIR_FREE(priv->canonpath); - - VIR_FREE(priv); - src->drv->priv =3D NULL; -} - -static int -virStorageFileBackendGlusterInitServer(virStorageFileBackendGlusterPrivPtr= priv, - virStorageNetHostDefPtr host) -{ - const char *transport =3D virStorageNetHostTransportTypeToString(host-= >transport); - const char *hoststr =3D NULL; - int port =3D 0; - - switch ((virStorageNetHostTransport) host->transport) { - case VIR_STORAGE_NET_HOST_TRANS_RDMA: - case VIR_STORAGE_NET_HOST_TRANS_TCP: - hoststr =3D host->name; - port =3D host->port; - break; - - case VIR_STORAGE_NET_HOST_TRANS_UNIX: - hoststr =3D host->socket; - break; - - case VIR_STORAGE_NET_HOST_TRANS_LAST: - break; - } - - VIR_DEBUG("adding gluster host for %p: transport=3D%s host=3D%s port= =3D%d", - priv, transport, hoststr, port); - - if (glfs_set_volfile_server(priv->vol, transport, hoststr, port) < 0) { - virReportSystemError(errno, - _("failed to set gluster volfile server '%s'"= ), - hoststr); - return -1; - } - - return 0; -} - - -static int -virStorageFileBackendGlusterInit(virStorageSourcePtr src) -{ - virStorageFileBackendGlusterPrivPtr priv =3D NULL; - size_t i; - - if (!src->volume) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing gluster volume name for path '%s'"), - src->path); - return -1; - } - - if (VIR_ALLOC(priv) < 0) - return -1; - - VIR_DEBUG("initializing gluster storage file %p " - "(priv=3D'%p' volume=3D'%s' path=3D'%s') as [%u:%u]", - src, priv, src->volume, src->path, - (unsigned int)src->drv->uid, (unsigned int)src->drv->gid); - - if (!(priv->vol =3D glfs_new(src->volume))) { - virReportOOMError(); - goto error; - } - - for (i =3D 0; i < src->nhosts; i++) { - if (virStorageFileBackendGlusterInitServer(priv, src->hosts + i) <= 0) - goto error; - } - - if (glfs_init(priv->vol) < 0) { - virReportSystemError(errno, - _("failed to initialize gluster connection " - "(src=3D%p priv=3D%p)"), src, priv); - goto error; - } - - src->drv->priv =3D priv; - - return 0; - - error: - if (priv->vol) - glfs_fini(priv->vol); - VIR_FREE(priv); - - return -1; -} - - -static int -virStorageFileBackendGlusterCreate(virStorageSourcePtr src) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - glfs_fd_t *fd =3D NULL; - mode_t mode =3D S_IRUSR; - - if (!src->readonly) - mode |=3D S_IWUSR; - - if (!(fd =3D glfs_creat(priv->vol, src->path, - O_CREAT | O_TRUNC | O_WRONLY, mode))) - return -1; - - ignore_value(glfs_close(fd)); - return 0; -} - - -static int -virStorageFileBackendGlusterUnlink(virStorageSourcePtr src) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - - return glfs_unlink(priv->vol, src->path); -} - - -static int -virStorageFileBackendGlusterStat(virStorageSourcePtr src, - struct stat *st) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - - return glfs_stat(priv->vol, src->path, st); -} - - -static ssize_t -virStorageFileBackendGlusterRead(virStorageSourcePtr src, - size_t offset, - size_t len, - char **buf) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - glfs_fd_t *fd =3D NULL; - ssize_t ret =3D -1; - - *buf =3D NULL; - - if (!(fd =3D glfs_open(priv->vol, src->path, O_RDONLY))) { - virReportSystemError(errno, _("Failed to open file '%s'"), - src->path); - return -1; - } - - if (offset > 0) { - if (glfs_lseek(fd, offset, SEEK_SET) =3D=3D (off_t) -1) { - virReportSystemError(errno, _("cannot seek into '%s'"), src->p= ath); - goto cleanup; - } - } - - ret =3D virStorageBackendGlusterRead(fd, src->path, len, buf); - - cleanup: - if (fd) - glfs_close(fd); - - return ret; -} - - -static int -virStorageFileBackendGlusterAccess(virStorageSourcePtr src, - int mode) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - - return glfs_access(priv->vol, src->path, mode); -} - -static int -virStorageFileBackendGlusterReadlinkCallback(const char *path, - char **linkpath, - void *data) -{ - virStorageFileBackendGlusterPrivPtr priv =3D data; - char *buf =3D NULL; - size_t bufsiz =3D 0; - ssize_t ret; - struct stat st; - - *linkpath =3D NULL; - - if (glfs_stat(priv->vol, path, &st) < 0) { - virReportSystemError(errno, - _("failed to stat gluster path '%s'"), - path); - return -1; - } - - if (!S_ISLNK(st.st_mode)) - return 1; - - realloc: - if (VIR_EXPAND_N(buf, bufsiz, 256) < 0) - goto error; - - if ((ret =3D glfs_readlink(priv->vol, path, buf, bufsiz)) < 0) { - virReportSystemError(errno, - _("failed to read link of gluster file '%s'"), - path); - goto error; - } - - if (ret =3D=3D bufsiz) - goto realloc; - - buf[ret] =3D '\0'; - - *linkpath =3D buf; - - return 0; - - error: - VIR_FREE(buf); - return -1; -} - - -static const char * -virStorageFileBackendGlusterGetUniqueIdentifier(virStorageSourcePtr src) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - char *filePath =3D NULL; - - if (priv->canonpath) - return priv->canonpath; - - if (!(filePath =3D virStorageFileCanonicalizePath(src->path, - virStorageFileBackendG= lusterReadlinkCallback, - priv))) - return NULL; - - ignore_value(virAsprintf(&priv->canonpath, "gluster://%s:%u/%s/%s", - src->hosts->name, - src->hosts->port, - src->volume, - filePath)); - - VIR_FREE(filePath); - - return priv->canonpath; -} - - -static int -virStorageFileBackendGlusterChown(const virStorageSource *src, - uid_t uid, - gid_t gid) -{ - virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; - - return glfs_chown(priv->vol, src->path, uid, gid); -} - - -virStorageFileBackend virStorageFileBackendGluster =3D { - .type =3D VIR_STORAGE_TYPE_NETWORK, - .protocol =3D VIR_STORAGE_NET_PROTOCOL_GLUSTER, - - .backendInit =3D virStorageFileBackendGlusterInit, - .backendDeinit =3D virStorageFileBackendGlusterDeinit, - - .storageFileCreate =3D virStorageFileBackendGlusterCreate, - .storageFileUnlink =3D virStorageFileBackendGlusterUnlink, - .storageFileStat =3D virStorageFileBackendGlusterStat, - .storageFileRead =3D virStorageFileBackendGlusterRead, - .storageFileAccess =3D virStorageFileBackendGlusterAccess, - .storageFileChown =3D virStorageFileBackendGlusterChown, - - .storageFileGetUniqueIdentifier =3D virStorageFileBackendGlusterGetUni= queIdentifier, -}; - - int virStorageBackendGlusterRegister(void) { if (virStorageBackendRegister(&virStorageBackendGluster) < 0) return -1; =20 - if (virStorageFileBackendRegister(&virStorageFileBackendGluster) < 0) + if (virStorageFileGlusterRegister() < 0) return -1; =20 return 0; diff --git a/src/storage/storage_backend_gluster.h b/src/storage/storage_ba= ckend_gluster.h index 91b8d8275d..12a1c04f8d 100644 --- a/src/storage/storage_backend_gluster.h +++ b/src/storage/storage_backend_gluster.h @@ -1,7 +1,7 @@ /* * storage_backend_gluster.h: storage backend for Gluster handling * - * Copyright (C) 2013 Red Hat, Inc. + * Copyright (C) 2013-2018 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/storage/storage_file_gluster.c b/src/storage/storage_file_= gluster.c new file mode 100644 index 0000000000..f8bbde8cfe --- /dev/null +++ b/src/storage/storage_file_gluster.c @@ -0,0 +1,366 @@ +/* + * storage_file_gluster.c: storage file backend for Gluster handling + * + * Copyright (C) 2013-2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + */ + +#include + +#include + +#include "storage_file_gluster.h" +#include "viralloc.h" +#include "virerror.h" +#include "virlog.h" +#include "virstoragefilebackend.h" +#include "virstring.h" + +#define VIR_FROM_THIS VIR_FROM_STORAGE + +VIR_LOG_INIT("storage.storage_file_gluster"); + + +typedef struct _virStorageFileBackendGlusterPriv virStorageFileBackendGlus= terPriv; +typedef virStorageFileBackendGlusterPriv *virStorageFileBackendGlusterPriv= Ptr; + +struct _virStorageFileBackendGlusterPriv { + glfs_t *vol; + char *canonpath; +}; + +static void +virStorageFileBackendGlusterDeinit(virStorageSourcePtr src) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + + VIR_DEBUG("deinitializing gluster storage file %p (gluster://%s:%u/%s%= s)", + src, src->hosts->name, src->hosts->port, src->volume, src->p= ath); + + if (priv->vol) + glfs_fini(priv->vol); + VIR_FREE(priv->canonpath); + + VIR_FREE(priv); + src->drv->priv =3D NULL; +} + +static int +virStorageFileBackendGlusterInitServer(virStorageFileBackendGlusterPrivPtr= priv, + virStorageNetHostDefPtr host) +{ + const char *transport =3D virStorageNetHostTransportTypeToString(host-= >transport); + const char *hoststr =3D NULL; + int port =3D 0; + + switch ((virStorageNetHostTransport) host->transport) { + case VIR_STORAGE_NET_HOST_TRANS_RDMA: + case VIR_STORAGE_NET_HOST_TRANS_TCP: + hoststr =3D host->name; + port =3D host->port; + break; + + case VIR_STORAGE_NET_HOST_TRANS_UNIX: + hoststr =3D host->socket; + break; + + case VIR_STORAGE_NET_HOST_TRANS_LAST: + break; + } + + VIR_DEBUG("adding gluster host for %p: transport=3D%s host=3D%s port= =3D%d", + priv, transport, hoststr, port); + + if (glfs_set_volfile_server(priv->vol, transport, hoststr, port) < 0) { + virReportSystemError(errno, + _("failed to set gluster volfile server '%s'"= ), + hoststr); + return -1; + } + + return 0; +} + + +static int +virStorageFileBackendGlusterInit(virStorageSourcePtr src) +{ + virStorageFileBackendGlusterPrivPtr priv =3D NULL; + size_t i; + + if (!src->volume) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing gluster volume name for path '%s'"), + src->path); + return -1; + } + + if (VIR_ALLOC(priv) < 0) + return -1; + + VIR_DEBUG("initializing gluster storage file %p " + "(priv=3D'%p' volume=3D'%s' path=3D'%s') as [%u:%u]", + src, priv, src->volume, src->path, + (unsigned int)src->drv->uid, (unsigned int)src->drv->gid); + + if (!(priv->vol =3D glfs_new(src->volume))) { + virReportOOMError(); + goto error; + } + + for (i =3D 0; i < src->nhosts; i++) { + if (virStorageFileBackendGlusterInitServer(priv, src->hosts + i) <= 0) + goto error; + } + + if (glfs_init(priv->vol) < 0) { + virReportSystemError(errno, + _("failed to initialize gluster connection " + "(src=3D%p priv=3D%p)"), src, priv); + goto error; + } + + src->drv->priv =3D priv; + + return 0; + + error: + if (priv->vol) + glfs_fini(priv->vol); + VIR_FREE(priv); + + return -1; +} + + +static int +virStorageFileBackendGlusterCreate(virStorageSourcePtr src) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + glfs_fd_t *fd =3D NULL; + mode_t mode =3D S_IRUSR; + + if (!src->readonly) + mode |=3D S_IWUSR; + + if (!(fd =3D glfs_creat(priv->vol, src->path, + O_CREAT | O_TRUNC | O_WRONLY, mode))) + return -1; + + ignore_value(glfs_close(fd)); + return 0; +} + + +static int +virStorageFileBackendGlusterUnlink(virStorageSourcePtr src) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + + return glfs_unlink(priv->vol, src->path); +} + + +static int +virStorageFileBackendGlusterStat(virStorageSourcePtr src, + struct stat *st) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + + return glfs_stat(priv->vol, src->path, st); +} + + +static ssize_t +virStorageFileBackendGlusterRead(virStorageSourcePtr src, + size_t offset, + size_t len, + char **buf) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + glfs_fd_t *fd =3D NULL; + ssize_t ret =3D -1; + char *s; + size_t nread =3D 0; + + *buf =3D NULL; + + if (!(fd =3D glfs_open(priv->vol, src->path, O_RDONLY))) { + virReportSystemError(errno, _("Failed to open file '%s'"), + src->path); + return -1; + } + + if (offset > 0) { + if (glfs_lseek(fd, offset, SEEK_SET) =3D=3D (off_t) -1) { + virReportSystemError(errno, _("cannot seek into '%s'"), src->p= ath); + goto cleanup; + } + } + + + if (VIR_ALLOC_N(*buf, len) < 0) + return -1; + + s =3D *buf; + while (len) { + ssize_t r =3D glfs_read(fd, s, len, 0); + if (r < 0 && errno =3D=3D EINTR) + continue; + if (r < 0) { + VIR_FREE(*buf); + virReportSystemError(errno, _("unable to read '%s'"), src->pat= h); + return r; + } + if (r =3D=3D 0) + return nread; + s +=3D r; + len -=3D r; + nread +=3D r; + } + + ret =3D nread; + + cleanup: + if (fd) + glfs_close(fd); + + return ret; +} + + +static int +virStorageFileBackendGlusterAccess(virStorageSourcePtr src, + int mode) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + + return glfs_access(priv->vol, src->path, mode); +} + +static int +virStorageFileBackendGlusterReadlinkCallback(const char *path, + char **linkpath, + void *data) +{ + virStorageFileBackendGlusterPrivPtr priv =3D data; + char *buf =3D NULL; + size_t bufsiz =3D 0; + ssize_t ret; + struct stat st; + + *linkpath =3D NULL; + + if (glfs_stat(priv->vol, path, &st) < 0) { + virReportSystemError(errno, + _("failed to stat gluster path '%s'"), + path); + return -1; + } + + if (!S_ISLNK(st.st_mode)) + return 1; + + realloc: + if (VIR_EXPAND_N(buf, bufsiz, 256) < 0) + goto error; + + if ((ret =3D glfs_readlink(priv->vol, path, buf, bufsiz)) < 0) { + virReportSystemError(errno, + _("failed to read link of gluster file '%s'"), + path); + goto error; + } + + if (ret =3D=3D bufsiz) + goto realloc; + + buf[ret] =3D '\0'; + + *linkpath =3D buf; + + return 0; + + error: + VIR_FREE(buf); + return -1; +} + + +static const char * +virStorageFileBackendGlusterGetUniqueIdentifier(virStorageSourcePtr src) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + char *filePath =3D NULL; + + if (priv->canonpath) + return priv->canonpath; + + if (!(filePath =3D virStorageFileCanonicalizePath(src->path, + virStorageFileBackendG= lusterReadlinkCallback, + priv))) + return NULL; + + ignore_value(virAsprintf(&priv->canonpath, "gluster://%s:%u/%s/%s", + src->hosts->name, + src->hosts->port, + src->volume, + filePath)); + + VIR_FREE(filePath); + + return priv->canonpath; +} + + +static int +virStorageFileBackendGlusterChown(const virStorageSource *src, + uid_t uid, + gid_t gid) +{ + virStorageFileBackendGlusterPrivPtr priv =3D src->drv->priv; + + return glfs_chown(priv->vol, src->path, uid, gid); +} + + +virStorageFileBackend virStorageFileBackendGluster =3D { + .type =3D VIR_STORAGE_TYPE_NETWORK, + .protocol =3D VIR_STORAGE_NET_PROTOCOL_GLUSTER, + + .backendInit =3D virStorageFileBackendGlusterInit, + .backendDeinit =3D virStorageFileBackendGlusterDeinit, + + .storageFileCreate =3D virStorageFileBackendGlusterCreate, + .storageFileUnlink =3D virStorageFileBackendGlusterUnlink, + .storageFileStat =3D virStorageFileBackendGlusterStat, + .storageFileRead =3D virStorageFileBackendGlusterRead, + .storageFileAccess =3D virStorageFileBackendGlusterAccess, + .storageFileChown =3D virStorageFileBackendGlusterChown, + + .storageFileGetUniqueIdentifier =3D virStorageFileBackendGlusterGetUni= queIdentifier, +}; + + +int +virStorageFileGlusterRegister(void) +{ + if (virStorageFileBackendRegister(&virStorageFileBackendGluster) < 0) + return -1; + + return 0; +} diff --git a/src/storage/storage_file_gluster.h b/src/storage/storage_file_= gluster.h new file mode 100644 index 0000000000..572254aedb --- /dev/null +++ b/src/storage/storage_file_gluster.h @@ -0,0 +1,27 @@ +/* + * storage_file_gluster.h: storage file backend for Gluster handling + * + * Copyright (C) 2013-2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + */ + +#ifndef __VIR_STORAGE_FILE_GLUSTER_H__ +# define __VIR_STORAGE_FILE_GLUSTER_H__ + +int virStorageFileGlusterRegister(void); + +#endif /* __VIR_STORAGE_FILE_GLUSTER_H__ */ --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list