提交 16e48334 编写于 作者: C Cole Robinson

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.
上级 6d7d465a
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册