Commit 0ad2455c authored by Cristina Moraru's avatar Cristina Moraru
Browse files

Change the drive interface for RAO


Signed-off-by: default avatarCristina Moraru <cristina-gabriela.moraru@cern.ch>
parent d5a8098c
......@@ -742,9 +742,7 @@ namespace SCSI {
class modeRAO {
public:
enum {
DEFAULT_RRAO_ALLOCATION = 64000
};
static const uint16_t DEFAULT_RRAO_ALLOCATION = 64000;
};
} // namespace SCSI
} // namespace tape
......
......@@ -1217,8 +1217,8 @@ namespace SCSI {
udsLimitsPage_t() {
zeroStruct(this);
}
int maxSupported;
int maxSize;
unsigned int maxSupported;
unsigned int maxSize;
};
/**
......@@ -1310,8 +1310,8 @@ namespace SCSI {
zeroStruct(this);
}
unsigned char fseq[10];
int begin;
int end;
uint64_t begin;
uint64_t end;
};
}
......
......@@ -821,8 +821,8 @@ void drive::DriveGeneric::generateRAO(std::list<SCSI::Structures::RAO::blockLims
SCSI::ExceptionLauncher(sgh, "SCSI error in DriveGeneric::requestRAO");
}
void drive::DriveGeneric::receiveRAO(int offset, int allocationLength) {
void drive::DriveGeneric::receiveRAO(std::list<SCSI::Structures::RAO::blockLims> &files,
int offset, int allocationLength) {
SCSI::Structures::LinuxSGIO_t sgh;
SCSI::Structures::RAO::recieveRAO_t cdb;
SCSI::Structures::senseData_t<255> senseBuff;
......@@ -850,16 +850,19 @@ void drive::DriveGeneric::receiveRAO(int offset, int allocationLength) {
uint32_t desc_list_len = SCSI::Structures::toU32(params.raoDescriptorListLength);
for (uint32_t i = 0;i < desc_list_len / sizeof(SCSI::Structures::RAO::udsDescriptor);++i) {
std::cout << params.udsDescriptors[i].udsName << ":" << SCSI::Structures::toU64(params.udsDescriptors[i].beginLogicalObjID) <<
":" << SCSI::Structures::toU64(params.udsDescriptors[i].endLogicalObjID) << std::endl;
SCSI::Structures::RAO::blockLims bl;
strncpy((char*)bl.fseq, (char*)params.udsDescriptors[i].udsName, 10);
bl.begin = SCSI::Structures::toU64(params.udsDescriptors[i].beginLogicalObjID);
bl.end = SCSI::Structures::toU64(params.udsDescriptors[i].endLogicalObjID);
files.emplace_back(bl);
}
}
void drive::DriveGeneric::queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files) {
SCSI::Structures::RAO::udsLimitsPage_t limits = getLimitUDS();
generateRAO(files, limits.maxSupported);
receiveRAO(0, (new SCSI::modeRAO())->DEFAULT_RRAO_ALLOCATION);
void drive::DriveGeneric::queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files,
int maxSupported) {
generateRAO(files, maxSupported);
files.clear();
receiveRAO(files, 0, SCSI::modeRAO::DEFAULT_RRAO_ALLOCATION);
}
/**
......
......@@ -452,13 +452,19 @@ namespace drive {
*/
virtual bool isEncryptionCapEnabled();
/**
* Query the drive for the maximum number and size of User Data Segments (UDS)
* @return udsLimitsPage_t class. A pair of the above mentioned parameters
*/
virtual SCSI::Structures::RAO::udsLimitsPage_t getLimitUDS();
/**
* Query the drive for the Recommended Access Order (RAO)
* for a series of files
* @param filename The name of the file containing the sequential order of
* a list of files [line format: ID:BLOCK_START:BLOCK_END]
*/
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files);
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported);
protected:
SCSI::DeviceInfo m_SCSIInfo;
......@@ -493,12 +499,6 @@ namespace drive {
virtual void setLogicalBlockProtection(const unsigned char method,
unsigned char methodLength, const bool enableLPBforRead,
const bool enableLBBforWrite);
/**
* Query the drive for the maximum number and size of User Data Segments (UDS)
* @return udsLimitsPage_t class. A pair of the above mentioned parameters
*/
virtual SCSI::Structures::RAO::udsLimitsPage_t getLimitUDS();
/**
* Send to the drive the command to generate the Recommended Access Order for
......@@ -514,7 +514,8 @@ namespace drive {
* @param offset
* @param allocationLength
*/
virtual void receiveRAO(int offset, int allocationLength);
virtual void receiveRAO(std::list<SCSI::Structures::RAO::blockLims> &files,
int offset, int allocationLength);
};
class DriveT10000 : public DriveGeneric {
......
......@@ -232,7 +232,8 @@ namespace drive {
virtual lbpToUse getLbpToUse() = 0;
virtual bool hasTapeInPlace() = 0;
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files) = 0;
virtual SCSI::Structures::RAO::udsLimitsPage_t getLimitUDS() = 0;
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported) = 0;
/**
* The configuration of the tape drive as parsed from the TPCONFIG file.
......
......@@ -22,6 +22,7 @@
*****************************************************************************/
#include "castor/tape/tapeserver/drive/FakeDrive.hpp"
#include "castor/tape/tapeserver/SCSI/Structures.hpp"
#include <iostream>
namespace {
......@@ -297,8 +298,13 @@ bool castor::tape::tapeserver::drive::FakeDrive::hasTapeInPlace() {
return true;
}
castor::tape::SCSI::Structures::RAO::udsLimitsPage_t
castor::tape::tapeserver::drive::FakeDrive::getLimitUDS() {
throw cta::exception::Exception("In DriveFakeDrive::getLimitUDS: Not implemented.");
}
void castor::tape::tapeserver::drive::FakeDrive::queryRAO(
std::list<SCSI::Structures::RAO::blockLims> &files) {
std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported) {
throw cta::exception::Exception("In DriveFakeDrive::queryRAO: Not implemented.");
}
......
......@@ -109,7 +109,8 @@ namespace drive {
virtual bool isTapeBlank();
virtual lbpToUse getLbpToUse();
virtual bool hasTapeInPlace();
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files);
virtual castor::tape::SCSI::Structures::RAO::udsLimitsPage_t getLimitUDS();
virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported);
};
}}}}
......@@ -259,8 +259,8 @@ int main (int argc, char *argv[])
else {
throw -1;
}
drive->queryRAO(files);
castor::tape::SCSI::Structures::RAO::udsLimitsPage_t limits = drive->getLimitUDS();
drive->queryRAO(files, limits.maxSupported);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment