From 51d000d06124a2d9442d5a980944b3eebba2fa65 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Sun, 6 Sep 2009 20:43:48 +0200 Subject: [PATCH] Move restore struct defintions to seperate include file. Small change to acl.h and xattr.h to use define inline with other header files. Signed-off-by: Kern Sibbald --- bacula/src/filed/acl.h | 4 +-- bacula/src/filed/restore.c | 36 +--------------------- bacula/src/filed/restore.h | 63 ++++++++++++++++++++++++++++++++++++++ bacula/src/filed/xattr.h | 4 +-- 4 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 bacula/src/filed/restore.h diff --git a/bacula/src/filed/acl.h b/bacula/src/filed/acl.h index dc60ce41ec..94a6f0f79e 100644 --- a/bacula/src/filed/acl.h +++ b/bacula/src/filed/acl.h @@ -29,8 +29,8 @@ * Properties we use for getting and setting ACLs. */ -#ifndef _BACULA_ACL_ -#define _BACULA_ACL_ +#ifndef _BACULA_ACL_H +#define _BACULA_ACL_H /* For shorter ACL strings when possible, define BACL_WANT_SHORT_ACLS */ /* #define BACL_WANT_SHORT_ACLS */ diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 1bd1e69d67..898dfaaa59 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -34,6 +34,7 @@ #include "bacula.h" #include "filed.h" +#include "restore.h" #ifdef HAVE_DARWIN_OS #include @@ -69,38 +70,6 @@ const bool have_xattr = false; /* Data received from Storage Daemon */ static char rec_header[] = "rechdr %ld %ld %ld %ld %ld"; -typedef struct restore_cipher_ctx { - CIPHER_CONTEXT *cipher; - uint32_t block_size; - - POOLMEM *buf; /* Pointer to descryption buffer */ - int32_t buf_len; /* Count of bytes currently in buf */ - int32_t packet_len; /* Total bytes in packet */ -} RESTORE_CIPHER_CTX; - -struct r_ctx { - JCR *jcr; - int32_t stream; - int32_t prev_stream; - BFILE bfd; /* File content */ - uint64_t fileAddr; /* file write address */ - uint32_t size; /* Size of file */ - int flags; /* Options for extract_data() */ - BFILE forkbfd; /* Alternative data stream */ - uint64_t fork_addr; /* Write address for alternative stream */ - intmax_t fork_size; /* Size of alternate stream */ - int fork_flags; /* Options for extract_data() */ - int32_t type; /* file type FT_ */ - ATTR *attr; /* Pointer to attributes */ - bool extract; /* set when extracting */ - - SIGNATURE *sig; /* Cryptographic signature (if any) for file */ - CRYPTO_SESSION *cs; /* Cryptographic session data (if any) for file */ - RESTORE_CIPHER_CTX cipher_ctx; /* Cryptographic restore context (if any) for file */ - RESTORE_CIPHER_CTX fork_cipher_ctx; /* Cryptographic restore context (if any) for alternative stream */ -}; - - /* Forward referenced functions */ #if defined(HAVE_LIBZ) static const char *zlib_strerror(int stat); @@ -115,15 +84,12 @@ static void free_signature(r_ctx &rctx); static void free_session(r_ctx &rctx); static void close_previous_stream(r_ctx &rctx); - - static bool verify_signature(JCR *jcr, r_ctx &rctx); int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx); bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx); - /* * Close a bfd check that we are at the expected file offset. * Makes use of some code from set_attributes(). diff --git a/bacula/src/filed/restore.h b/bacula/src/filed/restore.h new file mode 100644 index 0000000000..5a9e809b33 --- /dev/null +++ b/bacula/src/filed/restore.h @@ -0,0 +1,63 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +#ifndef _BACULA_RESTORE_H +#define _BACULA_RESTORE_H + +struct RESTORE_CIPHER_CTX { + CIPHER_CONTEXT *cipher; + uint32_t block_size; + + POOLMEM *buf; /* Pointer to descryption buffer */ + int32_t buf_len; /* Count of bytes currently in buf */ + int32_t packet_len; /* Total bytes in packet */ +}; + +struct r_ctx { + JCR *jcr; + int32_t stream; + int32_t prev_stream; + BFILE bfd; /* File content */ + uint64_t fileAddr; /* file write address */ + uint32_t size; /* Size of file */ + int flags; /* Options for extract_data() */ + BFILE forkbfd; /* Alternative data stream */ + uint64_t fork_addr; /* Write address for alternative stream */ + intmax_t fork_size; /* Size of alternate stream */ + int fork_flags; /* Options for extract_data() */ + int32_t type; /* file type FT_ */ + ATTR *attr; /* Pointer to attributes */ + bool extract; /* set when extracting */ + + SIGNATURE *sig; /* Cryptographic signature (if any) for file */ + CRYPTO_SESSION *cs; /* Cryptographic session data (if any) for file */ + RESTORE_CIPHER_CTX cipher_ctx; /* Cryptographic restore context (if any) for file */ + RESTORE_CIPHER_CTX fork_cipher_ctx; /* Cryptographic restore context (if any) for alternative stream */ +}; + +#endif diff --git a/bacula/src/filed/xattr.h b/bacula/src/filed/xattr.h index 90800a0385..c8c999d1c2 100644 --- a/bacula/src/filed/xattr.h +++ b/bacula/src/filed/xattr.h @@ -26,8 +26,8 @@ Switzerland, email:ftf@fsfeurope.org. */ -#ifndef _BACULA_XATTR_ -#define _BACULA_XATTR_ +#ifndef _BACULA_XATTR_H +#define _BACULA_XATTR_H /* * Magic used in the magic field of the xattr struct. -- 2.39.5