DriveGeneric.hpp 22.8 KB
Newer Older
1
2
/*
 * @project        The CERN Tape Archive (CTA)
3
 * @copyright      Copyright(C) 2003-2021 CERN
4
5
6
7
 * @license        This program is free software: you can redistribute it and/or modify
 *                 it under the terms of the GNU General Public License as published by
 *                 the Free Software Foundation, either version 3 of the License, or
 *                 (at your option) any later version.
8
 *
9
10
11
12
 *                 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.
13
 *
14
15
16
 *                 You should have received a copy of the GNU General Public License
 *                 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
17
#pragma once 
18

19
#include "tapeserver/castor/tape/tapeserver/drive/DriveInterface.hpp"
Eric Cano's avatar
Eric Cano committed
20

21
22
namespace castor {
namespace tape {
23
namespace tapeserver {
24
namespace drive {
25
26
  
  CTA_GENERATE_EXCEPTION_CLASS(DriveDoesNotSupportRAOException);
27
/**
28
29
30
31
32
33
   * Class abstracting the tape drives. This class is templated to allow the use
   * of unrelated test harness and real system. The test harness is made up of 
   * a classes with virtual tables, but the real system wrapper has the real
   * system call directly into inline functions. This allows testing on a "fake"
   * system without paying performance price when calling system calls in the 
   * production system.
Eric Cano's avatar
Eric Cano committed
34
   */
35
  class DriveGeneric : public DriveInterface {
Eric Cano's avatar
Eric Cano committed
36
  public:
Eric Cano's avatar
Eric Cano committed
37
    DriveGeneric(SCSI::DeviceInfo di, System::virtualWrapper & sw);
38

39
    /* Operations to be used by the higher levels */
40

41
    /**
42
     * Return cumulative log counter values from the log pages related to
43
44
     * the drive statistics about data movements to/from the tape. 
     * Data fields fromHost, toDrive are related to the write operation and
45
46
47
     * fields toHost, fromDrive are related to the read operation. It is 
     * legal that the drive statistics will be reseted after the log page 
     * query on the drive.
48
49
     * @return compressionStats
     */
50
    virtual compressionStats getCompression()  = 0;
51

52
53
54
55
    /**
     * Get write error information from the drive.
     * @return writeErrorsStats
     */
56
    virtual std::map<std::string,uint64_t> getTapeWriteErrors();
57
58
59
60
61

    /**
     * Get read error information from the drive.
     * @return readErrorsStats
     */
62
    virtual std::map<std::string,uint64_t> getTapeReadErrors();
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

    /**
     * Get error information (other than read/write) from the drive.
     */
    virtual std::map<std::string,uint32_t> getTapeNonMediumErrors();

    /**
     * Get quality-related metrics (ratings, efficiencies) from the drive.
     */
    virtual std::map<std::string,float> getQualityStats();

    /**
     * Get drive error information happened during mount from the drive.
     */
    virtual std::map<std::string,uint32_t> getDriveStats();

    /**
     * Get volume information happened during the mount.
     */
    virtual std::map<std::string,uint32_t> getVolumeStats();

    /**
     * Get the firmware revision of the drive.
     * Reads it from /proc/scsi/scsi file.
     */
    virtual std::string getDriveFirmwareVersion();

90
    /**
91
     * Reset compression statistics about data movements on the drive.
92
     * All cumulative and threshold log counter values will be reset to their
93
94
     * default values as specified in that pages reset behavior section.
     */
95
    virtual void clearCompressionStats() = 0;
96

97
98
    /**
     * Information about the drive. The vendor id is used in the user labels of the files.
99
     * @return    The deviceInfo structure with the information about the drive.
100
     */
101
    virtual deviceInfo getDeviceInfo() ;
102
103
104
105
106
107
    
    /**
     * Generic SCSI path, used for passing to external scripts.
     * @return    Path to the generic SCSI device file.
     */
    virtual std::string getGenericSCSIPath();
108

109
110
111
112
    /**
     * Information about the serial number of the drive. 
     * @return   Right-aligned ASCII data for the vendor-assigned serial number.
     */
113
    virtual std::string getSerialNumber() ;
114

115
    /**
116
117
118
119
     * Position to logical object identifier (i.e. block address). 
     * This function is blocking: the immediate bit is not set.
     * The device server will not return status until the locate operation
     * has completed.
120
121
     * @param blockId The blockId, represented in local endianness.
     */
122
    virtual void positionToLogicalObject(uint32_t blockId) ;
123

124
125
126
127
128
129
    /**
     * Return logical position of the drive. This is the address of the next object
     * to read or write.
     * @return positionInfo class. This contains the logical position, plus information
     * on the dirty data still in the write buffer.
     */
130
    virtual positionInfo getPositionInfo() ;
131
132
133
134
135
136
137

    /**
     * Return physical position of the drive.
     *
     * @return physicalPositionInfo class. This contains the wrap and linear position (LPOS).
     */
    virtual physicalPositionInfo getPhysicalPositionInfo();
138
139
140
141
142
143
144
145
    
    /**
     * Returns all the end of wrap positions of the mounted tape
     * 
     * @return a vector of endOfWrapsPositions. 
     */
    virtual std::vector<endOfWrapPosition> getEndOfWrapPositions();
    
146

147
    /**
148
149
150
151
     * Get tape alert information from the drive. There is a quite long list of possible tape alerts.
     * They are described in SSC-4, section 4.2.20: TapeAlert application client interface
     * @return list of vector alerts codes. They can be translated to strings with
     *  getTapeAlerts and getTapeAlertsCompact.
152
153
     */
    std::vector<uint16_t> getTapeAlertCodes();
154

155
156
157
158
159
    /**
     * Get tape alert information from the drive. There is a quite long list of possible tape alerts.
     * They are described in SSC-4, section 4.2.20: TapeAlert application client interface
     * @return list of tape alerts descriptions. They are simply used for logging.
     */
160
    virtual std::vector<std::string> getTapeAlerts(const std::vector<uint16_t>& codes);
161
162
163
164
165
    
    /**
     * Get tape alert information from the drive. This is the same as getTapeAlerts,
     * but providing the alert strings in compact form (mixed case single word).
     */
166
    virtual std::vector<std::string> getTapeAlertsCompact(const std::vector<uint16_t> & codes);
167

168
169
170
171
172
173
174
175
176
    /**
     * Checks if there are tape alerts critical for the writing session present.
     * @param codes The vector of the tape alert codes returned by drive.
     * @return True if there are tape alerts critical for the writing session
     * present and false otherwise.
     */
    virtual bool tapeAlertsCriticalForWrite(
      const std::vector<uint16_t> & codes);

177
    /**
178
179
180
181
182
183
184
185
186
187
188
     * Set the tape density and compression. 
     * We use MODE SENSE/SELECT Device Configuration (10h) mode page.
     * As soon as there is no definition in SPC-4 or SSC-3 it depends on the 
     * drives documentation. 
     * 
     * @param densityCode  The tape specific density code.
     *                     If it is 0 (default) than we use the density code 
     *                     detected by the drive itself means no changes.
     *                                
     * @param compression  The boolean variable to enable or disable compression
     *                     on the drive for the tape. By default it is enabled.
189
     */
190
    virtual void setDensityAndCompression(bool compression = true,
191
            unsigned char densityCode = 0) ;
192

193
194
195
196
    /**
     * Get drive status.
     * @return structure containing various booleans, and error conditions.
     */
197
    virtual driveStatus getDriveStatus()  {
198
      throw cta::exception::Exception("Not implemented");
199
    }   
200
    
201
202
203
204
205
206
207
208
209
    /**
     * Test the readiness of the tape drive by using TEST UNIT READY described
     * in SPC-4. Throws exceptions if there are any problems and SCSI command 
     * status is not GOOD. The specific exceptions are thrown for supported by
     * st driver sense keys: NotReady and UnitAttention.
     */
    virtual void testUnitReady() const;
   
    /**
Daniele Kruse's avatar
Daniele Kruse committed
210
211
212
213
214
215
216
     * Detects readiness of the drive by calling SG_IO TEST_UNIT_READY in a
     * loop until happy, then open() and MTIOCGET in a loop until happy.
     * SG_IO TEST_UNIT_READY is used before open() because the open() of the st
     * driver cannot handle as many errors as SG_IO TEST_UNIT_READY.  open() is
     * called before MTIOCGET because MTIOCGET reads out the cached status of
     * the drive and open() refreshes it.  The result of MTIOCGET is checked for
     * the status GMT_ONLINE. Throws exceptions if the drive is not ready for
217
218
219
     * at least timeoutSeconds or any errors occurred. We consider any not GOOD 
     * SCSI replay with sense keys not equals to NotReady or UnitAttention as 
     * errors.
220
221
     * This method will pass through any exception encountered, and will throw
     * a TimeOut exception if not tape is found after timeout.
222
     * 
223
224
     * This method will at least query the tape drive once.
     * 
225
226
227
228
     * @param timeoutSecond The time in seconds for which it waits the drive to 
     *                      be ready.
     * @return true if the drive has the status GMT_ONLINE.
     */
229
    virtual void waitUntilReady(const uint32_t timeoutSecond);
230
231
    
    virtual bool hasTapeInPlace() {
232
233
      struct mtget mtInfo;
      /* Read drive status */
234
235
236
237
238
239
240
241
242
243
      const int ioctl_rc = m_sysWrapper.ioctl(m_tapeFD, MTIOCGET, &mtInfo);
      const int ioctl_errno = errno;
      if(-1 == ioctl_rc) {
        std::ostringstream errMsg;
        errMsg << "Could not read drive status in hasTapeInPlace: " << m_SCSIInfo.nst_dev;
        if(EBADF == ioctl_errno) {
          errMsg << " tapeFD=" << m_tapeFD;
        }
        throw cta::exception::Errnum(ioctl_errno, errMsg.str());
      }
244
      return GMT_DR_OPEN(mtInfo.mt_gstat) == 0;
245
246
    }
    
247
    virtual bool isWriteProtected()  {
248
249
      struct mtget mtInfo;
      /* Read drive status */
250
251
252
253
254
255
256
257
258
259
      const int ioctl_rc = m_sysWrapper.ioctl(m_tapeFD, MTIOCGET, &mtInfo);
      const int ioctl_errno = errno;
      if(-1 == ioctl_rc) {
        std::ostringstream errMsg;
        errMsg << "Could not read drive status in isWriteProtected: " << m_SCSIInfo.nst_dev;
        if(EBADF == ioctl_errno) {
          errMsg << " tapeFD=" << m_tapeFD;
        }
        throw cta::exception::Errnum(ioctl_errno, errMsg.str());
      }
260
      return GMT_WR_PROT(mtInfo.mt_gstat)!=0;
261
262
    }
    
263
    virtual bool isAtBOT()  {
264
265
      struct mtget mtInfo;
      /* Read drive status */
266
267
268
269
270
271
272
273
274
275
      const int ioctl_rc = m_sysWrapper.ioctl(m_tapeFD, MTIOCGET, &mtInfo);
      const int ioctl_errno = errno;
      if(-1 == ioctl_rc) {
        std::ostringstream errMsg;
        errMsg << "Could not read drive status in isAtBOT: " << m_SCSIInfo.nst_dev;
        if(EBADF == ioctl_errno) {
          errMsg << " tapeFD=" << m_tapeFD;
        }
        throw cta::exception::Errnum(ioctl_errno, errMsg.str());
      }
276
      return GMT_BOT(mtInfo.mt_gstat)!=0;
277
278
    }
    
279
    virtual bool isAtEOD()  {
280
281
      struct mtget mtInfo;
      /* Read drive status */
282
283
284
285
286
287
288
289
290
291
      const int ioctl_rc = m_sysWrapper.ioctl(m_tapeFD, MTIOCGET, &mtInfo);
      const int ioctl_errno = errno;
      if(-1 == ioctl_rc) {
        std::ostringstream errMsg;
        errMsg << "Could not read drive status in isAtEOD: " << m_SCSIInfo.nst_dev;
        if(EBADF == ioctl_errno) {
          errMsg << " tapeFD=" << m_tapeFD;
        }
        throw cta::exception::Errnum(ioctl_errno, errMsg.str());
      }
292
      return GMT_EOD(mtInfo.mt_gstat)!=0;
Daniele Kruse's avatar
Daniele Kruse committed
293
294
295
296
297
298
299
    }    
        
    /**
     * Function that checks if a tape is blank (contains no records) 
     * @return true if tape is blank, false otherwise
     */
    virtual bool isTapeBlank();
300

301
302
303
304
305
306
307
308
309
    /**
     * Function that returns internal status of the logical block protection
     * method to be used for read/write from/to the tape drive.
     * @return The lbp to be used for read/write from/to the tape drive.
     */
    virtual lbpToUse getLbpToUse() {
      return m_lbpToUse;
    }

310
    /**
311
     * Set the buffer write switch in the st driver. This is directly matching a configuration
312
     * parameter in CASTOR, so this function has to be public and usable by a higher level
313
314
     * layer, unless the parameter turns out to be disused.
     * @param bufWrite: value of the buffer write switch
315
     */
316
    virtual void setSTBufferWrite(bool bufWrite) ;
317

318
319
    /**
     * Jump to end of media. This will use setSTFastMTEOM() to disable MT_ST_FAST_MTEOM.
Eric Cano's avatar
Eric Cano committed
320
321
322
323
     * (See TapeServer's handbook for details). This is used to rebuild the MIR (StorageTek)
     * or tape directory (IBM).
     * Tape directory rebuild is described only for IBM but currently applied to 
     * all tape drives.
324
325
     * TODO: synchronous? Timeout?
     */
326
    virtual void fastSpaceToEOM(void) ;
327

328
    /**
Eric Cano's avatar
Eric Cano committed
329
     * Rewind tape.
330
     */
331
    virtual void rewind(void) ;
332

Eric Cano's avatar
Eric Cano committed
333
334
335
336
    /**
     * Jump to end of data. EOM in ST driver jargon, end of data (which is more accurate)
     * in SCSI terminology).
     */
337
    virtual void spaceToEOM(void) ;
338

Eric Cano's avatar
Eric Cano committed
339
    /**
340
     * Space count file marks backwards.
Eric Cano's avatar
Eric Cano committed
341
342
     * @param count
     */
343
    virtual void spaceFileMarksBackwards(size_t count) ;
344

Eric Cano's avatar
Eric Cano committed
345
    /**
346
     * Space count file marks forward.
Eric Cano's avatar
Eric Cano committed
347
348
     * @param count
     */
349
    virtual void spaceFileMarksForward(size_t count) ;
350

Eric Cano's avatar
Eric Cano committed
351
352
353
    /**
     * Unload the tape.
     */
354
    virtual void unloadTape(void) ;
355

Eric Cano's avatar
Eric Cano committed
356
357
358
359
    /**
     * Synch call to the tape drive. This function will not return before the 
     * data in the drive's buffer is actually comitted to the medium.
     */
360
    virtual void flush(void) ;
361

Eric Cano's avatar
Eric Cano committed
362
363
364
365
366
    /**
     * Write count file marks. The function does not return before the file marks 
     * are committed to medium.
     * @param count
     */
367
    virtual void writeSyncFileMarks(size_t count) ;
368

Eric Cano's avatar
Eric Cano committed
369
370
371
372
373
    /**
     * Write count file marks asynchronously. The file marks are just added to the drive's
     * buffer and the function return immediately.
     * @param count
     */
374
    virtual void writeImmediateFileMarks(size_t count) ;
Eric Cano's avatar
Eric Cano committed
375
376
377
378
379
380

    /**
     * Write a data block to tape.
     * @param data pointer the the data block
     * @param count size of the data block
     */
381
    virtual void writeBlock(const void * data, size_t count) ;
382

Eric Cano's avatar
Eric Cano committed
383
384
385
386
    /**
     * Read a data block from tape.
     * @param data pointer the the data block
     * @param count size of the data block
387
     * @return the actual size of read data
Eric Cano's avatar
Eric Cano committed
388
     */
389
    virtual ssize_t readBlock(void * data, size_t count) ;
Eric Cano's avatar
Eric Cano committed
390
391
392
393
394
395
396
397
398
    
    /**
     * Read a data block from tape. Throw an exception if the read block is not
     * the exact size of the buffer.
     * @param data pointer the the data block
     * @param count size of the data block
     * @param context optional context to be added to the thrown exception
     * @return the actual size of read data
     */
399
    virtual void readExactBlock(void * data, size_t count, std::string context= "") ;
Eric Cano's avatar
Eric Cano committed
400
401
402
403
404
    
    /**
     * Read over a file mark. Throw an exception we do not read one.
     * @return the actual size of read data
     */
405
    virtual void readFileMark(std::string context= "") ;
406
    
Eric Cano's avatar
Eric Cano committed
407
    virtual ~DriveGeneric() {
408
      if (-1 != m_tapeFD)
409
        m_sysWrapper.close(m_tapeFD);      
Eric Cano's avatar
Eric Cano committed
410
    }
411
412

    void SCSI_inquiry();
Eric Cano's avatar
Eric Cano committed
413
    
414
    /**
415
416
     * Enable Logical Block Protection on the drive for reading only. 
     * Set method CRC32C to be used.
417
418
419
420
     */
    virtual void enableCRC32CLogicalBlockProtectionReadOnly();
    
    /**
421
422
     * Enable Logical Block Protection on the drive for reading and writing. 
     * Set method CRC32C to be used.
423
424
     */
    virtual void enableCRC32CLogicalBlockProtectionReadWrite();
425
426
    /**
     * Disable Logical Block Protection on the drive.
427
428
429
     */
    virtual void disableLogicalBlockProtection();
    
430
431
432
433
434
435
436
437
438
439
440
    /**
     * Return Logical Block Protection Information of the drive.
     * 
     * We use MODE SENSE Control Data Protection (0Ah) mode page as 
     * described in SSC-5. 
     * 
     * @return LBPInfo class. This contains the LBP method to be used for 
     * Logical Block Protection, the method length, the status if LBP enabled
     * for reading and the status if LBP enabled for writing.
     */
    virtual LBPInfo getLBPInfo();
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464

    /**
     * Set an encryption key used by the tape drive to encrypt data written
     * or decrypt encrypted data read using an SPOUT command.
     * On AES-256, if the key is less than 32 characters, it pads with zeros.
     * If the key is more than 32 character, it takes the first 32 characters.
     * If called on already encryption-enabled drive, it will override the encryption params.
     * @param encryption_key The key with which the drive should encrypt/decrypt data
     */
    virtual void setEncryptionKey(const std::string &encryption_key);

    /**
     * Clear the encryption parameters from the tape drive using an SPOUT command.
     * Does not need to check if encryption key is already present or not.
     * @return true if the device has encrypiton capabilities enabled, false otherwise
     */
    virtual bool clearEncryptionKey();

    /**
     * Check if Encryption capability is enabled by the vendor library inteface.
     * This function is implemented in a vendor-specific way.
     * @return true if the encryption capability is enabled, false otherwise.
     */
    virtual bool isEncryptionCapEnabled();
465
    
466
467
    /**
     * Query the drive for the maximum number and size of User Data Segments (UDS)
Cristina Moraru's avatar
Cristina Moraru committed
468
     * @return udsLimits class. A pair of the above mentioned parameters
469
     */
Cristina Moraru's avatar
Cristina Moraru committed
470
    virtual SCSI::Structures::RAO::udsLimits getLimitUDS();
471

472
473
474
475
476
    /**
     * 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]
477
     * @param maxSupported, the max number of files the drive is able to perform an RAO on
478
     */
479
480
    virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported);
    
481
  protected:
Eric Cano's avatar
Eric Cano committed
482
    SCSI::DeviceInfo m_SCSIInfo;
483
    int m_tapeFD; 
484
    castor::tape::System::virtualWrapper & m_sysWrapper;
485
486
    lbpToUse m_lbpToUse;

487
488
489
490
491
492
    /**
     * Set the MTFastEOM option of the ST driver. This function is used only internally in 
     * mounttape (in CAStor), so it could be a private function, not visible to 
     * the higher levels of the software (TODO: protected?).
     * @param fastMTEOM the option switch.
     */
493
    virtual void setSTFastMTEOM(bool fastMTEOM) ;
494
495
    
    /**
496
     * Time based loop around "test unit ready" command
497
     */
498
    void waitTestUnitReady(const uint32_t timeoutSecond);
499
500
    
    /**
501
502
503
504
505
506
507
508
509
     * Set the tape Logical Block Protection. 
     * We use MODE SENSE/SELECT Control Data Protection (0Ah) mode page as 
     * described in SSC-5.
     * 
     * @param method            The LBP method to be set.
     * @param methodLength      The method length in bytes.
     * @param enableLPBforRead  Should be LBP set for reading.
     * @param enableLBBforWrite Should be LBP set for writing.
     *                                
510
511
512
513
     */
    virtual void setLogicalBlockProtection(const unsigned char method,
      unsigned char methodLength, const bool enableLPBforRead, 
      const bool enableLBBforWrite);
514
515
516
517
518
519
520
521

    /**
     * Send to the drive the command to generate the Recommended Access Order for
     * a series of files
     * @param blocks A mapping between a string identifier referring the file ID
     * and a pair of block limits
     * @param maxSupported The maximum number of UDS supported - obtained by getLimitUDS()
     */
Cristina Moraru's avatar
Cristina Moraru committed
522
    virtual void generateRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported);
523
524
525
526
527
528
    
    /**
     * Receive the Recommended Access Order
     * @param offset 
     * @param allocationLength
     */
Cristina Moraru's avatar
Cristina Moraru committed
529
    virtual void receiveRAO(std::list<SCSI::Structures::RAO::blockLims> &files);
Eric Cano's avatar
Eric Cano committed
530
  };
531

Eric Cano's avatar
Eric Cano committed
532
  class DriveT10000 : public DriveGeneric {
533
534
535
  protected:
    compressionStats m_compressionStatsBase;
    compressionStats getCompressionStats();
536
  public:
537

Eric Cano's avatar
Eric Cano committed
538
    DriveT10000(SCSI::DeviceInfo di, System::virtualWrapper & sw) : DriveGeneric(di, sw) {
539
      castor::tape::SCSI::Structures::zeroStruct(&m_compressionStatsBase);
540
    }
541

542
    virtual compressionStats getCompression();
543
    virtual void clearCompressionStats();
544
    virtual bool isEncryptionCapEnabled();
545
546
    virtual std::map<std::string,uint64_t> getTapeWriteErrors();
    virtual std::map<std::string,uint64_t> getTapeReadErrors();
547
    virtual std::map<std::string,uint32_t> getVolumeStats();
548
549
    virtual std::map<std::string,float> getQualityStats();
    virtual std::map<std::string,uint32_t> getDriveStats();
550
    virtual drive::deviceInfo getDeviceInfo();
551
  };
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
  
  /**
   * This class will override DriveT10000 for usage with the MHVTL virtual
   * tape drive. It will fail to operate logic block protection by software
   * and avoid calling the mode pages not supported by MHVTL.
   */
  class DriveMHVTL: public DriveT10000 {
  public:
    DriveMHVTL(SCSI::DeviceInfo di, System::virtualWrapper & sw) : DriveT10000(di, sw) {}
    virtual void disableLogicalBlockProtection();
    virtual void enableCRC32CLogicalBlockProtectionReadOnly();
    virtual void enableCRC32CLogicalBlockProtectionReadWrite();
    virtual drive::LBPInfo getLBPInfo();
    virtual lbpToUse getLbpToUse();
    virtual void setLogicalBlockProtection(const unsigned char method, 
      unsigned char methodLength, const bool enableLPBforRead, 
      const bool enableLBBforWrite);
569
570
571
    virtual void setEncryptionKey(const std::string &encryption_key);
    virtual bool clearEncryptionKey();
    virtual bool isEncryptionCapEnabled();
572
573
    virtual std::map<std::string,uint64_t> getTapeWriteErrors();
    virtual std::map<std::string,uint64_t> getTapeReadErrors();
574
575
576
    virtual std::map<std::string,uint32_t> getTapeNonMediumErrors();
    virtual std::map<std::string,float> getQualityStats();
    virtual std::map<std::string,uint32_t> getDriveStats();
577
    virtual std::map<std::string,uint32_t> getVolumeStats();
578
    virtual drive::deviceInfo getDeviceInfo();
579
    virtual SCSI::Structures::RAO::udsLimits getLimitUDS();
580
    virtual void queryRAO(std::list<SCSI::Structures::RAO::blockLims> &files, int maxSupported);
581
  };
582

Eric Cano's avatar
Eric Cano committed
583
  class DriveLTO : public DriveGeneric {
584
585
  public:

Eric Cano's avatar
Eric Cano committed
586
    DriveLTO(SCSI::DeviceInfo di, System::virtualWrapper & sw) : DriveGeneric(di, sw) {
587
    }
588

589
    virtual compressionStats getCompression();
590
    virtual void clearCompressionStats();
591
    virtual std::vector<castor::tape::tapeserver::drive::endOfWrapPosition> getEndOfWrapPositions();
592
  };
593

Eric Cano's avatar
Eric Cano committed
594
  class DriveIBM3592 : public DriveGeneric {
595
  public:
596

Eric Cano's avatar
Eric Cano committed
597
    DriveIBM3592(SCSI::DeviceInfo di, System::virtualWrapper & sw) : DriveGeneric(di, sw) {
598
    }
599

600
    virtual compressionStats getCompression();
601
602
603
    virtual void clearCompressionStats();
    virtual std::map<std::string,uint64_t> getTapeWriteErrors();
    virtual std::map<std::string,uint64_t> getTapeReadErrors();
604
605
606
    virtual std::map<std::string,uint32_t> getVolumeStats();
    virtual std::map<std::string,float> getQualityStats();
    virtual std::map<std::string,uint32_t> getDriveStats();
607
    virtual bool isEncryptionCapEnabled();
608
  };
609

610
611
}}}}