From: Eric Bollengier Date: Sun, 11 May 2008 19:18:43 +0000 (+0000) Subject: ebl get a patch for faketape + bacula 2.2 X-Git-Tag: Release-7.0.0~4595 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=563784c92f48acc15785a809c275d57f37f9901a;p=bacula%2Fbacula ebl get a patch for faketape + bacula 2.2 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6954 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/testing/2.2.10-faketape.patch b/bacula/patches/testing/2.2.10-faketape.patch new file mode 100644 index 0000000000..d95832a278 --- /dev/null +++ b/bacula/patches/testing/2.2.10-faketape.patch @@ -0,0 +1,162 @@ +Index: src/baconfig.h +=================================================================== +--- src/baconfig.h (révision 6953) ++++ src/baconfig.h (copie de travail) +@@ -38,6 +38,7 @@ + + /* Bacula common configuration defines */ + ++#define USE_FAKETAPE 1 + #undef TRUE + #undef FALSE + #define TRUE 1 +@@ -106,11 +107,21 @@ + #define CATS_IMP_EXP + + #define OSDependentInit() +-#define tape_open open +-#define tape_ioctl ioctl +-#define tape_read ::read +-#define tape_write ::write +-#define tape_close ::close ++#if defined(USE_FAKETAPE) ++# define tape_open faketape_open ++# define tape_ioctl faketape_ioctl ++# define tape_read faketape_read ++# define tape_write faketape_write ++# define tape_close faketape_close ++# define IS_TAPE(x) S_ISREG(x) ++#else /* UNIX && !FAKETAPE */ ++# define tape_open ::open ++# define tape_ioctl ::ioctl ++# define tape_read ::read ++# define tape_write ::write ++# define tape_close ::close ++# define IS_TAPE(x) S_ISCHR(x) ++#endif + + #endif + +Index: src/stored/Makefile.in +=================================================================== +--- src/stored/Makefile.in (révision 6953) ++++ src/stored/Makefile.in (copie de travail) +@@ -20,7 +20,7 @@ + dummy: + + # bacula-sd +-SDOBJS = stored.o ansi_label.o \ ++SDOBJS = stored.o ansi_label.o faketape.o \ + autochanger.o acquire.o append.o \ + askdir.o authenticate.o \ + block.o butil.o dev.o \ +@@ -31,7 +31,7 @@ + spool.o status.o stored_conf.o wait.o + + # btape +-TAPEOBJS = btape.o block.o butil.o dev.o device.o label.o \ ++TAPEOBJS = btape.o block.o butil.o dev.o device.o label.o faketape.o \ + lock.o ansi_label.o dvd.o ebcdic.o \ + autochanger.o acquire.o mount.o record.o read_record.o \ + reserve.o \ +@@ -39,26 +39,26 @@ + + # bls + BLSOBJS = bls.o block.o butil.o device.o dev.o label.o match_bsr.o \ +- ansi_label.o dvd.o ebcdic.o lock.o \ ++ ansi_label.o dvd.o ebcdic.o lock.o faketape.o \ + autochanger.o acquire.o mount.o parse_bsr.o record.o \ + read_record.o reserve.o scan.o stored_conf.o spool.o wait.o + + # bextract + BEXTOBJS = bextract.o block.o device.o dev.o label.o record.o \ +- ansi_label.o dvd.o ebcdic.o lock.o \ ++ ansi_label.o dvd.o ebcdic.o lock.o faketape.o \ + autochanger.o acquire.o mount.o match_bsr.o parse_bsr.o butil.o \ + pythonsd.o read_record.o reserve.o \ + scan.o stored_conf.o spool.o wait.o + + # bscan + SCNOBJS = bscan.o block.o device.o dev.o label.o \ +- ansi_label.o dvd.o ebcdic.o lock.o \ ++ ansi_label.o dvd.o ebcdic.o lock.o faketape.o \ + autochanger.o acquire.o mount.o record.o match_bsr.o parse_bsr.o \ + butil.o read_record.o scan.o reserve.o stored_conf.o spool.o wait.o + + # bcopy + COPYOBJS = bcopy.o block.o device.o dev.o label.o \ +- ansi_label.o dvd.o ebcdic.o lock.o \ ++ ansi_label.o dvd.o ebcdic.o lock.o faketape.o \ + autochanger.o acquire.o mount.o record.o match_bsr.o parse_bsr.o \ + butil.o read_record.o reserve.o \ + scan.o stored_conf.o spool.o wait.o +Index: src/stored/stored.h +=================================================================== +--- src/stored/stored.h (révision 6953) ++++ src/stored/stored.h (copie de travail) +@@ -78,6 +78,10 @@ + int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); + #endif + ++#ifdef USE_FAKETAPE ++# include "faketape.h" ++#endif ++ + /* Daemon globals from stored.c */ + extern STORES *me; /* "Global" daemon resource */ + extern bool forge_on; /* proceed inspite of I/O errors */ +Index: src/stored/dev.c +=================================================================== +--- src/stored/dev.c (révision 6953) ++++ src/stored/dev.c (copie de travail) +@@ -123,7 +123,7 @@ + } + if (S_ISDIR(statp.st_mode)) { + device->dev_type = B_FILE_DEV; +- } else if (S_ISCHR(statp.st_mode)) { ++ } else if (IS_TAPE(statp.st_mode)) { /* char device or fake tape */ + device->dev_type = B_TAPE_DEV; + } else if (S_ISFIFO(statp.st_mode)) { + device->dev_type = B_FIFO_DEV; +@@ -379,7 +379,7 @@ + /* If busy retry each second for max_open_wait seconds */ + for ( ;; ) { + /* Try non-blocking open */ +- m_fd = ::open(dev_name, mode+O_NONBLOCK); ++ m_fd = tape_open(dev_name, mode+O_NONBLOCK); + if (m_fd < 0) { + berrno be; + dev_errno = errno; +@@ -391,10 +391,10 @@ + mt_com.mt_op = MTREW; + mt_com.mt_count = 1; + /* rewind only if dev is a tape */ +- if (is_tape() && (ioctl(m_fd, MTIOCTOP, (char *)&mt_com) < 0)) { ++ if (is_tape() && (tape_ioctl(m_fd, MTIOCTOP, (char *)&mt_com) < 0)) { + berrno be; + dev_errno = errno; /* set error status from rewind */ +- ::close(m_fd); ++ tape_close(m_fd); + clear_opened(); + Dmsg2(100, "Rewind error on %s close: ERR=%s\n", print_name(), + be.bstrerror(dev_errno)); +@@ -404,8 +404,8 @@ + } + } else { + /* Got fd and rewind worked, so we must have medium in drive */ +- ::close(m_fd); +- m_fd = ::open(dev_name, mode); /* open normally */ ++ tape_close(m_fd); ++ m_fd = tape_open(dev_name, mode); /* open normally */ + if (m_fd < 0) { + berrno be; + dev_errno = errno; +@@ -2490,7 +2490,7 @@ + } else { + neof = 1; + } +- if (ioctl(dev->fd(), MTIOCSETEOTMODEL, (caddr_t)&neof) < 0) { ++ if (tape_ioctl(dev->fd(), MTIOCSETEOTMODEL, (caddr_t)&neof) < 0) { + berrno be; + dev->dev_errno = errno; /* save errno */ + Mmsg2(dev->errmsg, _("Unable to set eotmodel on device %s: ERR=%s\n"),