From 910d8ae6ed4de9cdc9eae44403fa1512c45cbaed Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 30 Mar 2014 19:01:23 -0400 Subject: [PATCH] storage: Rename VolOpenCheckMode to VolOpen Remove the original VolOpen implementation, which is now only used in one spot. (cherry picked from commit fa5b5549cbc193534f82d2bf79250a74e852493a) --- src/storage/storage_backend.c | 14 +++----------- src/storage/storage_backend.h | 8 ++------ src/storage/storage_backend_fs.c | 2 +- src/storage/storage_backend_logical.c | 4 +++- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 25206a1044..0990ee4c4a 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1197,8 +1197,8 @@ virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target, * volume is a dangling symbolic link. */ int -virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, - unsigned int flags) +virStorageBackendVolOpen(const char *path, struct stat *sb, + unsigned int flags) { int fd, mode = 0; char *base = last_component(path); @@ -1280,13 +1280,6 @@ virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, return fd; } -int virStorageBackendVolOpen(const char *path) -{ - struct stat sb; - return virStorageBackendVolOpenCheckMode(path, &sb, - VIR_STORAGE_VOL_OPEN_DEFAULT); -} - int virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, unsigned long long *allocation, @@ -1297,8 +1290,7 @@ virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, int ret, fd = -1; struct stat sb; - if ((ret = virStorageBackendVolOpenCheckMode(target->path, &sb, - openflags)) < 0) + if ((ret = virStorageBackendVolOpen(target->path, &sb, openflags)) < 0) goto cleanup; fd = ret; diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 9283d2b4fa..ed8a4c25c9 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -91,10 +91,6 @@ struct _virStorageBackend { virStorageBackendPtr virStorageBackendForType(int type); -int virStorageBackendVolOpen(const char *path) -ATTRIBUTE_RETURN_CHECK -ATTRIBUTE_NONNULL(1); - /* VolOpenCheckMode flags */ enum { VIR_STORAGE_VOL_OPEN_ERROR = 1 << 0, /* warn if unexpected type @@ -109,8 +105,8 @@ enum { VIR_STORAGE_VOL_OPEN_REG |\ VIR_STORAGE_VOL_OPEN_BLOCK) -int virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, - unsigned int flags) +int virStorageBackendVolOpen(const char *path, struct stat *sb, + unsigned int flags) ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 377cd67721..05da82caa4 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -77,7 +77,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target, if (encryption) *encryption = NULL; - if ((ret = virStorageBackendVolOpenCheckMode(target->path, &sb, + if ((ret = virStorageBackendVolOpen(target->path, &sb, VIR_STORAGE_VOL_FS_REFRESH_FLAGS)) < 0) goto error; /* Take care to propagate ret, it is not always -1 */ fd = ret; diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index 2417f68a24..772f7c16fe 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -674,6 +674,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn, int fd = -1; virCommandPtr cmd = NULL; virErrorPtr err; + struct stat sb; if (vol->target.encryption != NULL) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -715,7 +716,8 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn, virCommandFree(cmd); cmd = NULL; - if ((fd = virStorageBackendVolOpen(vol->target.path)) < 0) + if ((fd = virStorageBackendVolOpen(vol->target.path, &sb, + VIR_STORAGE_VOL_OPEN_DEFAULT)) < 0) goto error; /* We can only chown/grp if root */ -- GitLab