mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
storage: cleanup: do away with 'createFile'
Have storage building functions be definitions of virStorageBackendBuildVolFrom: we will need to do this in the future anyways if we ever support the flags attribute.
This commit is contained in:
parent
6d7d465a04
commit
16e4833492
@ -106,7 +106,8 @@ enum {
|
||||
int
|
||||
virStorageBackendCreateRaw(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol)
|
||||
virStorageVolDefPtr inputvol,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int fd = -1;
|
||||
int inputfd = -1;
|
||||
@ -257,7 +258,8 @@ cleanup:
|
||||
static int
|
||||
virStorageBackendCreateQemuImg(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol)
|
||||
virStorageVolDefPtr inputvol,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char size[100];
|
||||
char *create_tool;
|
||||
@ -395,7 +397,8 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
|
||||
static int
|
||||
virStorageBackendCreateQcowCreate(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol)
|
||||
virStorageVolDefPtr inputvol,
|
||||
unsigned int flags ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char size[100];
|
||||
const char *imgargv[4];
|
||||
@ -438,7 +441,7 @@ virStorageBackendCreateQcowCreate(virConnectPtr conn,
|
||||
return 0;
|
||||
}
|
||||
|
||||
createFile
|
||||
virStorageBackendBuildVolFrom
|
||||
virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn, int tool_type)
|
||||
{
|
||||
switch (tool_type) {
|
||||
@ -478,7 +481,7 @@ virStorageBackendFindFSImageTool(char **tool)
|
||||
return tool_type;
|
||||
}
|
||||
|
||||
createFile
|
||||
virStorageBackendBuildVolFrom
|
||||
virStorageBackendGetBuildVolFromFunction(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol)
|
||||
|
@ -40,21 +40,19 @@ typedef int (*virStorageBackendRefreshVol)(virConnectPtr conn, virStoragePoolObj
|
||||
typedef int (*virStorageBackendDeleteVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol, unsigned int flags);
|
||||
typedef int (*virStorageBackendBuildVolFrom)(virConnectPtr conn, virStorageVolDefPtr origvol, virStorageVolDefPtr newvol, unsigned int flags);
|
||||
|
||||
typedef int (*createFile)(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol);
|
||||
|
||||
/* File creation/cloning functions used for cloning between backends */
|
||||
int virStorageBackendCreateRaw(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol);
|
||||
createFile
|
||||
virStorageVolDefPtr inputvol,
|
||||
unsigned int flags);
|
||||
virStorageBackendBuildVolFrom
|
||||
virStorageBackendGetBuildVolFromFunction(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol);
|
||||
int virStorageBackendFindFSImageTool(char **tool);
|
||||
createFile virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn,
|
||||
int tool_type);
|
||||
virStorageBackendBuildVolFrom
|
||||
virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn,
|
||||
int tool_type);
|
||||
|
||||
|
||||
typedef struct _virStorageBackend virStorageBackend;
|
||||
|
@ -1008,7 +1008,8 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn,
|
||||
|
||||
static int createFileDir(virConnectPtr conn,
|
||||
virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol) {
|
||||
virStorageVolDefPtr inputvol,
|
||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||
if (inputvol) {
|
||||
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s",
|
||||
@ -1032,7 +1033,7 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn,
|
||||
virStorageVolDefPtr inputvol)
|
||||
{
|
||||
int fd;
|
||||
createFile create_func;
|
||||
virStorageBackendBuildVolFrom create_func;
|
||||
int tool_type;
|
||||
|
||||
if (inputvol) {
|
||||
@ -1056,7 +1057,7 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (create_func(conn, vol, inputvol) < 0)
|
||||
if (create_func(conn, vol, inputvol, 0) < 0)
|
||||
return -1;
|
||||
|
||||
if ((fd = open(vol->target.path, O_RDONLY)) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user