mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Add HRN_STORAGE_COPY() macro.
This commit is contained in:
parent
50c129ae9d
commit
d0f3a3f2af
@ -361,6 +361,32 @@ hrnStorageMove(
|
|||||||
hrnTestResultEnd();
|
hrnTestResultEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************/
|
||||||
|
void
|
||||||
|
hrnStorageCopy(
|
||||||
|
const Storage *const storageSource, const char *const fileSource, const Storage *const storageDest, const char *const fileDest,
|
||||||
|
HrnStorageCopyParam param)
|
||||||
|
{
|
||||||
|
hrnTestResultBegin(__func__, false);
|
||||||
|
|
||||||
|
ASSERT(storageSource != NULL);
|
||||||
|
ASSERT(fileSource != NULL);
|
||||||
|
ASSERT(storageDest != NULL);
|
||||||
|
ASSERT(fileDest != NULL);
|
||||||
|
|
||||||
|
const String *const fileSourceStr = storagePathP(storageSource, STR(fileSource));
|
||||||
|
const String *const fileDestStr = storagePathP(storageDest, STR(fileDest));
|
||||||
|
|
||||||
|
printf("copy '%s' to '%s'", strZ(fileSourceStr), strZ(fileDestStr));
|
||||||
|
|
||||||
|
hrnTestResultComment(param.comment);
|
||||||
|
|
||||||
|
// Copy the file
|
||||||
|
storageCopyP(storageNewReadP(storageSource, fileSourceStr), storageNewWriteP(storageDest, fileDestStr));
|
||||||
|
|
||||||
|
hrnTestResultEnd();
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************************/
|
/**********************************************************************************************************************************/
|
||||||
void
|
void
|
||||||
hrnStoragePut(
|
hrnStoragePut(
|
||||||
|
@ -120,6 +120,27 @@ typedef struct HrnStorageMoveParam
|
|||||||
void hrnStorageMove(
|
void hrnStorageMove(
|
||||||
const Storage *const storage, const char *const fileSource, const char *const fileDest, HrnStorageMoveParam param);
|
const Storage *const storage, const char *const fileSource, const char *const fileDest, HrnStorageMoveParam param);
|
||||||
|
|
||||||
|
/***********************************************************************************************************************************
|
||||||
|
Copy a file
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
typedef struct HrnStorageCopyParam
|
||||||
|
{
|
||||||
|
VAR_PARAM_HEADER;
|
||||||
|
const char *comment; // Comment
|
||||||
|
} HrnStorageCopyParam;
|
||||||
|
|
||||||
|
#define HRN_STORAGE_COPY(storageSource, fileSource, storageDest, fileDest, ...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
hrnTestLogPrefix(__LINE__); \
|
||||||
|
hrnStorageCopy(storageSource, fileSource, storageDest, fileDest, (HrnStorageCopyParam){VAR_PARAM_INIT, __VA_ARGS__}); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
void hrnStorageCopy(
|
||||||
|
const Storage *const storageSource, const char *const fileSource, const Storage *const storageDest, const char *const fileDest,
|
||||||
|
HrnStorageCopyParam param);
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Create a path
|
Create a path
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user