]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/dev.h
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / stored / dev.h
index 0ccee75db501a584b8c786dbbb58cdef0dd35597..7d62347ff8b09a8fb3e39d04905420d08d0df422 100644 (file)
@@ -8,7 +8,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -58,6 +58,15 @@ enum {
    OPEN_WRITE_ONLY
 };
 
+/* Device types */
+enum {
+   B_FILE_DEV = 1,
+   B_TAPE_DEV,
+   B_DVD_DEV,
+   B_FIFO_DEV,
+   B_PROG_DEV
+};
+
 /* Generic status bits returned from status_dev() */
 #define BMT_TAPE           (1<<0)     /* is tape device */
 #define BMT_EOF            (1<<1)     /* just read EOF */
@@ -104,11 +113,12 @@ enum {
 
 /* Device state bits */
 #define ST_XXXXXX          (1<<0)     /* was ST_OPENED */
-#define ST_TAPE            (1<<1)     /* is a tape device */
-#define ST_FILE            (1<<2)     /* is a file device */
-#define ST_FIFO            (1<<3)     /* is a fifo device */
-#define ST_DVD             (1<<4)     /* is a DVD device */  
-#define ST_PROG            (1<<5)     /* is a program device */
+#define ST_XXXXX           (1<<1)     /* was ST_TAPE */
+#define ST_XXXX            (1<<2)     /* was ST_FILE */
+#define ST_XXX             (1<<3)     /* was ST_FIFO */
+#define ST_XX              (1<<4)     /* was ST_DVD */
+#define ST_X               (1<<5)     /* was ST_PROG */
+
 #define ST_LABEL           (1<<6)     /* label found */
 #define ST_MALLOC          (1<<7)     /* dev packet malloc'ed in init_dev() */
 #define ST_APPEND          (1<<8)     /* ready for Bacula append */
@@ -204,6 +214,7 @@ public:
    int dev_errno;                     /* Our own errno */
    int mode;                          /* read/write modes */
    int openmode;                      /* parameter passed to open_dev (useful to reopen the device) */
+   int dev_type;                      /* device type */
    bool autoselect;                   /* Autoselect in autochanger */
    int label_type;                    /* Bacula/ANSI/IBM label types */
    uint32_t drive_index;              /* Autochanger drive index (base 0) */
@@ -259,12 +270,15 @@ public:
    int num_wait;
 
    /* Methods */
+   int has_cap(int cap) const { return capabilities & cap; }
    int is_autochanger() const { return capabilities & CAP_AUTOCHANGER; }
    int requires_mount() const { return capabilities & CAP_REQMOUNT; }
-   int is_tape() const { return state & ST_TAPE; }
-   int is_file() const { return state & ST_FILE; }
-   int is_fifo() const { return state & ST_FIFO; }
-   int is_dvd() const  { return state & ST_DVD; }
+   int is_removable() const { return capabilities & CAP_REM; }
+   int is_tape() const { return dev_type == B_TAPE_DEV; }
+   int is_file() const { return dev_type == B_FILE_DEV; }
+   int is_fifo() const { return dev_type == B_FIFO_DEV; }
+   int is_dvd() const  { return dev_type == B_DVD_DEV; }
+   int is_prog() const  { return dev_type == B_PROG_DEV; }
    int is_open() const { return fd >= 0; }
    int is_offline() const { return state & ST_OFFLINE; }
    int is_labeled() const { return state & ST_LABEL; }