]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/vtape.h
Fix bat seg fault
[bacula/bacula] / bacula / src / stored / vtape.h
index 90cb00acd4c3a553927326460f6bc3dcb240cffd..057ecdaf9d2a710e7ba5aaca68da78a4c39ea5b8 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2008-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
 #include <stddef.h>
 #include "bacula.h"
 
-/* 
- * Theses functions will replace open/read/write
- */
-int vtape_open(const char *pathname, int flags, ...);
-int vtape_close(int fd);
-int vtape_ioctl(int fd, ioctl_req_t request, ...);
 void vtape_debug(int level);
-ssize_t vtape_read(int fd, void *buffer, size_t count);
-ssize_t vtape_write(int fd, const void *buffer, size_t count);
 
 #ifdef USE_VTAPE
 
@@ -59,7 +51,7 @@ typedef enum {
    VT_SKIP_EOF                  /* Have already read the EOF byte */
 } VT_READ_FM_MODE;
 
-class vtape {
+class vtape: public DEVICE {
 private:
    int         fd;              /* Our file descriptor */
 
@@ -97,13 +89,18 @@ public:
 
    vtape();
    ~vtape();
-
    int get_fd();
    void dump();
-   int open(const char *pathname, int flags);
-   ssize_t read(void *buffer, size_t count);
-   ssize_t write(const void *buffer, size_t count);
-   int close();
+
+   /* interface from DEVICE */
+   int d_close(int);
+   int d_open(const char *pathname, int flags);
+   int d_ioctl(int fd, ioctl_req_t request, char *mt=NULL);
+   ssize_t d_read(int, void *buffer, size_t count);
+   ssize_t d_write(int, const void *buffer, size_t count);
+
+   boffset_t lseek(DCR *dcr, off_t offset, int whence) { return -1; }
+   boffset_t lseek(int fd, off_t offset, int whence);
 
    int tape_op(struct mtop *mt_com);
    int tape_get(struct mtget *mt_com);
@@ -111,6 +108,18 @@ public:
 };
 
 
-#endif  /*!USE_VTAPE */
+#else  /*!USE_VTAPE */
+
+class vtape: public DEVICE {
+public:
+   int d_open(const char *pathname, int flags) { return -1; }
+   ssize_t d_read(void *buffer, size_t count) { return -1; }
+   ssize_t d_write(const void *buffer, size_t count) { return -1; }
+   int d_close(int) { return -1; }
+   int d_ioctl(int fd, ioctl_req_t request, char *mt=NULL) { return -1; }
+   boffset_t lseek(DCR *dcr, off_t offset, int whence) { return -1; }
+};
+
+#endif  /* USE_VTAPE */
 
 #endif /* !VTAPE_H */