]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/stored/dev.h
11Apr07
[bacula/bacula] / bacula / src / stored / dev.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version two of the GNU General Public
10    License as published by the Free Software Foundation plus additions
11    that are listed in the file LICENSE.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23    Bacula® is a registered trademark of John Walker.
24    The licensor of Bacula is the Free Software Foundation Europe
25    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26    Switzerland, email:ftf@fsfeurope.org.
27 */
28 /*
29  * Definitions for using the Device functions in Bacula
30  *  Tape and File storage access
31  *
32  * Kern Sibbald, MM
33  *
34  *   Version $Id$
35  *
36  */
37
38
39 #ifndef __DEV_H
40 #define __DEV_H 1
41
42 #ifdef SD_DEBUG_LOCK
43 #define r_dlock() _r_dlock(__FILE__, __LINE__);      /* in device.c */
44 #define r_dunlock() _r_dunlock(__FILE__, __LINE__);  /* in device.c */
45 #define dlock() _dlock(__FILE__, __LINE__);          /* in device.c */
46 #define dunlock() _dunlock(__FILE__, __LINE__);     /* in device.c */
47 #endif
48
49 #undef DCR                            /* used by Bacula */
50
51 #define block_device(d, s) _block_device(__FILE__, __LINE__, (d), s)
52 #define unblock_device(d) _unblock_device(__FILE__, __LINE__, (d))
53 #define steal_device_lock(d, p, s) _steal_device_lock(__FILE__, __LINE__, (d), (p), s)
54 #define give_back_device_lock(d, p) _give_back_device_lock(__FILE__, __LINE__, (d), (p))
55
56 /* Return values from wait_for_sysop() */
57 enum {
58    W_ERROR = 1,
59    W_TIMEOUT,
60    W_POLL,
61    W_MOUNT,
62    W_WAKE
63 };
64
65 /* Arguments to open_dev() */
66 enum {
67    CREATE_READ_WRITE = 1,
68    OPEN_READ_WRITE,
69    OPEN_READ_ONLY,
70    OPEN_WRITE_ONLY
71 };
72
73 /* Device types */
74 enum {
75    B_FILE_DEV = 1,
76    B_TAPE_DEV,
77    B_DVD_DEV,
78    B_FIFO_DEV,
79    B_PROG_DEV
80 };
81
82 /* Generic status bits returned from status_dev() */
83 #define BMT_TAPE           (1<<0)     /* is tape device */
84 #define BMT_EOF            (1<<1)     /* just read EOF */
85 #define BMT_BOT            (1<<2)     /* at beginning of tape */
86 #define BMT_EOT            (1<<3)     /* end of tape reached */
87 #define BMT_SM             (1<<4)     /* DDS setmark */
88 #define BMT_EOD            (1<<5)     /* DDS at end of data */
89 #define BMT_WR_PROT        (1<<6)     /* tape write protected */
90 #define BMT_ONLINE         (1<<7)     /* tape online */
91 #define BMT_DR_OPEN        (1<<8)     /* tape door open */
92 #define BMT_IM_REP_EN      (1<<9)     /* immediate report enabled */
93
94
95 /* Bits for device capabilities */
96 #define CAP_EOF            (1<<0)     /* has MTWEOF */
97 #define CAP_BSR            (1<<1)     /* has MTBSR */
98 #define CAP_BSF            (1<<2)     /* has MTBSF */
99 #define CAP_FSR            (1<<3)     /* has MTFSR */
100 #define CAP_FSF            (1<<4)     /* has MTFSF */
101 #define CAP_EOM            (1<<5)     /* has MTEOM */
102 #define CAP_REM            (1<<6)     /* is removable media */
103 #define CAP_RACCESS        (1<<7)     /* is random access device */
104 #define CAP_AUTOMOUNT      (1<<8)     /* Read device at start to see what is there */
105 #define CAP_LABEL          (1<<9)     /* Label blank tapes */
106 #define CAP_ANONVOLS       (1<<10)    /* Mount without knowing volume name */
107 #define CAP_ALWAYSOPEN     (1<<11)    /* always keep device open */
108 #define CAP_AUTOCHANGER    (1<<12)    /* AutoChanger */
109 #define CAP_OFFLINEUNMOUNT (1<<13)    /* Offline before unmount */
110 #define CAP_STREAM         (1<<14)    /* Stream device */
111 #define CAP_BSFATEOM       (1<<15)    /* Backspace file at EOM */
112 #define CAP_FASTFSF        (1<<16)    /* Fast forward space file */
113 #define CAP_TWOEOF         (1<<17)    /* Write two eofs for EOM */
114 #define CAP_CLOSEONPOLL    (1<<18)    /* Close device on polling */
115 #define CAP_POSITIONBLOCKS (1<<19)    /* Use block positioning */
116 #define CAP_MTIOCGET       (1<<20)    /* Basic support for fileno and blkno */
117 #define CAP_REQMOUNT       (1<<21)    /* Require mount to read files back (typically: DVD) */
118 #define CAP_CHECKLABELS    (1<<22)    /* Check for ANSI/IBM labels */
119
120 /* Test state */
121 #define dev_state(dev, st_state) ((dev)->state & (st_state))
122
123 /* Device state bits */
124 #define ST_XXXXXX          (1<<0)     /* was ST_OPENED */
125 #define ST_XXXXX           (1<<1)     /* was ST_TAPE */
126 #define ST_XXXX            (1<<2)     /* was ST_FILE */
127 #define ST_XXX             (1<<3)     /* was ST_FIFO */
128 #define ST_XX              (1<<4)     /* was ST_DVD */
129 #define ST_X               (1<<5)     /* was ST_PROG */
130
131 #define ST_LABEL           (1<<6)     /* label found */
132 #define ST_MALLOC          (1<<7)     /* dev packet malloc'ed in init_dev() */
133 #define ST_APPEND          (1<<8)     /* ready for Bacula append */
134 #define ST_READ            (1<<9)     /* ready for Bacula read */
135 #define ST_EOT             (1<<10)    /* at end of tape */
136 #define ST_WEOT            (1<<11)    /* Got EOT on write */
137 #define ST_EOF             (1<<12)    /* Read EOF i.e. zero bytes */
138 #define ST_NEXTVOL         (1<<13)    /* Start writing on next volume */
139 #define ST_SHORT           (1<<14)    /* Short block read */
140 #define ST_MOUNTED         (1<<15)    /* the device is mounted to the mount point */
141 #define ST_MEDIA           (1<<16)    /* Media found in mounted device */
142 #define ST_OFFLINE         (1<<17)    /* set offline by operator */
143 #define ST_PART_SPOOLED    (1<<18)    /* spooling part */
144 #define ST_FREESPACE_OK    (1<<19)    /* Have valid freespace for DVD */
145
146 /* m_blocked states (mutually exclusive) */
147 enum {
148    BST_NOT_BLOCKED = 0,               /* not blocked */
149    BST_UNMOUNTED,                     /* User unmounted device */
150    BST_WAITING_FOR_SYSOP,             /* Waiting for operator to mount tape */
151    BST_DOING_ACQUIRE,                 /* Opening/validating/moving tape */
152    BST_WRITING_LABEL,                 /* Labeling a tape */
153    BST_UNMOUNTED_WAITING_FOR_SYSOP,   /* User unmounted during wait for op */
154    BST_MOUNT                          /* Mount request */
155 };
156
157 /* Volume Catalog Information structure definition */
158 struct VOLUME_CAT_INFO {
159    /* Media info for the current Volume */
160    uint32_t VolCatJobs;               /* number of jobs on this Volume */
161    uint32_t VolCatFiles;              /* Number of files */
162    uint32_t VolCatBlocks;             /* Number of blocks */
163    uint64_t VolCatBytes;              /* Number of bytes written */
164    uint32_t VolCatParts;              /* Number of parts written */
165    uint32_t VolCatMounts;             /* Number of mounts this volume */
166    uint32_t VolCatErrors;             /* Number of errors this volume */
167    uint32_t VolCatWrites;             /* Number of writes this volume */
168    uint32_t VolCatReads;              /* Number of reads this volume */
169    uint64_t VolCatRBytes;             /* Number of bytes read */
170    uint32_t VolCatRecycles;           /* Number of recycles this volume */
171    uint32_t EndFile;                  /* Last file number */
172    uint32_t EndBlock;                 /* Last block number */
173    int32_t  LabelType;                /* Bacula/ANSI/IBM */
174    int32_t  Slot;                     /* >0=Slot loaded, 0=nothing, -1=unknown */
175    uint32_t VolCatMaxJobs;            /* Maximum Jobs to write to volume */
176    uint32_t VolCatMaxFiles;           /* Maximum files to write to volume */
177    uint64_t VolCatMaxBytes;           /* Max bytes to write to volume */
178    uint64_t VolCatCapacityBytes;      /* capacity estimate */
179    btime_t  VolReadTime;              /* time spent reading */
180    btime_t  VolWriteTime;             /* time spent writing this Volume */
181    int64_t  VolMediaId;               /* MediaId */
182    utime_t  VolFirstWritten;          /* Time of first write */
183    bool     InChanger;                /* Set if vol in current magazine */
184    char VolCatStatus[20];             /* Volume status */
185    char VolCatName[MAX_NAME_LENGTH];  /* Desired volume to mount */
186 };
187
188
189 typedef struct s_steal_lock {
190    pthread_t  no_wait_id;             /* id of no wait thread */
191    int        dev_blocked;            /* state */
192    int        dev_prev_blocked;       /* previous blocked state */
193 } bsteal_lock_t;
194
195 class DEVRES;                        /* Device resource defined in stored_conf.h */
196
197 class DCR; /* forward reference */
198 class VOLRES; /* forward reference */
199
200 /*
201  * Used in unblock() call
202  */
203 enum {
204    dev_locked = true,
205    dev_unlocked = false
206 };
207
208 /*
209  * Device structure definition. There is one of these for
210  *  each physical device. Everything here is "global" to
211  *  that device and effects all jobs using the device.
212  */
213 class DEVICE {
214 private:
215    int m_fd;                          /* file descriptor */
216    int m_blocked;                     /* set if we must wait (i.e. change tape) */
217    int m_count;                       /* Mutex use count -- DEBUG only */
218    pthread_t m_pid;                   /* Thread that locked -- DEBUG only */
219 public:
220    dlist *attached_dcrs;              /* attached DCR list */
221    pthread_mutex_t m_mutex;           /* access control */
222    pthread_mutex_t spool_mutex;       /* mutex for updating spool_size */
223    pthread_cond_t wait;               /* thread wait variable */
224    pthread_cond_t wait_next_vol;      /* wait for tape to be mounted */
225    pthread_t no_wait_id;              /* this thread must not wait */
226    int dev_prev_blocked;              /* previous blocked state */
227    int num_waiting;                   /* number of threads waiting */
228    int num_writers;                   /* number of writing threads */
229    int reserved_device;               /* number of device reservations */
230
231    /* New access control in process of being implemented */
232 // brwlock_t xlock;                   /* New mutual exclusion lock */
233
234    int capabilities;                  /* capabilities mask */
235    int state;                         /* state mask */
236    int dev_errno;                     /* Our own errno */
237    int mode;                          /* read/write modes */
238    int openmode;                      /* parameter passed to open_dev (useful to reopen the device) */
239    int dev_type;                      /* device type */
240    bool autoselect;                   /* Autoselect in autochanger */
241    int label_type;                    /* Bacula/ANSI/IBM label types */
242    uint32_t drive_index;              /* Autochanger drive index (base 0) */
243    int32_t  Slot;                     /* Slot currently in drive (base 1) */
244    POOLMEM *dev_name;                 /* Physical device name */
245    POOLMEM *prt_name;                 /* Name used for display purposes */
246    char *errmsg;                      /* nicely edited error message */
247    uint32_t block_num;                /* current block number base 0 */
248    uint32_t file;                     /* current file number base 0 */
249    uint64_t file_addr;                /* Current file read/write address */
250    uint64_t file_size;                /* Current file size */
251    uint32_t EndBlock;                 /* last block written */
252    uint32_t EndFile;                  /* last file written */
253    uint32_t min_block_size;           /* min block size */
254    uint32_t max_block_size;           /* max block size */
255    uint64_t max_volume_size;          /* max bytes to put on one volume */
256    uint64_t max_file_size;            /* max file size to put in one file on volume */
257    uint64_t volume_capacity;          /* advisory capacity */
258    uint64_t max_spool_size;           /* maximum spool file size */
259    uint64_t spool_size;               /* current spool size for this device */
260    uint32_t max_rewind_wait;          /* max secs to allow for rewind */
261    uint32_t max_open_wait;            /* max secs to allow for open */
262    uint32_t max_open_vols;            /* max simultaneous open volumes */
263    
264    uint64_t max_part_size;            /* max part size */
265    uint64_t part_size;                /* current part size */
266    uint32_t part;                     /* current part number (starts at 0) */
267    uint64_t part_start;               /* current part start address (relative to the whole volume) */
268    uint32_t num_dvd_parts;            /* number of parts WRITTEN on the DVD */
269    /* state ST_FREESPACE_OK is set if free_space is valid */
270    uint64_t free_space;               /* current free space on medium (without the current part) */
271    int free_space_errno;              /* indicates errno getting freespace */
272    bool truncating;                   /* if set, we are currently truncating the DVD */
273    bool blank_dvd;                    /* if set, we have a blank DVD in the drive */
274    
275    
276    utime_t  vol_poll_interval;        /* interval between polling Vol mount */
277    DEVRES *device;                    /* pointer to Device Resource */
278    VOLRES *vol;                       /* Pointer to Volume reservation item */
279    btimer_t *tid;                     /* timer id */
280
281    VOLUME_CAT_INFO VolCatInfo;        /* Volume Catalog Information */
282    VOLUME_LABEL VolHdr;               /* Actual volume label */
283    char pool_name[MAX_NAME_LENGTH];   /* pool name */
284    char pool_type[MAX_NAME_LENGTH];   /* pool type */
285
286    /* Device wait times ***FIXME*** look at durations */
287    char BadVolName[MAX_NAME_LENGTH];  /* Last wrong Volume mounted */
288    bool poll;                         /* set to poll Volume */
289    int min_wait;
290    int max_wait;
291    int max_num_wait;
292    int wait_sec;
293    int rem_wait_sec;
294    int num_wait;
295
296    btime_t last_timer;        /* used by read/write/seek to get stats (usec) */
297    btime_t last_tick;         /* contains last read/write time (usec) */
298
299    btime_t  DevReadTime;
300    btime_t  DevWriteTime;
301    uint64_t DevWriteBytes;
302    uint64_t DevReadBytes;
303
304    /* Methods */
305    btime_t get_timer_count();         /* return the last timer interval (ms) */
306
307    int has_cap(int cap) const { return capabilities & cap; }
308    void clear_cap(int cap) { capabilities &= ~cap; }
309    void set_cap(int cap) { capabilities |= cap; }
310    int is_autochanger() const { return capabilities & CAP_AUTOCHANGER; }
311    int requires_mount() const { return capabilities & CAP_REQMOUNT; }
312    int is_removable() const { return capabilities & CAP_REM; }
313    int is_tape() const { return dev_type == B_TAPE_DEV; }
314    int is_file() const { return dev_type == B_FILE_DEV; }
315    int is_fifo() const { return dev_type == B_FIFO_DEV; }
316    int is_dvd() const  { return dev_type == B_DVD_DEV; }
317    int is_prog() const  { return dev_type == B_PROG_DEV; }
318    int is_open() const { return m_fd >= 0; }
319    int is_offline() const { return state & ST_OFFLINE; }
320    int is_labeled() const { return state & ST_LABEL; }
321    int is_mounted() const { return state & ST_MOUNTED; }
322    int is_part_spooled() const { return state & ST_PART_SPOOLED; }
323    int have_media() const { return state & ST_MEDIA; }
324    int is_short_block() const { return state & ST_SHORT; }
325    int is_busy() const { return (state & ST_READ) || num_writers || reserved_device; }
326    int at_eof() const { return state & ST_EOF; }
327    int at_eot() const { return state & ST_EOT; }
328    int at_weot() const { return state & ST_WEOT; }
329    int can_append() const { return state & ST_APPEND; }
330    int is_freespace_ok() const { return state & ST_FREESPACE_OK; }
331    /*
332     * can_write() is meant for checking at the end of a job to see
333     * if we still have a tape (perhaps not if at end of tape
334     * and the job is canceled).
335     */
336    int can_write() const { return is_open() && can_append() &&
337                             is_labeled() && !at_weot(); }
338    int can_read() const   { return state & ST_READ; }
339    bool can_steal_lock() const { return m_blocked &&
340                     (m_blocked == BST_UNMOUNTED ||
341                      m_blocked == BST_WAITING_FOR_SYSOP ||
342                      m_blocked == BST_UNMOUNTED_WAITING_FOR_SYSOP); };
343    bool waiting_for_mount() const { return 
344                     (m_blocked == BST_UNMOUNTED ||
345                      m_blocked == BST_WAITING_FOR_SYSOP ||
346                      m_blocked == BST_UNMOUNTED_WAITING_FOR_SYSOP); };
347    const char *strerror() const;
348    const char *archive_name() const;
349    const char *name() const;
350    const char *print_name() const;    /* Name for display purposes */
351    void set_ateof(); /* in dev.c */
352    void set_ateot(); /* in dev.c */
353    void set_eot() { state |= ST_EOT; };
354    void set_eof() { state |= ST_EOF; };
355    void set_append() { state |= ST_APPEND; };
356    void set_labeled() { state |= ST_LABEL; };
357    inline void set_read() { state |= ST_READ; };
358    void set_offline() { state |= ST_OFFLINE; };
359    void set_mounted() { state |= ST_MOUNTED; };
360    void set_media() { state |= ST_MEDIA; };
361    void set_short_block() { state |= ST_SHORT; };
362    void set_freespace_ok() { state |= ST_FREESPACE_OK; }
363    void set_part_spooled(int val) { if (val) state |= ST_PART_SPOOLED; \
364           else state &= ~ST_PART_SPOOLED;
365    };
366    void set_mounted(int val) { if (val) state |= ST_MOUNTED; \
367           else state &= ~ST_MOUNTED; };
368    void clear_append() { state &= ~ST_APPEND; };
369    void clear_read() { state &= ~ST_READ; };
370    void clear_labeled() { state &= ~ST_LABEL; };
371    void clear_offline() { state &= ~ST_OFFLINE; };
372    void clear_eot() { state &= ~ST_EOT; };
373    void clear_eof() { state &= ~ST_EOF; };
374    void clear_opened() { m_fd = -1; };
375    void clear_mounted() { state &= ~ST_MOUNTED; };
376    void clear_media() { state &= ~ST_MEDIA; };
377    void clear_short_block() { state &= ~ST_SHORT; };
378    void clear_freespace_ok() { state &= ~ST_FREESPACE_OK; };
379    char *bstrerror(void) { return errmsg; };
380    char *print_errmsg() { return errmsg; };
381
382 #ifdef  SD_DEBUG_LOCK
383    void _r_dlock(const char *, int);      /* in device.c */
384    void _r_dunlock(const char *, int);    /* in device.c */
385    void _dlock(const char *, int);        /* in device.c */
386    void _dunlock(const char *, int);      /* in device.c */
387 #else
388    void r_dlock();                        /* in device.c */
389    void r_dunlock();                      /* in device.c */
390    void dlock() { P(m_mutex); } 
391    void dunlock() { V(m_mutex); } 
392 #endif
393
394    void clear_volhdr();          /* in dev.c */
395    void block(int why);          /* in dev.c */
396    void unblock(bool locked=false); /* in dev.c */
397    void close();                 /* in dev.c */
398    void close_part(DCR *dcr);    /* in dev.c */
399    bool truncate(DCR *dcr);      /* in dev.c */
400    int open(DCR *dcr, int mode); /* in dev.c */
401    void term(void);              /* in dev.c */
402    ssize_t read(void *buf, size_t len); /* in dev.c */
403    ssize_t write(const void *buf, size_t len);  /* in dev.c */
404    bool rewind(DCR *dcr);        /* in dev.c */
405    bool mount(int timeout);      /* in dev.c */
406    bool unmount(int timeout);    /* in dev.c */
407    void edit_mount_codes(POOL_MEM &omsg, const char *imsg); /* in dev.c */
408    bool offline_or_rewind();     /* in dev.c */
409    bool offline();               /* in dev.c */
410    bool bsf(int count);          /* in dev.c */
411    bool eod(DCR *dcr);           /* in dev.c */
412    bool fsr(int num);            /* in dev.c */
413    bool fsf(int num);            /* in dev.c */
414    bool bsr(int num);            /* in dev.c */
415    bool weof(int num);           /* in dev.c */
416    void lock_door();             /* in dev.c */
417    void unlock_door();           /* in dev.c */
418    int32_t get_os_tape_file();   /* in dev.c */
419    bool scan_dir_for_volume(DCR *dcr); /* in scan.c */
420    bool reposition(DCR *dcr, uint32_t rfile, uint32_t rblock); /* in dev.c */
421    void clrerror(int func);      /* in dev.c */
422    boffset_t lseek(DCR *dcr, boffset_t offset, int whence); /* in dev.c */
423    bool update_pos(DCR *dcr);    /* in dev.c */
424    bool update_freespace();      /* in dvd.c */
425
426    void set_blocked(int block) { m_blocked = block; };
427    int  blocked() const { return m_blocked; };
428    uint32_t get_file() const { return file; };
429    uint32_t get_block() const { return block_num; };
430    const char *print_blocked() const; /* in dev.c */
431    bool is_blocked() const { return m_blocked != BST_NOT_BLOCKED; };
432    int fd() const { return m_fd; };
433
434 private:
435    bool do_mount(int mount, int timeout);      /* in dev.c */
436    void set_mode(int omode);                   /* in dev.c */
437    void open_tape_device(DCR *dcr, int omode); /* in dev.c */
438    void open_file_device(DCR *dcr, int omode); /* in dev.c */
439    void open_dvd_device(DCR *dcr, int omode);  /* in dev.c */
440 };
441
442 inline const char *DEVICE::strerror() const { return errmsg; }
443 inline const char *DEVICE::archive_name() const { return dev_name; }
444 inline const char *DEVICE::print_name() const { return prt_name; }
445
446 /*
447  * Device Context (or Control) Record.
448  *  There is one of these records for each Job that is using
449  *  the device. Items in this record are "local" to the Job and
450  *  do not affect other Jobs. Note, a job can have multiple
451  *  DCRs open, each pointing to a different device. 
452  */
453 class DCR {
454 public:
455    dlink dev_link;                    /* link to attach to dev */
456    JCR *jcr;                          /* pointer to JCR */
457    DEVICE *dev;                       /* pointer to device */
458    DEVRES *device;                    /* pointer to device resource */
459    DEV_BLOCK *block;                  /* pointer to block */
460    DEV_RECORD *rec;                   /* pointer to record */
461    pthread_t tid;                     /* Thread running this dcr */
462    int spool_fd;                      /* fd if spooling */
463    bool spool_data;                   /* set to spool data */
464    bool spooling;                     /* set when actually spooling */
465    bool despooling;                   /* set when despooling */
466    bool despool_wait;                 /* waiting for despooling */
467    bool dev_locked;                   /* set if dev already locked */
468    bool NewVol;                       /* set if new Volume mounted */
469    bool WroteVol;                     /* set if Volume written */
470    bool NewFile;                      /* set when EOF written */
471    bool reserved_device;              /* set if reserve done */
472    bool any_volume;                   /* Any OK for dir_find_next... */
473    bool attached_to_dev;              /* set when attached to dev */
474    uint32_t VolFirstIndex;            /* First file index this Volume */
475    uint32_t VolLastIndex;             /* Last file index this Volume */
476    uint32_t FileIndex;                /* Current File Index */
477    uint32_t EndFile;                  /* End file written */
478    uint32_t StartFile;                /* Start write file */
479    uint32_t StartBlock;               /* Start write block */
480    uint32_t EndBlock;                 /* Ending block written */
481    int64_t job_spool_size;            /* Current job spool size */
482    int64_t max_job_spool_size;        /* Max job spool size */
483    char VolumeName[MAX_NAME_LENGTH];  /* Volume name */
484    char pool_name[MAX_NAME_LENGTH];   /* pool name */
485    char pool_type[MAX_NAME_LENGTH];   /* pool type */
486    char media_type[MAX_NAME_LENGTH];  /* media type */
487    char dev_name[MAX_NAME_LENGTH];    /* dev name */
488    int Copy;                          /* identical copy number */
489    int Stripe;                        /* RAIT stripe */
490    VOLUME_CAT_INFO VolCatInfo;        /* Catalog info for desired volume */
491 };
492
493 /*
494  * Volume reservation class -- see reserve.c
495  */
496 class VOLRES { 
497 public:
498    dlink link;
499    char *vol_name;
500    DEVICE *dev;
501 };
502
503
504 /* Get some definition of function to position
505  *  to the end of the medium in MTEOM. System
506  *  dependent. Arrgggg!
507  */
508 #ifndef MTEOM
509 #ifdef  MTSEOD
510 #define MTEOM MTSEOD
511 #endif
512 #ifdef MTEOD
513 #undef MTEOM
514 #define MTEOM MTEOD
515 #endif
516 #endif
517
518 #endif