diff options
author | Philipp Storz <philipp.storz@bareos.com> | 2022-11-03 19:47:41 +0300 |
---|---|---|
committer | Philipp Storz <philipp.storz@bareos.com> | 2022-11-11 22:25:05 +0300 |
commit | 3321c531c8e0d54ec9b22e60d32c9207ddb5651c (patch) | |
tree | e8eafa8ccd134743f17b573ca9c5ad00efe4b895 | |
parent | 7be0e441b0e80696d2ef476c42c817ae4f92af6c (diff) |
core: rename BareosWinFilePacket -> BareosFilePacket
-rw-r--r-- | core/src/filed/crypto.cc | 2 | ||||
-rw-r--r-- | core/src/filed/crypto.h | 2 | ||||
-rw-r--r-- | core/src/filed/fd_plugins.cc | 40 | ||||
-rw-r--r-- | core/src/filed/fd_plugins.h | 6 | ||||
-rw-r--r-- | core/src/filed/restore.cc | 10 | ||||
-rw-r--r-- | core/src/filed/restore.h | 8 | ||||
-rw-r--r-- | core/src/filed/verify.cc | 6 | ||||
-rw-r--r-- | core/src/findlib/attribs.cc | 13 | ||||
-rw-r--r-- | core/src/findlib/attribs.h | 2 | ||||
-rw-r--r-- | core/src/findlib/bfile.cc | 81 | ||||
-rw-r--r-- | core/src/findlib/bfile.h | 32 | ||||
-rw-r--r-- | core/src/findlib/create_file.cc | 2 | ||||
-rw-r--r-- | core/src/findlib/create_file.h | 2 | ||||
-rw-r--r-- | core/src/findlib/find.h | 4 | ||||
-rw-r--r-- | core/src/stored/bextract.cc | 4 | ||||
-rw-r--r-- | core/src/tests/test_fd_plugins.cc | 14 | ||||
-rw-r--r-- | core/src/win32/findlib/win32.cc | 6 | ||||
-rw-r--r-- | core/src/win32/findlib/win32.h | 2 |
18 files changed, 111 insertions, 125 deletions
diff --git a/core/src/filed/crypto.cc b/core/src/filed/crypto.cc index 73fd0beba..dfe68aa2d 100644 --- a/core/src/filed/crypto.cc +++ b/core/src/filed/crypto.cc @@ -271,7 +271,7 @@ bail_out: * Return value is true on success, false on failure. */ bool FlushCipher(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, uint64_t* addr, char* flags, int32_t stream, diff --git a/core/src/filed/crypto.h b/core/src/filed/crypto.h index e23177830..897a1189f 100644 --- a/core/src/filed/crypto.h +++ b/core/src/filed/crypto.h @@ -32,7 +32,7 @@ void CryptoSessionEnd(JobControlRecord* jcr); bool CryptoSessionSend(JobControlRecord* jcr, BareosSocket* sd); bool VerifySignature(JobControlRecord* jcr, r_ctx& rctx); bool FlushCipher(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, uint64_t* addr, char* flags, int32_t stream, diff --git a/core/src/filed/fd_plugins.cc b/core/src/filed/fd_plugins.cc index 3ca73d3bc..900b7dcc7 100644 --- a/core/src/filed/fd_plugins.cc +++ b/core/src/filed/fd_plugins.cc @@ -41,18 +41,14 @@ #include "lib/bsock.h" // Function pointers to be set here (findlib) -extern int (*plugin_bopen)(BareosWinFilePacket* bfd, +extern int (*plugin_bopen)(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode); -extern int (*plugin_bclose)(BareosWinFilePacket* bfd); -extern ssize_t (*plugin_bread)(BareosWinFilePacket* bfd, - void* buf, - size_t count); -extern ssize_t (*plugin_bwrite)(BareosWinFilePacket* bfd, - void* buf, - size_t count); -extern boffset_t (*plugin_blseek)(BareosWinFilePacket* bfd, +extern int (*plugin_bclose)(BareosFilePacket* bfd); +extern ssize_t (*plugin_bread)(BareosFilePacket* bfd, void* buf, size_t count); +extern ssize_t (*plugin_bwrite)(BareosFilePacket* bfd, void* buf, size_t count); +extern boffset_t (*plugin_blseek)(BareosFilePacket* bfd, boffset_t offset, int whence); @@ -116,16 +112,14 @@ static bRC bareosClearSeenBitmap(PluginContext* ctx, bool all, char* fname); static bRC bareosGetInstanceCount(PluginContext* ctx, int* ret); // These will be plugged into the global pointer structure for the findlib. -static int MyPluginBopen(BareosWinFilePacket* bfd, +static int MyPluginBopen(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode); -static int MyPluginBclose(BareosWinFilePacket* bfd); -static ssize_t MyPluginBread(BareosWinFilePacket* bfd, void* buf, size_t count); -static ssize_t MyPluginBwrite(BareosWinFilePacket* bfd, - void* buf, - size_t count); -static boffset_t MyPluginBlseek(BareosWinFilePacket* bfd, +static int MyPluginBclose(BareosFilePacket* bfd); +static ssize_t MyPluginBread(BareosFilePacket* bfd, void* buf, size_t count); +static ssize_t MyPluginBwrite(BareosFilePacket* bfd, void* buf, size_t count); +static boffset_t MyPluginBlseek(BareosFilePacket* bfd, boffset_t offset, int whence); @@ -1198,7 +1192,7 @@ bail_out: */ int PluginCreateFile(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, int) { int flags; @@ -1296,7 +1290,7 @@ int PluginCreateFile(JobControlRecord* jcr, */ bool PluginSetAttributes(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* ofd) + BareosFilePacket* ofd) { Plugin* plugin; struct restore_pkt rp; @@ -1804,7 +1798,7 @@ void FreePlugins(JobControlRecord* jcr) * Entry point for opening the file this is a wrapper around the pluginIO * entry point in the plugin. */ -static int MyPluginBopen(BareosWinFilePacket* bfd, +static int MyPluginBopen(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode) @@ -1845,7 +1839,7 @@ static int MyPluginBopen(BareosWinFilePacket* bfd, * Entry point for closing the file this is a wrapper around the pluginIO * entry point in the plugin. */ -static int MyPluginBclose(BareosWinFilePacket* bfd) +static int MyPluginBclose(BareosFilePacket* bfd) { Plugin* plugin; struct io_pkt io; @@ -1880,7 +1874,7 @@ static int MyPluginBclose(BareosWinFilePacket* bfd) * Entry point for reading from the file this is a wrapper around the pluginIO * entry point in the plugin. */ -static ssize_t MyPluginBread(BareosWinFilePacket* bfd, void* buf, size_t count) +static ssize_t MyPluginBread(BareosFilePacket* bfd, void* buf, size_t count) { Plugin* plugin; struct io_pkt io; @@ -1916,7 +1910,7 @@ static ssize_t MyPluginBread(BareosWinFilePacket* bfd, void* buf, size_t count) * Entry point for writing to the file this is a wrapper around the pluginIO * entry point in the plugin. */ -static ssize_t MyPluginBwrite(BareosWinFilePacket* bfd, void* buf, size_t count) +static ssize_t MyPluginBwrite(BareosFilePacket* bfd, void* buf, size_t count) { Plugin* plugin; struct io_pkt io; @@ -1954,7 +1948,7 @@ static ssize_t MyPluginBwrite(BareosWinFilePacket* bfd, void* buf, size_t count) * Entry point for seeking in the file this is a wrapper around the pluginIO * entry point in the plugin. */ -static boffset_t MyPluginBlseek(BareosWinFilePacket* bfd, +static boffset_t MyPluginBlseek(BareosFilePacket* bfd, boffset_t offset, int whence) { diff --git a/core/src/filed/fd_plugins.h b/core/src/filed/fd_plugins.h index 0e6847d40..4e12c2808 100644 --- a/core/src/filed/fd_plugins.h +++ b/core/src/filed/fd_plugins.h @@ -57,7 +57,7 @@ #endif #ifdef FILE_DAEMON -struct BareosWinFilePacket; +struct BareosFilePacket; struct FindFilesPacket; #endif /* FILE_DAEMON */ @@ -263,11 +263,11 @@ bool SendPluginName(JobControlRecord* jcr, BareosSocket* sd, bool start); bool PluginNameStream(JobControlRecord* jcr, char* name); int PluginCreateFile(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, int replace); bool PluginSetAttributes(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* ofd); + BareosFilePacket* ofd); bacl_exit_code PluginBuildAclStreams(JobControlRecord* jcr, AclData* acl_data, FindFilesPacket* ff_pkt); diff --git a/core/src/filed/restore.cc b/core/src/filed/restore.cc index d4eece457..23c5a4274 100644 --- a/core/src/filed/restore.cc +++ b/core/src/filed/restore.cc @@ -105,7 +105,7 @@ static void FreeSignature(r_ctx& rctx); static bool ClosePreviousStream(JobControlRecord* jcr, r_ctx& rctx); int32_t ExtractData(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, POOLMEM* buf, int32_t buflen, uint64_t* addr, @@ -118,7 +118,7 @@ int32_t ExtractData(JobControlRecord* jcr, * Makes use of some code from SetAttributes(). */ static int BcloseChksize(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, boffset_t osize) { char ec1[50], ec2[50]; @@ -1151,7 +1151,7 @@ int DoFileDigest(JobControlRecord* jcr, FindFilesPacket* ff_pkt, bool) } bool SparseData(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, uint64_t* addr, char** data, uint32_t* length) @@ -1178,7 +1178,7 @@ bool SparseData(JobControlRecord* jcr, } bool StoreData(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, char* data, const int32_t length, bool win32_decomp) @@ -1232,7 +1232,7 @@ bool StoreData(JobControlRecord* jcr, * Return value is the number of bytes written, or -1 on errors. */ int32_t ExtractData(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, POOLMEM* buf, int32_t buflen, uint64_t* addr, diff --git a/core/src/filed/restore.h b/core/src/filed/restore.h index 26dee5c00..2e0dd05e7 100644 --- a/core/src/filed/restore.h +++ b/core/src/filed/restore.h @@ -50,11 +50,11 @@ struct r_ctx { int32_t full_stream{0}; /* full stream including new bits */ int32_t comp_stream{0}; /* last compressed stream found. needed only to restore encrypted compressed backup */ - BareosWinFilePacket bfd; /* File content */ + BareosFilePacket bfd; /* File content */ uint64_t fileAddr{0}; /* file write address */ uint32_t size{0}; /* Size of file */ char flags[FOPTS_BYTES]{}; /* Options for ExtractData() */ - BareosWinFilePacket forkbfd; /* Alternative data stream */ + BareosFilePacket forkbfd; /* Alternative data stream */ uint64_t fork_addr{0}; /* Write address for alternative stream */ int64_t fork_size{0}; /* Size of alternate stream */ char fork_flags[FOPTS_BYTES]{0}; /* Options for ExtractData() */ @@ -76,12 +76,12 @@ int DoFileDigest(JobControlRecord* jcr, FindFilesPacket* ff_pkt, bool top_level); bool SparseData(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, uint64_t* addr, char** data, uint32_t* length); bool StoreData(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, char* data, const int32_t length, bool win32_decomp); diff --git a/core/src/filed/verify.cc b/core/src/filed/verify.cc index 72dccfb96..b53faee0e 100644 --- a/core/src/filed/verify.cc +++ b/core/src/filed/verify.cc @@ -45,7 +45,7 @@ const bool have_darwin_os = false; #endif static int VerifyFile(JobControlRecord* jcr, FindFilesPacket* ff_pkt, bool); -static int ReadDigest(BareosWinFilePacket* bfd, +static int ReadDigest(BareosFilePacket* bfd, DIGEST* digest, JobControlRecord* jcr); static bool calculate_file_chksum(JobControlRecord* jcr, @@ -276,7 +276,7 @@ static int VerifyFile(JobControlRecord* jcr, FindFilesPacket* ff_pkt, bool) */ int DigestFile(JobControlRecord* jcr, FindFilesPacket* ff_pkt, DIGEST* digest) { - BareosWinFilePacket bfd; + BareosFilePacket bfd; binit(&bfd); @@ -323,7 +323,7 @@ int DigestFile(JobControlRecord* jcr, FindFilesPacket* ff_pkt, DIGEST* digest) * Read message digest of bfd, updating digest * In case of errors we need the job control record and file name. */ -static int ReadDigest(BareosWinFilePacket* bfd, +static int ReadDigest(BareosFilePacket* bfd, DIGEST* digest, JobControlRecord* jcr) { diff --git a/core/src/findlib/attribs.cc b/core/src/findlib/attribs.cc index dc94b0a56..3db3c5c53 100644 --- a/core/src/findlib/attribs.cc +++ b/core/src/findlib/attribs.cc @@ -46,7 +46,7 @@ extern void unix_name_to_win32(POOLMEM*& win32_name, const char* name); /* Forward referenced subroutines */ static bool set_win32_attributes(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* ofd); + BareosFilePacket* ofd); void WinError(JobControlRecord* jcr, const char* prefix, POOLMEM* ofile); #endif /* HAVE_WIN32 */ @@ -186,10 +186,9 @@ int SelectDataStream(FindFilesPacket* ff_pkt, bool compatible) } // Restore all file attributes like owner, mode and file times. -static inline bool RestoreFileAttributes( - JobControlRecord* jcr, - Attributes* attr, - [[maybe_unused]] BareosWinFilePacket* ofd) +static inline bool RestoreFileAttributes(JobControlRecord* jcr, + Attributes* attr, + BareosFilePacket* ofd) { bool ok = true; bool suppress_errors; @@ -355,7 +354,7 @@ static inline bool RestoreFileAttributes( */ bool SetAttributes(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* ofd) + BareosFilePacket* ofd) { mode_t old_mask; bool ok = true; @@ -616,7 +615,7 @@ template <typename T> static void plug(T& st, uint64_t val) */ static bool set_win32_attributes(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* ofd) + BareosFilePacket* ofd) { char* p = attr->attrEx; int64_t val; diff --git a/core/src/findlib/attribs.h b/core/src/findlib/attribs.h index 922d5dfe0..4159cce49 100644 --- a/core/src/findlib/attribs.h +++ b/core/src/findlib/attribs.h @@ -26,7 +26,7 @@ int encode_attribsEx(JobControlRecord* jcr, FindFilesPacket* ff_pkt); bool SetAttributes(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* ofd); + BareosFilePacket* ofd); int SelectDataStream(FindFilesPacket* ff_pkt, bool compatible); #endif // BAREOS_FINDLIB_ATTRIBS_H_ diff --git a/core/src/findlib/bfile.cc b/core/src/findlib/bfile.cc index 445ca515a..56bcd9585 100644 --- a/core/src/findlib/bfile.cc +++ b/core/src/findlib/bfile.cc @@ -34,19 +34,15 @@ const int debuglevel = 200; -int (*plugin_bopen)(BareosWinFilePacket* bfd, +int (*plugin_bopen)(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode) = NULL; -int (*plugin_bclose)(BareosWinFilePacket* bfd) = NULL; -ssize_t (*plugin_bread)(BareosWinFilePacket* bfd, void* buf, size_t count) - = NULL; -ssize_t (*plugin_bwrite)(BareosWinFilePacket* bfd, void* buf, size_t count) - = NULL; -boffset_t (*plugin_blseek)(BareosWinFilePacket* bfd, - boffset_t offset, - int whence) +int (*plugin_bclose)(BareosFilePacket* bfd) = NULL; +ssize_t (*plugin_bread)(BareosFilePacket* bfd, void* buf, size_t count) = NULL; +ssize_t (*plugin_bwrite)(BareosFilePacket* bfd, void* buf, size_t count) = NULL; +boffset_t (*plugin_blseek)(BareosFilePacket* bfd, boffset_t offset, int whence) = NULL; #ifdef HAVE_DARWIN_OS @@ -256,7 +252,7 @@ static inline void int32_LE2BE(int32_t* pBE, const int32_t v) } // Read a BackupRead block and pull out the file data -bool processWin32BackupAPIBlock(BareosWinFilePacket* bfd, +bool processWin32BackupAPIBlock(BareosFilePacket* bfd, void* pBuffer, ssize_t dwSize) { @@ -374,9 +370,9 @@ bool processWin32BackupAPIBlock(BareosWinFilePacket* bfd, extern void unix_name_to_win32(POOLMEM*& win32_name, const char* name); extern "C" HANDLE get_osfhandle(int fd); -void binit(BareosWinFilePacket* bfd) +void binit(BareosFilePacket* bfd) { - new (bfd) BareosWinFilePacket(); + new (bfd) BareosFilePacket(); bfd->fid = -1; bfd->use_backup_api = have_win32_api(); } @@ -386,20 +382,20 @@ void binit(BareosWinFilePacket* bfd) * Returns 1 if function worked * Returns 0 if failed (i.e. do not have Backup API on this machine) */ -bool set_win32_backup(BareosWinFilePacket* bfd) +bool set_win32_backup(BareosFilePacket* bfd) { /* We enable if possible here */ bfd->use_backup_api = have_win32_api(); return bfd->use_backup_api; } -bool SetPortableBackup(BareosWinFilePacket* bfd) +bool SetPortableBackup(BareosFilePacket* bfd) { bfd->use_backup_api = false; return true; } -bool SetCmdPlugin(BareosWinFilePacket* bfd, JobControlRecord* jcr) +bool SetCmdPlugin(BareosFilePacket* bfd, JobControlRecord* jcr) { bfd->cmd_plugin = true; bfd->jcr = jcr; @@ -410,7 +406,7 @@ bool SetCmdPlugin(BareosWinFilePacket* bfd, JobControlRecord* jcr) * Return 1 if we are NOT using Win32 BackupWrite() * return 0 if are */ -bool IsPortableBackup(BareosWinFilePacket* bfd) { return !bfd->use_backup_api; } +bool IsPortableBackup(BareosFilePacket* bfd) { return !bfd->use_backup_api; } bool have_win32_api() { return p_BackupRead && p_BackupWrite; } @@ -471,7 +467,7 @@ bool IsRestoreStreamSupported(int stream) return false; } -HANDLE BgetHandle(BareosWinFilePacket* bfd) +HANDLE BgetHandle(BareosFilePacket* bfd) { return (bfd->mode == BF_CLOSED) ? INVALID_HANDLE_VALUE : bfd->fh; } @@ -490,7 +486,7 @@ HANDLE BgetHandle(BareosWinFilePacket* bfd) # define OVERWRITE_HIDDEN 4 # endif -static inline int BopenEncrypted(BareosWinFilePacket* bfd, +static inline int BopenEncrypted(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode) @@ -554,7 +550,7 @@ static inline int BopenEncrypted(BareosWinFilePacket* bfd, return bfd->mode == BF_CLOSED ? -1 : 1; } -static inline int BopenNonencrypted(BareosWinFilePacket* bfd, +static inline int BopenNonencrypted(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode) @@ -728,7 +724,7 @@ static inline int BopenNonencrypted(BareosWinFilePacket* bfd, return bfd->mode == BF_CLOSED ? -1 : 1; } -int bopen(BareosWinFilePacket* bfd, +int bopen(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode, @@ -759,7 +755,7 @@ int bopen(BareosWinFilePacket* bfd, * Returns 0 on success * -1 on error */ -static inline int BcloseEncrypted(BareosWinFilePacket* bfd) +static inline int BcloseEncrypted(BareosFilePacket* bfd) { if (bfd->mode == BF_CLOSED) { Dmsg0(50, "=== BFD already closed.\n"); @@ -782,7 +778,7 @@ static inline int BcloseEncrypted(BareosWinFilePacket* bfd) * Returns 0 on success * -1 on error */ -static inline int BcloseNonencrypted(BareosWinFilePacket* bfd) +static inline int BcloseNonencrypted(BareosFilePacket* bfd) { int status = 0; @@ -848,7 +844,7 @@ all_done: * Returns 0 on success * -1 on error */ -int bclose(BareosWinFilePacket* bfd) +int bclose(BareosFilePacket* bfd) { if (bfd->encrypted) { return BcloseEncrypted(bfd); @@ -861,7 +857,7 @@ int bclose(BareosWinFilePacket* bfd) * 0 on EOF * -1 on error */ -ssize_t bread(BareosWinFilePacket* bfd, void* buf, size_t count) +ssize_t bread(BareosFilePacket* bfd, void* buf, size_t count) { bfd->rw_bytes = 0; @@ -889,7 +885,7 @@ ssize_t bread(BareosWinFilePacket* bfd, void* buf, size_t count) return (ssize_t)bfd->rw_bytes; } -ssize_t bwrite(BareosWinFilePacket* bfd, void* buf, size_t count) +ssize_t bwrite(BareosFilePacket* bfd, void* buf, size_t count) { bfd->rw_bytes = 0; @@ -919,9 +915,9 @@ ssize_t bwrite(BareosWinFilePacket* bfd, void* buf, size_t count) return (ssize_t)bfd->rw_bytes; } -bool IsBopen(BareosWinFilePacket* bfd) { return bfd->mode != BF_CLOSED; } +bool IsBopen(BareosFilePacket* bfd) { return bfd->mode != BF_CLOSED; } -boffset_t blseek(BareosWinFilePacket* bfd, boffset_t offset, int whence) +boffset_t blseek(BareosFilePacket* bfd, boffset_t offset, int whence) { LONG offset_low = (LONG)offset; LONG offset_high = (LONG)(offset >> 32); @@ -948,7 +944,7 @@ boffset_t blseek(BareosWinFilePacket* bfd, boffset_t offset, int whence) * * =============================================================== */ -void binit(BareosWinFilePacket* bfd) { bfd->fid = -1; } +void binit(BareosFilePacket* bfd) { bfd->fid = -1; } bool have_win32_api() { return false; /* no can do */ } @@ -957,22 +953,22 @@ bool have_win32_api() { return false; /* no can do */ } * Returns true if function worked * Returns false if failed (i.e. do not have Backup API on this machine) */ -bool set_win32_backup(BareosWinFilePacket*) { return false; /* no can do */ } +bool set_win32_backup(BareosFilePacket*) { return false; /* no can do */ } -bool SetPortableBackup(BareosWinFilePacket*) { return true; /* no problem */ } +bool SetPortableBackup(BareosFilePacket*) { return true; /* no problem */ } /** * Return true if we are writing in portable format * return false if not */ -bool IsPortableBackup(BareosWinFilePacket*) +bool IsPortableBackup(BareosFilePacket*) { return true; /* portable by definition */ } -bool set_prog(BareosWinFilePacket*, char*, JobControlRecord*) { return false; } +bool set_prog(BareosFilePacket*, char*, JobControlRecord*) { return false; } -bool SetCmdPlugin(BareosWinFilePacket* bfd, JobControlRecord* jcr) +bool SetCmdPlugin(BareosFilePacket* bfd, JobControlRecord* jcr) { bfd->cmd_plugin = true; bfd->jcr = jcr; @@ -1039,7 +1035,7 @@ bool IsRestoreStreamSupported(int stream) return false; } -int bopen(BareosWinFilePacket* bfd, +int bopen(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode, @@ -1100,10 +1096,7 @@ int bopen(BareosWinFilePacket* bfd, # ifdef HAVE_DARWIN_OS // Open the resource fork of a file. -int BopenRsrc(BareosWinFilePacket* bfd, - const char* fname, - int flags, - mode_t mode) +int BopenRsrc(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode) { POOLMEM* rsrc_fname; @@ -1116,10 +1109,10 @@ int BopenRsrc(BareosWinFilePacket* bfd, return bfd->fid; } # else -int BopenRsrc(BareosWinFilePacket*, const char*, int, mode_t) { return -1; } +int BopenRsrc(BareosFilePacket*, const char*, int, mode_t) { return -1; } # endif -int bclose(BareosWinFilePacket* bfd) +int bclose(BareosFilePacket* bfd) { int status; @@ -1151,7 +1144,7 @@ int bclose(BareosWinFilePacket* bfd) return status; } -ssize_t bread(BareosWinFilePacket* bfd, void* buf, size_t count) +ssize_t bread(BareosFilePacket* bfd, void* buf, size_t count) { ssize_t status; @@ -1162,7 +1155,7 @@ ssize_t bread(BareosWinFilePacket* bfd, void* buf, size_t count) return status; } -ssize_t bwrite(BareosWinFilePacket* bfd, void* buf, size_t count) +ssize_t bwrite(BareosFilePacket* bfd, void* buf, size_t count) { ssize_t status; @@ -1174,9 +1167,9 @@ ssize_t bwrite(BareosWinFilePacket* bfd, void* buf, size_t count) return status; } -bool IsBopen(BareosWinFilePacket* bfd) { return bfd->fid >= 0; } +bool IsBopen(BareosFilePacket* bfd) { return bfd->fid >= 0; } -boffset_t blseek(BareosWinFilePacket* bfd, boffset_t offset, int whence) +boffset_t blseek(BareosFilePacket* bfd, boffset_t offset, int whence) { boffset_t pos; diff --git a/core/src/findlib/bfile.h b/core/src/findlib/bfile.h index 8ceaed322..e88a1ad6e 100644 --- a/core/src/findlib/bfile.h +++ b/core/src/findlib/bfile.h @@ -71,7 +71,7 @@ enum /* Basic Win32 low level I/O file packet */ /* clang-format off */ -struct BareosWinFilePacket { +struct BareosFilePacket { bool use_backup_api = false; /**< set if using BackupRead/Write */ bool encrypted = false; /**< set if using ReadEncryptedFileRaw/WriteEncryptedFileRaw */ int mode = BF_CLOSED; /**< set if file is open */ @@ -93,7 +93,7 @@ struct BareosWinFilePacket { }; /* clang-format on */ -HANDLE BgetHandle(BareosWinFilePacket* bfd); +HANDLE BgetHandle(BareosFilePacket* bfd); #else /* Linux/Unix systems */ @@ -106,7 +106,7 @@ HANDLE BgetHandle(BareosWinFilePacket* bfd); /* Basic Unix low level I/O file packet */ /* clang-format off */ -struct BareosWinFilePacket { +struct BareosFilePacket { int fid{0}; /**< file id on Unix */ int flags_{0}; /**< open flags */ int BErrNo{0}; /**< errno */ @@ -123,31 +123,31 @@ struct BareosWinFilePacket { #endif -void binit(BareosWinFilePacket* bfd); -bool IsBopen(BareosWinFilePacket* bfd); -bool set_win32_backup(BareosWinFilePacket* bfd); -bool SetPortableBackup(BareosWinFilePacket* bfd); -bool SetCmdPlugin(BareosWinFilePacket* bfd, JobControlRecord* jcr); +void binit(BareosFilePacket* bfd); +bool IsBopen(BareosFilePacket* bfd); +bool set_win32_backup(BareosFilePacket* bfd); +bool SetPortableBackup(BareosFilePacket* bfd); +bool SetCmdPlugin(BareosFilePacket* bfd, JobControlRecord* jcr); bool have_win32_api(); -bool IsPortableBackup(BareosWinFilePacket* bfd); +bool IsPortableBackup(BareosFilePacket* bfd); bool IsRestoreStreamSupported(int stream); bool is_win32_stream(int stream); -int bopen(BareosWinFilePacket* bfd, +int bopen(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode, dev_t rdev); -int BopenRsrc(BareosWinFilePacket* bfd, +int BopenRsrc(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode); -int bclose(BareosWinFilePacket* bfd); -ssize_t bread(BareosWinFilePacket* bfd, void* buf, size_t count); -ssize_t bwrite(BareosWinFilePacket* bfd, void* buf, size_t count); -boffset_t blseek(BareosWinFilePacket* bfd, boffset_t offset, int whence); +int bclose(BareosFilePacket* bfd); +ssize_t bread(BareosFilePacket* bfd, void* buf, size_t count); +ssize_t bwrite(BareosFilePacket* bfd, void* buf, size_t count); +boffset_t blseek(BareosFilePacket* bfd, boffset_t offset, int whence); const char* stream_to_ascii(int stream); -bool processWin32BackupAPIBlock(BareosWinFilePacket* bfd, +bool processWin32BackupAPIBlock(BareosFilePacket* bfd, void* pBuffer, ssize_t dwSize); diff --git a/core/src/findlib/create_file.cc b/core/src/findlib/create_file.cc index 43cd9d714..45ad3d688 100644 --- a/core/src/findlib/create_file.cc +++ b/core/src/findlib/create_file.cc @@ -67,7 +67,7 @@ static int PathAlreadySeen(JobControlRecord* jcr, char* path, int pnl); */ int CreateFile(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, int replace) { mode_t new_mode, parent_mode; diff --git a/core/src/findlib/create_file.h b/core/src/findlib/create_file.h index eddd49be0..9f2b5e443 100644 --- a/core/src/findlib/create_file.h +++ b/core/src/findlib/create_file.h @@ -23,7 +23,7 @@ int CreateFile(JobControlRecord* jcr, Attributes* attr, - BareosWinFilePacket* ofd, + BareosFilePacket* ofd, int replace); #endif // BAREOS_FINDLIB_CREATE_FILE_H_ diff --git a/core/src/findlib/find.h b/core/src/findlib/find.h index 79501d172..f47e76ad9 100644 --- a/core/src/findlib/find.h +++ b/core/src/findlib/find.h @@ -218,7 +218,7 @@ struct FindFilesPacket { int32_t object_compression{0}; /**< Type of compression for object */ int type{0}; /**< FT_ type from above */ int ff_errno{0}; /**< Errno */ - BareosWinFilePacket bfd; /**< Bareos file descriptor */ + BareosFilePacket bfd; /**< Bareos file descriptor */ time_t save_time{0}; /**< Start of incremental time */ bool accurate_found{false}; /**< Found in the accurate hash (valid after CheckChanges()) */ @@ -262,7 +262,7 @@ struct FindFilesPacket { * Darwin specific things. * To avoid clutter, we always include rsrc_bfd and volhas_attrlist. */ - BareosWinFilePacket rsrc_bfd; /**< Fd for resource forks */ + BareosFilePacket rsrc_bfd; /**< Fd for resource forks */ bool volhas_attrlist{false}; /**< Volume supports getattrlist() */ HfsPlusInfo hfsinfo; /**< Finder Info and resource fork size */ }; diff --git a/core/src/stored/bextract.cc b/core/src/stored/bextract.cc index 95deeea38..56f18d5f7 100644 --- a/core/src/stored/bextract.cc +++ b/core/src/stored/bextract.cc @@ -65,7 +65,7 @@ static bool RecordCb(DeviceControlRecord* dcr, DeviceRecord* rec); static Device* dev = nullptr; static DeviceControlRecord* dcr; -static BareosWinFilePacket bfd; +static BareosFilePacket bfd; static JobControlRecord* jcr; static FindFilesPacket* ff; static bool extract = false; @@ -455,7 +455,7 @@ static void DoExtract(char* devname, return; } -static bool StoreData(BareosWinFilePacket* bfd, +static bool StoreData(BareosFilePacket* bfd, char* data, const int32_t length) { diff --git a/core/src/tests/test_fd_plugins.cc b/core/src/tests/test_fd_plugins.cc index 9664f9417..1d4bd55fc 100644 --- a/core/src/tests/test_fd_plugins.cc +++ b/core/src/tests/test_fd_plugins.cc @@ -51,18 +51,18 @@ #include "findlib/hardlink.h" // Function pointers to be set here (findlib) -extern int (*plugin_bopen)(BareosWinFilePacket* bfd, +extern int (*plugin_bopen)(BareosFilePacket* bfd, const char* fname, int flags, mode_t mode); -extern int (*plugin_bclose)(BareosWinFilePacket* bfd); -extern ssize_t (*plugin_bread)(BareosWinFilePacket* bfd, +extern int (*plugin_bclose)(BareosFilePacket* bfd); +extern ssize_t (*plugin_bread)(BareosFilePacket* bfd, void* buf, size_t count); -extern ssize_t (*plugin_bwrite)(BareosWinFilePacket* bfd, +extern ssize_t (*plugin_bwrite)(BareosFilePacket* bfd, void* buf, size_t count); -extern boffset_t (*plugin_blseek)(BareosWinFilePacket* bfd, +extern boffset_t (*plugin_blseek)(BareosFilePacket* bfd, boffset_t offset, int whence); @@ -72,7 +72,7 @@ extern char* version; namespace filedaemon { int SaveFile(JobControlRecord*, FindFilesPacket*, bool); -bool SetCmdPlugin(BareosWinFilePacket*, JobControlRecord*); +bool SetCmdPlugin(BareosFilePacket*, JobControlRecord*); /* Exported variables */ ClientResource* me; /* my resource */ @@ -87,7 +87,7 @@ bool accurate_unMarkFileAsSeen(JobControlRecord*, char*) { return true; } bool accurate_unMarkAllFilesAsSeen(JobControlRecord*) { return true; } -bool SetCmdPlugin(BareosWinFilePacket*, JobControlRecord*) { return true; } +bool SetCmdPlugin(BareosFilePacket*, JobControlRecord*) { return true; } TEST(fd, fd_plugins) { diff --git a/core/src/win32/findlib/win32.cc b/core/src/win32/findlib/win32.cc index 931cf780e..454e8336c 100644 --- a/core/src/win32/findlib/win32.cc +++ b/core/src/win32/findlib/win32.cc @@ -464,8 +464,8 @@ struct CopyThreadSaveData { }; struct CopyThreadContext { - BareosWinFilePacket* bfd; /* Filehandle */ - int nr_save_elements; /* Number of save items in save_data */ + BareosFilePacket* bfd; /* Filehandle */ + int nr_save_elements; /* Number of save items in save_data */ CopyThreadSaveData* save_data; /* To save data (cached structure build during restore) */ CircularBuffer* cb; /* Circular buffer for passing work to copy thread */ @@ -603,7 +603,7 @@ bail_out: // Send data to the copy thread that restores EFS data. int win32_send_to_copy_thread(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, char* data, const int32_t length) { diff --git a/core/src/win32/findlib/win32.h b/core/src/win32/findlib/win32.h index f50119166..67c1d3ba4 100644 --- a/core/src/win32/findlib/win32.h +++ b/core/src/win32/findlib/win32.h @@ -31,7 +31,7 @@ bool win32_onefs_is_disabled(findFILESET* fileset); void win32_cleanup_copy_thread(JobControlRecord* jcr); void win32_flush_copy_thread(JobControlRecord* jcr); int win32_send_to_copy_thread(JobControlRecord* jcr, - BareosWinFilePacket* bfd, + BareosFilePacket* bfd, char* data, const int32_t length); |