Minor package changes

This commit is contained in:
Andrea Mazzoleni 2011-03-06 22:52:50 +01:00
parent 4bd4f9dd79
commit 0e67d6c925
13 changed files with 115 additions and 39 deletions

View file

@ -1,9 +1,8 @@
AUTHORS
=======
SnapRAID AUTHORS
================
The author of snapraid is Andrea Mazzoleni.
The author of SnapRAID is Andrea Mazzoleni.
You can contact me sending an email at:
amadvance@users.sourceforge.net

View file

@ -1,5 +1,8 @@
SNAPRAID VERSION 0.1 2011/02
================================
SnapRAID HISTORY
================
* First release of snapraid
0.1 2011/3
==========
* First public release of SnapRAID.

10
INSTALL
View file

@ -1,5 +1,5 @@
INSTALL
=======
SnapRAID INSTALL
================
As root or user type:
@ -11,3 +11,9 @@ type:
make install
then change the example configuration file snapraid.conf to fit
your needs and copy it in /etc/snapraid.conf.
The documentation is in the man page:
man snapraid

View file

@ -5,11 +5,23 @@ snapraid_SOURCES = \
snapraid.c \
getopt.c \
md5.c \
tommy.c
tommy.c \
util.c \
elem.c \
state.c \
scan.c \
sync.c \
check.c \
parity.c \
handle.c
noinst_HEADERS = \
portable.h \
util.h \
elem.h \
state.h \
parity.h \
handle.h \
md5.h \
tommyarray.h \
tommychain.h \
@ -17,7 +29,6 @@ noinst_HEADERS = \
tommyhashdyn.h \
tommylist.h \
tommytypes.h \
util.h \
tommyarray.c \
tommyhash.c \
tommyhashdyn.c \
@ -30,6 +41,7 @@ EXTRA_DIST = \
autogen.sh \
noautomake.sh \
README AUTHORS HISTORY INSTALL COPYING \
snapraid.d snapraid.1 snapraid.txt snapraid.html \
test.conf \
acinclude.m4
@ -37,7 +49,11 @@ clean-local:
rm -f valgrind.log callgrind.log
rm -rf test
CHECK = ./snapraid -v -c test.conf sync
maintainer-clean-local:
rm -f README AUTHORS HISTORY INSTALL
rm -f snapraid.1 snapraid.txt snapraid.html
CHECK = ./snapraid -v -c test.conf fix
check-local:
rm -rf test
@ -45,14 +61,29 @@ check-local:
mkdir test/disk1
mkdir test/disk2
mkdir test/disk3
echo Create some files, sync and check
./testgen 1 3 2000
./snapraid -v -c $(srcdir)/test.conf sync
./snapraid -v -c $(srcdir)/test.conf check
./snapraid -c $(srcdir)/test.conf sync
./snapraid -c $(srcdir)/test.conf check
echo Create some more files, sync and check
./testgen 2 3 2000
./snapraid -v -c $(srcdir)/test.conf sync
./snapraid -v -c $(srcdir)/test.conf check
./snapraid -c $(srcdir)/test.conf sync
./snapraid -c $(srcdir)/test.conf check
echo Delete some files, fix and check
rm test/disk1/a*
./snapraid -v -c $(srcdir)/test.conf check
./snapraid -c $(srcdir)/test.conf check 2>/dev/null
./snapraid -c $(srcdir)/test.conf fix 2>/dev/null
./snapraid -c $(srcdir)/test.conf check
echo Delete the parity, fix and check
rm test/parity
./snapraid -c $(srcdir)/test.conf check 2>/dev/null
./snapraid -c $(srcdir)/test.conf fix 2>/dev/null
./snapraid -c $(srcdir)/test.conf check
echo Corrupt the parity, fix and check
dd if=/dev/zero of=test/parity bs=1024 count=1000 seek=1000 conv=notrunc
./snapraid -c $(srcdir)/test.conf check 2>/dev/null
./snapraid -c $(srcdir)/test.conf fix 2>/dev/null
./snapraid -c $(srcdir)/test.conf check
echo Success!
valgrind:
@ -81,3 +112,32 @@ cachegrind:
2> cachegrind.log
tail cachegrind.log
# Rules for documentation
%.1 : %.d
advd2 man < $(srcdir)/$< > $@
%.txt : %.d
advd2 txt < $(srcdir)/$< | todos > $@
%.html : %.d
advd2 html < $(srcdir)/$< > $@
%.hh : %.d
advd2 frame < $(srcdir)/$< > $@
# Windows distribution
DISTWIN = \
snapraid.txt \
snapraid.html \
snapraid.exe \
snapraid.rc
distwindows: $(DISTWIN)
rm -f $(PACKAGE)-$(VERSION)-windows-x86.zip
mkdir tmp
cp $(DISTWIN) tmp
cd tmp && zip -r ../$(PACKAGE)-$(VERSION)-windows-x86.zip *
rm -r tmp

7
README
View file

@ -1,5 +1,10 @@
SNAPRAID
SnapRAID
========
SnapRAID is a backup program for a disk array using redundancy.
Just like a RAID system but based on snapshots.
The official site of SnapRAID is:
http://snapraid.sourceforge.net

View file

@ -101,12 +101,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
#define HAVE_UTIME_NULL 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
@ -126,7 +120,7 @@
#define PACKAGE_TARNAME "snapraid"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
#define PACKAGE_URL "http://snapraid.sourceforge.net"
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.1"

View file

@ -1,10 +1,10 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([snapraid], [0.1])
AC_PREREQ([2.65])
AC_INIT([snapraid], [0.1], [], [], [http://snapraid.sourceforge.net])
AM_INIT_AUTOMAKE([foreign no-dependencies])
AC_CONFIG_SRCDIR([snapraid.c])
AC_CONFIG_HEADER([config.h])
AC_CANONICAL_HOST
AC_COPYRIGHT([Copyright 2011 Andrea Mazzoleni])
dnl Checks for programs.
AC_PROG_CC
@ -16,8 +16,7 @@ dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_FUNC_UTIME_NULL
AC_CHECK_HEADERS([unistd.h getopt.h stdint.h])
AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h getopt.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@ -25,10 +24,18 @@ AC_C_INLINE
AC_C_RESTRICT
AC_C_VOLATILE
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
dnl Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset strchr strerror strrchr])
AC_CHECK_FUNCS([getopt getopt_long snprintf vsnprintf])
AC_CHECK_FUNCS([fsync fallocate])
AC_CHECK_FUNCS([ftruncate fsync posix_fallocate posix_fadvise pread pwrite])
dnl Configure for 64 bit files
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"

1
elem.c
View file

@ -116,3 +116,4 @@ void disk_free(struct snapraid_disk* disk)
tommy_array_done(&disk->blockarr);
free(disk);
}

6
elem.h
View file

@ -39,9 +39,9 @@
/**
* Basic position type.
* With a 32 bit and 128k block you can address 256 TB.
* With 32 bits and 128k blocks you can address 256 TB.
*/
typedef unsigned pos_t;
typedef uint32_t pos_t;
struct snapraid_file;
@ -62,7 +62,7 @@ struct snapraid_file {
char sub[PATH_MAX]; /**< Sub path of the file. Without the disk dir. The disk is implicit. */
uint64_t size; /**< Size of the file. */
struct snapraid_block* blockvec; /**< All the blocks of the file. */
unsigned blockmax; /**< Number of blocks. */
pos_t blockmax; /**< Number of blocks. */
time_t mtime; /**< Modification time. */
int is_present; /**< If it's seen as present. */

View file

@ -25,16 +25,16 @@
/* main */
void version(void) {
printf(PACKAGE " v" VERSION " by Andrea Mazzoleni\n");
printf(PACKAGE " v" VERSION " by Andrea Mazzoleni, " PACKAGE_URL "\n");
}
void usage(void) {
version();
printf("Usage: snapraid [options]\n");
printf("Usage: " PACKAGE " [options]\n");
printf("\n");
printf("Options:\n");
printf(" " SWITCH_GETOPT_LONG("-c, --conf FILE ", "-c") " Configuration file (default /etc/snapraid.conf)\n");
printf(" " SWITCH_GETOPT_LONG("-c, --conf FILE ", "-c") " Configuration file (default /etc/" PACKAGE ".conf)\n");
printf(" " SWITCH_GETOPT_LONG("-s, --start BLK ", "-s") " Start from the specified block number\n");
printf(" " SWITCH_GETOPT_LONG("-f, --force ", "-f") " Force dangerous operations\n");
printf(" " SWITCH_GETOPT_LONG("-v, --verbose ", "-v") " Verbose\n");
@ -82,7 +82,7 @@ int main(int argc, char* argv[])
pos_t blockstart;
/* defaults */
conf = "/etc/snapraid.conf";
conf = "/etc/" PACKAGE ".conf";
verbose = 0;
force = 0;
blockstart = 0;

View file

@ -487,4 +487,3 @@ int state_progress(time_t* start, time_t* last, pos_t blockpos, pos_t blockmax,
return 0;
}

View file

@ -69,3 +69,4 @@ void state_check(struct snapraid_state* state, int fix, pos_t blockstart);
int state_progress(time_t* start, time_t* last, pos_t blockpos, pos_t blockmax, uint64_t count_block, uint64_t count_size);
#endif

1
sync.c
View file

@ -162,3 +162,4 @@ void state_sync(struct snapraid_state* state, pos_t blockstart)
parity_close(path, f);
}