diff options
Diffstat (limited to 'core/src/stored/ndmp_tape.cc')
-rw-r--r-- | core/src/stored/ndmp_tape.cc | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/core/src/stored/ndmp_tape.cc b/core/src/stored/ndmp_tape.cc index ada800e5f..b08f1a2a6 100644 --- a/core/src/stored/ndmp_tape.cc +++ b/core/src/stored/ndmp_tape.cc @@ -45,7 +45,7 @@ # include "stored/bsr.h" # include "stored/device.h" # include "stored/device_control_record.h" -# include "stored/jcr_private.h" +# include "stored/stored_jcr_impl.h" # include "stored/label.h" # include "stored/mount.h" # include "stored/read_record.h" @@ -293,7 +293,7 @@ static inline bool bndmp_write_data_to_block(JobControlRecord* jcr, uint32_t data_length) { bool retval = false; - DeviceControlRecord* dcr = jcr->impl->dcr; + DeviceControlRecord* dcr = jcr->sd_impl->dcr; POOLMEM* rec_data; if (!dcr) { @@ -341,8 +341,8 @@ static inline bool bndmp_read_data_from_block(JobControlRecord* jcr, uint32_t wanted_data_length, uint32_t* data_length) { - DeviceControlRecord* dcr = jcr->impl->read_dcr; - READ_CTX* rctx = jcr->impl->read_session.rctx; + DeviceControlRecord* dcr = jcr->sd_impl->read_dcr; + READ_CTX* rctx = jcr->sd_impl->read_session.rctx; bool done = false; bool ok = true; @@ -446,7 +446,7 @@ static inline bool bndmp_read_data_from_block(JobControlRecord* jcr, // Generate virtual file attributes for the whole NDMP stream. static inline bool BndmpCreateVirtualFile(JobControlRecord* jcr, char* filename) { - DeviceControlRecord* dcr = jcr->impl->dcr; + DeviceControlRecord* dcr = jcr->sd_impl->dcr; struct stat statp; time_t now = time(NULL); PoolMem attribs(PM_NAME), data(PM_NAME); @@ -544,7 +544,7 @@ extern "C" ndmp9_error bndmp_tape_open(struct ndm_session* sess, /* There is a native storage daemon session waiting for the FD to connect. * In NDMP terms this is the same as a FD connecting so wake any waiting * threads. */ - pthread_cond_signal(&jcr->impl->job_start_wait); + pthread_cond_signal(&jcr->sd_impl->job_start_wait); /* Save the JobControlRecord to ndm_session binding so everything furher * knows which JobControlRecord belongs to which NDMP session. We have @@ -568,9 +568,9 @@ extern "C" ndmp9_error bndmp_tape_open(struct ndm_session* sess, // Depending on the open mode select the right DeviceControlRecord. if (will_write) { - dcr = jcr->impl->dcr; + dcr = jcr->sd_impl->dcr; } else { - dcr = jcr->impl->read_dcr; + dcr = jcr->sd_impl->read_dcr; } if (!dcr) { @@ -592,7 +592,7 @@ extern "C" ndmp9_error bndmp_tape_open(struct ndm_session* sess, /* One NDMP backup Job can be one or more save sessions so we keep * track if we already acquired the storage. */ - if (!jcr->impl->acquired_storage) { + if (!jcr->sd_impl->acquired_storage) { // Actually acquire the device which we reserved. if (!AcquireDeviceForAppend(dcr)) { goto bail_out; } @@ -603,7 +603,7 @@ extern "C" ndmp9_error bndmp_tape_open(struct ndm_session* sess, } // Keep track that we acquired the storage. - jcr->impl->acquired_storage = true; + jcr->sd_impl->acquired_storage = true; Dmsg1(50, "Begin append device=%s\n", dcr->dev->print_name()); @@ -648,16 +648,16 @@ extern "C" ndmp9_error bndmp_tape_open(struct ndm_session* sess, READ_CTX* rctx; // Setup internal system for reading data (if not done before). - if (!jcr->impl->acquired_storage) { + if (!jcr->sd_impl->acquired_storage) { Dmsg0(20, "Start read data.\n"); - if (jcr->impl->NumReadVolumes == 0) { + if (jcr->sd_impl->NumReadVolumes == 0) { Jmsg(jcr, M_FATAL, 0, _("No Volume names found for restore.\n")); goto bail_out; } Dmsg2(200, "Found %d volumes names to restore. First=%s\n", - jcr->impl->NumReadVolumes, jcr->impl->VolList->VolumeName); + jcr->sd_impl->NumReadVolumes, jcr->sd_impl->VolList->VolumeName); // Ready device for reading if (!AcquireDeviceForRead(dcr)) { goto bail_out; } @@ -669,7 +669,7 @@ extern "C" ndmp9_error bndmp_tape_open(struct ndm_session* sess, } // Keep track that we acquired the storage. - jcr->impl->acquired_storage = true; + jcr->sd_impl->acquired_storage = true; // Change the Job to running state. jcr->sendJobStatus(JS_Running); @@ -677,11 +677,11 @@ extern "C" ndmp9_error bndmp_tape_open(struct ndm_session* sess, Dmsg1(50, "Begin reading device=%s\n", dcr->dev->print_name()); PositionDeviceToFirstFile(jcr, dcr); - jcr->impl->read_session.mount_next_volume = false; + jcr->sd_impl->read_session.mount_next_volume = false; // Allocate a new read context for this Job. rctx = new_read_context(); - jcr->impl->read_session.rctx = rctx; + jcr->sd_impl->read_session.rctx = rctx; // Read the first block and setup record processing. if (!ReadNextBlockFromDevice(dcr, &rctx->sessrec, NULL, @@ -751,7 +751,8 @@ extern "C" ndmp9_error BndmpTapeClose(struct ndm_session* sess) } } - pthread_cond_signal(&jcr->impl->job_end_wait); /* wake any waiting thread */ + pthread_cond_signal( + &jcr->sd_impl->job_end_wait); /* wake any waiting thread */ ndmos_tape_initialize(sess); @@ -921,7 +922,7 @@ static inline void UnregisterCallbackHooks(struct ndm_session* sess) void EndOfNdmpBackup(JobControlRecord* jcr) { - DeviceControlRecord* dcr = jcr->impl->dcr; + DeviceControlRecord* dcr = jcr->sd_impl->dcr; char ec[50]; /* Don't use time_t for job_elapsed as time_t can be 32 or 64 bits, @@ -973,9 +974,9 @@ void EndOfNdmpBackup(JobControlRecord* jcr) } // Release the device -- and send final Vol info to DIR and unlock it. - if (jcr->impl->acquired_storage) { + if (jcr->sd_impl->acquired_storage) { ReleaseDevice(dcr); - jcr->impl->acquired_storage = false; + jcr->sd_impl->acquired_storage = false; } else { dcr->UnreserveDevice(); } @@ -986,16 +987,16 @@ void EndOfNdmpBackup(JobControlRecord* jcr) void EndOfNdmpRestore(JobControlRecord* jcr) { - if (jcr->impl->read_session.rctx) { - FreeReadContext(jcr->impl->read_session.rctx); - jcr->impl->read_session.rctx = NULL; + if (jcr->sd_impl->read_session.rctx) { + FreeReadContext(jcr->sd_impl->read_session.rctx); + jcr->sd_impl->read_session.rctx = NULL; } - if (jcr->impl->acquired_storage) { - ReleaseDevice(jcr->impl->read_dcr); - jcr->impl->acquired_storage = false; + if (jcr->sd_impl->acquired_storage) { + ReleaseDevice(jcr->sd_impl->read_dcr); + jcr->sd_impl->acquired_storage = false; } else { - jcr->impl->read_dcr->UnreserveDevice(); + jcr->sd_impl->read_dcr->UnreserveDevice(); } } |