From 7c64ee26f98df0d508f109e006f49e0d94cd1807 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 12 Mar 2011 10:23:42 +0100 Subject: [PATCH] Adds missing / in mount point specification Adds example configuration file --- Makefile.am | 3 +++ elem.c | 13 +++++++++++++ snapraid.conf.example | 27 +++++++++++++++++++++++++++ snapraid.d | 7 +------ snapraid.html | 13 ++----------- snapraid.txt | 9 ++------- test.conf | 6 +++--- 7 files changed, 51 insertions(+), 27 deletions(-) create mode 100644 snapraid.conf.example diff --git a/Makefile.am b/Makefile.am index 15e43f83..919e8c88 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,8 +42,11 @@ EXTRA_DIST = \ README AUTHORS HISTORY INSTALL COPYING \ snapraid.d snapraid.1 snapraid.txt snapraid.html \ test.conf \ + snapraid.conf.example \ acinclude.m4 +man_MANS = snapraid.1 + clean-local: rm -f valgrind.log callgrind.log rm -rf test diff --git a/elem.c b/elem.c index 8d442ee9..9ba9106e 100644 --- a/elem.c +++ b/elem.c @@ -96,6 +96,19 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir) disk = malloc_nofail(sizeof(struct snapraid_disk)); snprintf(disk->name, sizeof(disk->name), "%s", name); snprintf(disk->dir, sizeof(disk->dir), "%s", dir); + + /* ensure that the dir terminate with "/" if it isn't empty */ + if (disk->dir[0] != 0) { + char last = disk->dir[strlen(disk->dir) - 1]; + if (last != '/' +#ifdef _WIN32 + && last != '\\' +#endif + ) { + snprintf(disk->dir, sizeof(disk->dir), "%s/", dir); + } + } + disk->first_free_block = 0; tommy_list_init(&disk->filelist); tommy_hashdyn_init(&disk->fileset); diff --git a/snapraid.conf.example b/snapraid.conf.example new file mode 100644 index 00000000..34941a13 --- /dev/null +++ b/snapraid.conf.example @@ -0,0 +1,27 @@ +# Configuration for snapraid + +# Define the block size in kilo bytes (1024 bytes). +# Format: "block_size SIZE_IN_KB" +# Default value is 128 -> 128 kilo bytes +block_size 128 + +# Define the file to use as parity storage +# It must me in an different disk than the data disk +# Format: "parity FILE_PATH" +parity /mnt/dp/parity + +# Define the file to use as content list +# Format: "content FILE_PATH" +# It must me in an different disk than the data disk +# It can be in the same disk used for parity storage +content /mnt/dp/content + +# Define to data disk to use +# Format: "disk DISK_NAME DISK_MOUNT_POINT" +disk d1 /mnt/d1/ +disk d2 /mnt/d2/ +disk d3 /mnt/d3/ +disk d4 /mnt/d4/ +disk d5 /mnt/d5/ +disk d6 /mnt/d6/ + diff --git a/snapraid.d b/snapraid.d index 1b8b57f6..074f2aa4 100644 --- a/snapraid.d +++ b/snapraid.d @@ -196,12 +196,7 @@ Options For example, it happens if all the files in a disk are missing. - -e, --exclude PATTERN - This option define an exclusion pattern to be applyed at - the files with the "sync" command. It has no effect with - other commands. - - -v, --verboe + -v, --verbose Prints more information in the processing. -h, --help diff --git a/snapraid.html b/snapraid.html index ebf2e095..2cf18a95 100644 --- a/snapraid.html +++ b/snapraid.html @@ -53,7 +53,7 @@ You can stop using SnapRAID at any time.

3 -Misfeatures +Limitations

SnapRAID is in between a RAID and a backup program trying to get the best benefits of them. Altough it also has some downsides that you should @@ -310,16 +310,7 @@ missing. -
--e, --exclude PATTERN -
-This option define an exclusion pattern to be applyed at -the files with the "sync" command. It has no effect with -other commands. -
- - diff --git a/snapraid.txt b/snapraid.txt index 41875ef0..4b8520c2 100644 --- a/snapraid.txt +++ b/snapraid.txt @@ -40,7 +40,7 @@ The main features of SnapRAID are: You can stop using SnapRAID at any time. -3 MISFEATURES +3 LIMITATIONS ============= SnapRAID is in between a RAID and a backup program trying to get the best @@ -218,12 +218,7 @@ SnapRAID provides three simple commands that allow to: For example, it happens if all the files in a disk are missing. - -e, --exclude PATTERN - This option define an exclusion pattern to be applyed at - the files with the "sync" command. It has no effect with - other commands. - - -v, --verboe + -v, --verbose Prints more information in the processing. -h, --help diff --git a/test.conf b/test.conf index 8c02358f..ea41a1c7 100644 --- a/test.conf +++ b/test.conf @@ -1,7 +1,7 @@ block_size 1 parity test/parity content test/content -disk d1 test/disk1/ -disk d2 test/disk2/ -disk d3 test/disk3/ +disk d1 test/disk1 +disk d2 test/disk2 +disk d3 test/disk3
--v, --verboe +-v, --verbose
Prints more information in the processing.