From 88d8a381cd826774be8d1effdaf92e84a5cb75ea Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 19 Nov 2008 19:34:48 +0000 Subject: [PATCH] kes Apply patch from bug #1187. It prints an error message if the Maximum Block Size in the SD is too big. kes Increase Maximum Block Size to 2,000,000 bytes. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8062 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 3 +++ bacula/src/plugins/dir/Makefile | 31 ------------------------------- bacula/src/stored/block.h | 2 +- bacula/src/stored/stored_conf.c | 19 ++++++++++++++++++- bacula/technotes-2.5 | 3 +++ 5 files changed, 25 insertions(+), 33 deletions(-) delete mode 100644 bacula/src/plugins/dir/Makefile diff --git a/bacula/kernstodo b/bacula/kernstodo index fd1b19e53f..d229aa5e2b 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -72,6 +72,9 @@ Professional Needs: Priority: ================ +- Possibly allow manual "purge" to purge a Volume that has not + yet been written (even if FirstWritten time is zero) see ua_purge.c + is_volume_purged(). - Add disk block detection bsr code (make it work). - Remove done bsrs. - Add blast attributes to DIR to SD. diff --git a/bacula/src/plugins/dir/Makefile b/bacula/src/plugins/dir/Makefile deleted file mode 100644 index 1b18a57e8b..0000000000 --- a/bacula/src/plugins/dir/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# Simple Makefile for building test Dir plugins for Bacula -# - -# No optimization for now for easy debugging -CC = g++ -g -O0 -Wall - -DIRDIR=../../dird -SRCDIR=../.. -LIBDIR=../../lib - -.SUFFIXES: .c .o -.c.o: - $(CC) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c $< - -test: main example-plugin-dir.so - -dir_plugins.o: ${DIRDIR}/dir_plugins.h ${DIRDIR}/dir_plugins.c - $(CC) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c ${DIRDIR}/dir_plugins.c - -main: dir_plugins.o - $(CC) -L${LIBDIR} dir_plugins.o -o main -lbac -lpthread -lssl -l crypto -ldl - -example-plugin-dir.o: example-plugin-dir.c ${DIRDIR}/dir_plugins.h - $(CC) -fPIC -I../.. -I${DIRDIR} -c example-plugin-dir.c - -example-plugin-dir.so: example-plugin-dir.o - $(CC) -shared example-plugin-dir.o -o example-plugin-dir.so - -clean: - rm -f main *.so *.o 1 2 3 diff --git a/bacula/src/stored/block.h b/bacula/src/stored/block.h index 132a75114d..137914237b 100644 --- a/bacula/src/stored/block.h +++ b/bacula/src/stored/block.h @@ -38,7 +38,7 @@ #ifndef __BLOCK_H #define __BLOCK_H 1 -#define MAX_BLOCK_LENGTH (1024*1024 + 1) /* this is a sort of sanity check */ +#define MAX_BLOCK_LENGTH 2000000 /* this is a sort of sanity check */ #define DEFAULT_BLOCK_SIZE (512 * 126) /* 64,512 N.B. do not use 65,636 here */ /* Block Header definitions. */ diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index 5e1d84abfa..79153ab836 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -45,6 +45,7 @@ RES **res_head = sres_head; /* Forward referenced subroutines */ static void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass); +static void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass); /* We build the current resource here statically, @@ -152,7 +153,7 @@ static RES_ITEM dev_items[] = { {"volumepollinterval", store_time, ITEM(res_dev.vol_poll_interval), 0, 0, 0}, {"maximumrewindwait", store_time, ITEM(res_dev.max_rewind_wait), 0, ITEM_DEFAULT, 5 * 60}, {"minimumblocksize", store_pint32, ITEM(res_dev.min_block_size), 0, 0, 0}, - {"maximumblocksize", store_pint32, ITEM(res_dev.max_block_size), 0, 0, 0}, + {"maximumblocksize", store_maxblocksize, ITEM(res_dev.max_block_size), 0, 0, 0}, {"maximumvolumesize", store_size, ITEM(res_dev.max_volume_size), 0, 0, 0}, {"maximumfilesize", store_size, ITEM(res_dev.max_file_size), 0, ITEM_DEFAULT, 1000000000}, {"volumecapacity", store_size, ITEM(res_dev.volume_capacity), 0, 0, 0}, @@ -243,6 +244,22 @@ static void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass) set_bit(index, res_all.hdr.item_present); } +/* + * Store Maximum Block Size, and check it is not greater than MAX_BLOCK_LENGTH + * + */ +static void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass) +{ + lex_get_token(lc, T_PINT32); + if (lc->pint32_val <= MAX_BLOCK_LENGTH) { + *(uint32_t *)(item->value) = lc->pint32_val; + scan_to_eol(lc); + set_bit(index, res_all.hdr.item_present); + } else { + scan_err2(lc, _("Maximum Block Size configured value %u is greater than allowed maximum: %u"), lc->pint32_val, MAX_BLOCK_LENGTH ); + } +} + /* Dump contents of resource */ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock) diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index f520f76771..19304dccfd 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -11,6 +11,9 @@ mixed priorities General: 19Nov08 +kes Apply patch from bug #1187. It prints an error message if the + Maximum Block Size in the SD is too big. +kes Increase Maximum Block Size to 2,000,000 bytes. kes Use doubly linked bsr list so that consumed bsrs may be removed. Removing not yet implemented. 18Nov08 -- 2.39.5