From: Kern Sibbald Date: Sat, 8 Mar 2008 13:02:03 +0000 (+0000) Subject: kes Start implementation of VTL code X-Git-Tag: Release-3.0.0~1734 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=52d9cb8c025f69523bb2a1a77684705a27d9e784;p=bacula%2Fbacula kes Start implementation of VTL code kes Fix Win32 build after adding new cats subroutine git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6556 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 49c8624028..e54b08ed67 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -82,6 +82,12 @@ void InitWinAPIWrapper(); #define OSDependentInit() InitWinAPIWrapper() +#define tape_open win32_tape_open +#define tape_ioctl win32_tape_ioctl +#define tape_read win32_tape_read +#define tape_write win32_tape_write +#define tape_close win32_tape_close + #define sbrk(x) 0 @@ -106,8 +112,8 @@ void InitWinAPIWrapper(); #define CATS_IMP_EXP #define OSDependentInit() -#define tape_open open -#define tape_ioctl ioctl +#define tape_open ::open +#define tape_ioctl ::ioctl #define tape_read ::read #define tape_write ::write #define tape_close ::close diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index 030bb3adff..b2c772e515 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -843,7 +843,7 @@ bool DEVICE::eod(DCR *dcr) block_num = file = 0; file_size = 0; file_addr = 0; - if (is_fifo() || is_prog()) { + if (is_fifo()) { return true; } if (!is_tape()) { @@ -1845,6 +1845,7 @@ void DEVICE::close() } switch (dev_type) { + case B_VTL_DEV: case B_TAPE_DEV: unlock_door(); tape_close(m_fd); @@ -1921,6 +1922,7 @@ bool DEVICE::truncate(DCR *dcr) /* We need the DCR for DVD-writing */ Dmsg1(100, "truncate %s\n", print_name()); switch (dev_type) { + case B_VTL_DEV: case B_TAPE_DEV: /* maybe we should rewind and write and eof ???? */ return true; /* we don't really truncate tapes */ diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index b5ea0c63ef..656044e323 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -64,7 +64,7 @@ enum { B_TAPE_DEV, B_DVD_DEV, B_FIFO_DEV, - B_PROG_DEV + B_VTL_DEV }; /* Generic status bits returned from status_dev() */ @@ -277,7 +277,7 @@ public: 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_vtl() const { return dev_type == B_VTL_DEV; } int is_open() const { return m_fd >= 0; } int is_offline() const { return state & ST_OFFLINE; } int is_labeled() const { return state & ST_LABEL; } diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index 8f79c44ffc..877c4a51d8 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -212,6 +212,7 @@ static s_kw dev_types[] = { {"tape", B_TAPE_DEV}, {"dvd", B_DVD_DEV}, {"fifo", B_FIFO_DEV}, + {"vtl", B_VTL_DEV}, {NULL, 0} }; diff --git a/bacula/src/version.h b/bacula/src/version.h index e2a9135356..8e2bdbd01d 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.12" -#define BDATE "06 March 2008" -#define LSMDATE "06Mar08" +#define BDATE "08 March 2008" +#define LSMDATE "08Mar08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/src/win32/cats/bacula_cats.def b/bacula/src/win32/cats/bacula_cats.def index e4144a729c..704facdb48 100644 --- a/bacula/src/win32/cats/bacula_cats.def +++ b/bacula/src/win32/cats/bacula_cats.def @@ -47,6 +47,7 @@ _Z18db_find_last_jobidP3JCRP4B_DBPKcP7JOB_DBR _Z19db_find_next_volumeP3JCRP4B_DBibP9MEDIA_DBR _Z22db_find_job_start_timeP3JCRP4B_DBP7JOB_DBRPPc _Z24db_find_failed_job_sinceP3JCRP4B_DBP7JOB_DBRPcRi +_Z27db_find_last_job_start_timeP3JCRP4B_DBP7JOB_DBRPPci ; sql_get.o _Z15db_get_pool_idsP3JCRP4B_DBPiPPj diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 7489caf117..5414c0f821 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -233,11 +233,11 @@ int chmod(const char *, mode_t mode); #define F_GETFL 3 #define F_SETFL 4 -int tape_open(const char *file, int flags, int mode = 0); -int tape_read(int fd, void *buffer, unsigned int count); -int tape_write(int fd, const void *buffer, unsigned int count); -int tape_ioctl(int fd, unsigned long int request, ...); -int tape_close(int fd); +int win32_tape_open(const char *file, int flags, int mode = 0); +int win32_tape_read(int fd, void *buffer, unsigned int count); +int win32_tape_write(int fd, const void *buffer, unsigned int count); +int win32_tape_ioctl(int fd, unsigned long int request, ...); +int win32_tape_close(int fd); #define open _open diff --git a/bacula/src/win32/stored/mtops.cpp b/bacula/src/win32/stored/mtops.cpp index 5b36846b56..5275aa8d14 100644 --- a/bacula/src/win32/stored/mtops.cpp +++ b/bacula/src/win32/stored/mtops.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2006-2007 Free Software Foundation Europe e.V. + Copyright (C) 2006-2008 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. @@ -173,15 +173,15 @@ TAPE_HANDLE_INFO TapeHandleTable[] = #define NUMBER_HANDLE_ENTRIES (sizeof(TapeHandleTable) / sizeof(TapeHandleTable[0])) -DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo); -DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize); +static DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo); +static DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize); -int tape_get(int fd, struct mtget *mt_get); -int tape_op(int fd, struct mtop *mt_com); -int tape_pos(int fd, struct mtpos *mt_pos); +static int tape_get(int fd, struct mtget *mt_get); +static int tape_op(int fd, struct mtop *mt_com); +static int tape_pos(int fd, struct mtpos *mt_pos); int -tape_open(const char *file, int flags, int mode) +win32_tape_open(const char *file, int flags, int mode) { HANDLE hDevice = INVALID_HANDLE_VALUE; char szDeviceName[256] = "\\\\.\\"; @@ -275,7 +275,7 @@ tape_open(const char *file, int flags, int mode) } int -tape_read(int fd, void *buffer, unsigned int count) +win32_tape_read(int fd, void *buffer, unsigned int count) { if (buffer == NULL) { errno = EINVAL; @@ -347,7 +347,7 @@ tape_read(int fd, void *buffer, unsigned int count) } int -tape_write(int fd, const void *buffer, unsigned int count) +win32_tape_write(int fd, const void *buffer, unsigned int count) { if (buffer == NULL) { errno = EINVAL; @@ -405,7 +405,7 @@ tape_write(int fd, const void *buffer, unsigned int count) } int -tape_close(int fd) +win32_tape_close(int fd) { if (fd < 3 || fd >= (int)(NUMBER_HANDLE_ENTRIES + 3) || TapeHandleTable[fd - 3].OSHandle == INVALID_HANDLE_VALUE) { @@ -427,7 +427,7 @@ tape_close(int fd) } int -tape_ioctl(int fd, unsigned long int request, ...) +win32_tape_ioctl(int fd, unsigned long int request, ...) { va_list argp; int result; @@ -458,7 +458,7 @@ tape_ioctl(int fd, unsigned long int request, ...) return result; } -int tape_op(int fd, struct mtop *mt_com) +static int tape_op(int fd, struct mtop *mt_com) { DWORD result = NO_ERROR; int index; @@ -797,7 +797,7 @@ int tape_op(int fd, struct mtop *mt_com) return result == NO_ERROR ? 0 : -1; } -int tape_get(int fd, struct mtget *mt_get) +static int tape_get(int fd, struct mtget *mt_get) { TAPE_POSITION_INFO pos_info; BOOL result; @@ -955,7 +955,7 @@ typedef union _READ_POSITION_RESULT { SCSI_READ_POSITION_EXTENDED_BUFFER ExtendedBuffer; } READ_POSITION_RESULT, *PREAD_POSITION_RESULT; -DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo) +static DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo) { PSCSI_PASS_THROUGH ScsiPassThrough; BOOL bResult; @@ -1059,7 +1059,7 @@ DWORD GetTapePositionInfo(HANDLE hDevice, PTAPE_POSITION_INFO TapePositionInfo) return NO_ERROR; } -DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize) +static DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize) { DWORD dwBufferSize = sizeof(GET_MEDIA_TYPES) + 5 * sizeof(DEVICE_MEDIA_INFO); GET_MEDIA_TYPES * pGetMediaTypes = (GET_MEDIA_TYPES *)malloc(dwBufferSize); @@ -1132,7 +1132,7 @@ DWORD GetDensityBlockSize(HANDLE hDevice, DWORD *pdwDensity, DWORD *pdwBlockSize return ERROR_NO_MEDIA_IN_DRIVE; } -int tape_pos(int fd, struct mtpos *mt_pos) +static int tape_pos(int fd, struct mtpos *mt_pos) { DWORD partition; DWORD offset; diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 321d127d59..c60a9802a5 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,9 @@ Technical notes on version 2.3 General: +08Mar08 +kes Start implementation of VTL code +kes Fix Win32 build after adding new cats subroutine. 06Mar08 kes First cut at Duplicate Job implementation. 05Mar08