提交 910d8ae6 编写于 作者: C Cole Robinson

storage: Rename VolOpenCheckMode to VolOpen

Remove the original VolOpen implementation, which is now only used in
one spot.

(cherry picked from commit fa5b5549)
上级 4dce2ab8
...@@ -1197,8 +1197,8 @@ virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target, ...@@ -1197,8 +1197,8 @@ virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target,
* volume is a dangling symbolic link. * volume is a dangling symbolic link.
*/ */
int int
virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, virStorageBackendVolOpen(const char *path, struct stat *sb,
unsigned int flags) unsigned int flags)
{ {
int fd, mode = 0; int fd, mode = 0;
char *base = last_component(path); char *base = last_component(path);
...@@ -1280,13 +1280,6 @@ virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, ...@@ -1280,13 +1280,6 @@ virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb,
return fd; return fd;
} }
int virStorageBackendVolOpen(const char *path)
{
struct stat sb;
return virStorageBackendVolOpenCheckMode(path, &sb,
VIR_STORAGE_VOL_OPEN_DEFAULT);
}
int int
virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
unsigned long long *allocation, unsigned long long *allocation,
...@@ -1297,8 +1290,7 @@ virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, ...@@ -1297,8 +1290,7 @@ virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
int ret, fd = -1; int ret, fd = -1;
struct stat sb; struct stat sb;
if ((ret = virStorageBackendVolOpenCheckMode(target->path, &sb, if ((ret = virStorageBackendVolOpen(target->path, &sb, openflags)) < 0)
openflags)) < 0)
goto cleanup; goto cleanup;
fd = ret; fd = ret;
......
...@@ -91,10 +91,6 @@ struct _virStorageBackend { ...@@ -91,10 +91,6 @@ struct _virStorageBackend {
virStorageBackendPtr virStorageBackendForType(int type); virStorageBackendPtr virStorageBackendForType(int type);
int virStorageBackendVolOpen(const char *path)
ATTRIBUTE_RETURN_CHECK
ATTRIBUTE_NONNULL(1);
/* VolOpenCheckMode flags */ /* VolOpenCheckMode flags */
enum { enum {
VIR_STORAGE_VOL_OPEN_ERROR = 1 << 0, /* warn if unexpected type VIR_STORAGE_VOL_OPEN_ERROR = 1 << 0, /* warn if unexpected type
...@@ -109,8 +105,8 @@ enum { ...@@ -109,8 +105,8 @@ enum {
VIR_STORAGE_VOL_OPEN_REG |\ VIR_STORAGE_VOL_OPEN_REG |\
VIR_STORAGE_VOL_OPEN_BLOCK) VIR_STORAGE_VOL_OPEN_BLOCK)
int virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, int virStorageBackendVolOpen(const char *path, struct stat *sb,
unsigned int flags) unsigned int flags)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_RETURN_CHECK
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
......
...@@ -77,7 +77,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target, ...@@ -77,7 +77,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
if (encryption) if (encryption)
*encryption = NULL; *encryption = NULL;
if ((ret = virStorageBackendVolOpenCheckMode(target->path, &sb, if ((ret = virStorageBackendVolOpen(target->path, &sb,
VIR_STORAGE_VOL_FS_REFRESH_FLAGS)) < 0) VIR_STORAGE_VOL_FS_REFRESH_FLAGS)) < 0)
goto error; /* Take care to propagate ret, it is not always -1 */ goto error; /* Take care to propagate ret, it is not always -1 */
fd = ret; fd = ret;
......
...@@ -674,6 +674,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn, ...@@ -674,6 +674,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
int fd = -1; int fd = -1;
virCommandPtr cmd = NULL; virCommandPtr cmd = NULL;
virErrorPtr err; virErrorPtr err;
struct stat sb;
if (vol->target.encryption != NULL) { if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
...@@ -715,7 +716,8 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn, ...@@ -715,7 +716,8 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
virCommandFree(cmd); virCommandFree(cmd);
cmd = NULL; cmd = NULL;
if ((fd = virStorageBackendVolOpen(vol->target.path)) < 0) if ((fd = virStorageBackendVolOpen(vol->target.path, &sb,
VIR_STORAGE_VOL_OPEN_DEFAULT)) < 0)
goto error; goto error;
/* We can only chown/grp if root */ /* We can only chown/grp if root */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册