mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
storage: Rename VolOpenCheckMode to VolOpen
Remove the original VolOpen implementation, which is now only used in one spot.
This commit is contained in:
parent
847a9eb17e
commit
fa5b5549cb
@ -1279,7 +1279,7 @@ virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target,
|
||||
* volume is a dangling symbolic link.
|
||||
*/
|
||||
int
|
||||
virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb,
|
||||
virStorageBackendVolOpen(const char *path, struct stat *sb,
|
||||
unsigned int flags)
|
||||
{
|
||||
int fd, mode = 0;
|
||||
@ -1379,13 +1379,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,
|
||||
@ -1396,8 +1389,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;
|
||||
|
||||
|
@ -114,10 +114,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
|
||||
@ -132,7 +128,7 @@ enum {
|
||||
VIR_STORAGE_VOL_OPEN_REG |\
|
||||
VIR_STORAGE_VOL_OPEN_BLOCK)
|
||||
|
||||
int virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb,
|
||||
int virStorageBackendVolOpen(const char *path, struct stat *sb,
|
||||
unsigned int flags)
|
||||
ATTRIBUTE_RETURN_CHECK
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
@ -81,7 +81,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;
|
||||
|
@ -719,6 +719,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,
|
||||
@ -760,7 +761,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 */
|
||||
|
Loading…
Reference in New Issue
Block a user