From 16e4833492667c62c05bd954979e564e04c58954 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 16 Jul 2009 12:27:07 -0400 Subject: [PATCH] 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. --- src/storage_backend.c | 13 ++++++++----- src/storage_backend.h | 14 ++++++-------- src/storage_backend_fs.c | 7 ++++--- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/storage_backend.c b/src/storage_backend.c index 936e06bf87..f4493c1602 100644 --- a/src/storage_backend.c +++ b/src/storage_backend.c @@ -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) diff --git a/src/storage_backend.h b/src/storage_backend.h index 54478f7e08..e80b05d07a 100644 --- a/src/storage_backend.h +++ b/src/storage_backend.h @@ -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; diff --git a/src/storage_backend_fs.c b/src/storage_backend_fs.c index 3b2af596e9..8cfc462f29 100644 --- a/src/storage_backend_fs.c +++ b/src/storage_backend_fs.c @@ -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) { -- GitLab