diff -Nru mhddfs-0.1.28/.bzr-builddeb/default.conf mhddfs-0.1.38/.bzr-builddeb/default.conf --- mhddfs-0.1.28/.bzr-builddeb/default.conf 1970-01-01 00:00:00.000000000 +0000 +++ mhddfs-0.1.38/.bzr-builddeb/default.conf 2011-11-18 13:36:23.000000000 +0000 @@ -0,0 +1,2 @@ +[BUILDDEB] +native = True diff -Nru mhddfs-0.1.28/ChangeLog mhddfs-0.1.38/ChangeLog --- mhddfs-0.1.28/ChangeLog 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/ChangeLog 2011-11-18 13:36:23.000000000 +0000 @@ -76,3 +76,12 @@ 0.1.27 * Fixed renaming directory bug, thanks for Nathan Grennan + +0.1.31 +* Fixed statvfs if a few shares are placed onto one device. + +0.1.32 +* Added startup check to remove duplicaties of mount directories. + +0.1.33 +* Symlinks are processed properly (set date/time). diff -Nru mhddfs-0.1.28/debian/bzr-builder.manifest mhddfs-0.1.38/debian/bzr-builder.manifest --- mhddfs-0.1.28/debian/bzr-builder.manifest 1970-01-01 00:00:00.000000000 +0000 +++ mhddfs-0.1.38/debian/bzr-builder.manifest 2011-11-18 13:36:23.000000000 +0000 @@ -0,0 +1,2 @@ +# bzr-builder format 0.3 deb-version {debupstream}-0~20 +lp:ubuntu/oneiric/mhddfs revid:james.westby@ubuntu.com-20110504122301-l6vg4a76xmumtr4o diff -Nru mhddfs-0.1.28/debian/changelog mhddfs-0.1.38/debian/changelog --- mhddfs-0.1.28/debian/changelog 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/debian/changelog 2011-11-18 13:36:23.000000000 +0000 @@ -1,3 +1,80 @@ +mhddfs (0.1.38-0~20~lucid1) unstable; urgency=low + + * Auto build. + + -- Sergey Davidoff Fri, 18 Nov 2011 13:36:23 +0000 + +mhddfs (0.1.38) unstable; urgency=low + + * Apply hardlinks patch, big thanks for patch to + Dermot Duffy . + + -- Dmitry E. Oboukhov Wed, 04 May 2011 12:23:01 +0400 + +mhddfs (0.1.37) unstable; urgency=low + + * Old default mlimit is used. + * mlimit=100% is a reasonable request. + + -- Dmitry E. Oboukhov Tue, 13 Jul 2010 17:05:40 +0400 + +mhddfs (0.1.36) experimental; urgency=low + + * Since now mhddfs uses 'mlimit' option in percent, + thanks for Robert de Bath , closes: #588892. + + -- Dmitry E. Oboukhov Tue, 13 Jul 2010 15:18:37 +0400 + +mhddfs (0.1.35) unstable; urgency=low + + * Debian/kfreebsd architectures are built using WITHOUT_XATTR=1 build flag, + fixes a few build warnings. + + -- Dmitry E. Oboukhov Tue, 15 Jun 2010 09:44:23 +0400 + +mhddfs (0.1.34) unstable; urgency=low + + * Fixed dependencies on freebsd. + + -- Dmitry E. Oboukhov Thu, 03 Jun 2010 21:51:48 +0400 + +mhddfs (0.1.33) unstable; urgency=low + + * Symlinks are processed properly (set date/time), closes: #575847, + thanks for Jools Wills for bugreport. + + -- Dmitry E. Oboukhov Tue, 01 Jun 2010 16:31:20 +0400 + +mhddfs (0.1.32) unstable; urgency=low + + * Switch to dpkg-source 3.0 (native) format. + * Added startup check to remove duplicaties of mount directories, + closes: #582888. + * Debian is upstream linux variant, so we will use debian native + package format. + + -- Dmitry E. Oboukhov Tue, 01 Jun 2010 15:09:37 +0400 + +mhddfs (0.1.31-1) unstable; urgency=low + + * Fixed statvfs if a few shares are placed onto one device, closes: #580785. + * Added libattr1-dev in B-D, fixed FTBFS, closes: #565037. + * Closes unreproducible bugreport (a few months passed), closes: #512649. + + -- Dmitry E. Oboukhov Tue, 01 Jun 2010 12:07:00 +0400 + +mhddfs (0.1.30-1) UNRELEASE; urgency=low + + * Another BSD build problem. + + -- Dmitry E. Oboukhov Mon, 11 Jan 2010 23:07:30 +0300 + +mhddfs (0.1.29-1) UNRELEASE; urgency=low + + * Building under FreeBSD is fixed. + + -- Dmitry E. Oboukhov Mon, 11 Jan 2010 11:49:17 +0300 + mhddfs (0.1.28-1) unstable; urgency=high * Fixed creating parent directories when item is moved between shares. diff -Nru mhddfs-0.1.28/debian/control mhddfs-0.1.38/debian/control --- mhddfs-0.1.28/debian/control 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/debian/control 2011-11-18 13:36:23.000000000 +0000 @@ -2,14 +2,15 @@ Section: utils Priority: extra Maintainer: Dmitry E. Oboukhov -Build-Depends: debhelper (>= 5), libfuse-dev, pkg-config -Standards-Version: 3.8.2 +Build-Depends: debhelper (>= 5), libfuse-dev, pkg-config, libattr1-dev +Standards-Version: 3.8.4 Homepage: http://mhddfs.uvw.ru Vcs-Browser: http://svn.uvw.ru/mhddfs/trunk Package: mhddfs Architecture: any -Depends: ${shlibs:Depends}, fuse-utils +Depends: ${shlibs:Depends}, ${misc:Depends}, + fuse-utils [!kfreebsd-amd64 !kfreebsd-i386] Description: file system for unifying several mount points into one This FUSE-based file system allows mount points (or directories) to be combined, simulating a single big volume which can merge several hard diff -Nru mhddfs-0.1.28/debian/rules mhddfs-0.1.38/debian/rules --- mhddfs-0.1.28/debian/rules 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/debian/rules 2011-11-18 13:36:23.000000000 +0000 @@ -4,11 +4,21 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +MHDDFS_BUILDFLAGS = + +FREEBSD_FLAGS = $(shell \ + if `dpkg-architecture -qDEB_BUILD_ARCH|grep -q 'kfreebsd'`; then \ + echo WITHOUT_XATTR=1; \ + fi \ +) + +MHDDFS_BUILDFLAGS += $(FREEBSD_FLAGS) + build: build-stamp build-stamp: dh_testdir - make + make $(MHDDFS_BUILDFLAGS) touch $@ clean: diff -Nru mhddfs-0.1.28/debian/source/format mhddfs-0.1.38/debian/source/format --- mhddfs-0.1.28/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ mhddfs-0.1.38/debian/source/format 2011-11-18 13:48:39.000000000 +0000 @@ -0,0 +1 @@ +3.0 (native) diff -Nru mhddfs-0.1.28/debian/watch mhddfs-0.1.38/debian/watch --- mhddfs-0.1.28/debian/watch 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/debian/watch 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -version=3 -http://mhdd.uvw.ru/downloads/ mhddfs_(\d+(?:\.\d+){2,3}).tar.gz diff -Nru mhddfs-0.1.28/Makefile mhddfs-0.1.38/Makefile --- mhddfs-0.1.28/Makefile 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/Makefile 2011-11-18 13:36:23.000000000 +0000 @@ -22,7 +22,12 @@ TARGET = mhddfs -CFLAGS = -Wall $(shell pkg-config fuse --cflags) -DFUSE_USE_VERSION=26 -MMD +CFLAGS = -Wall $(shell pkg-config fuse --cflags) \ + -DFUSE_USE_VERSION=26 -MMD +ifdef WITHOUT_XATTR +CFLAGS += -DWITHOUT_XATTR +endif + LDFLAGS = $(shell pkg-config fuse --libs) FORTAR = src COPYING LICENSE README Makefile \ @@ -32,11 +37,34 @@ VERSION = $(shell cat src/version.h \ |grep '^.define'|grep '[[:space:]]VERSION[[:space:]]' \ |awk '{print $$3}'|sed 's/\"//g' ) + +DEBVERSION = $(shell \ + head -n 1 debian/changelog \ + | awk '{print $$2}' \ + | sed 's/^.//' | sed 's/.$$//' \ + | sed 's/-[[:digit:]]\+$$//' \ +) + RELEASE = 0 SRCDIR = $(shell rpm --eval '%_sourcedir') + +ifeq ($(DEBVERSION), $(VERSION)) all: $(TARGET) +else +all: update_version $(TARGET) +endif + +update_version: + @echo Updating upstream version from $(VERSION) to $(DEBVERSION)... + @sleep 5 + perl -pi -e 's/^(#define\s+VERSION\s+).*/$$1 "$(DEBVERSION)"/' \ + src/version.h + +help: + @echo usage: make - to build program + @echo make WITHOUT_XATTR=1 - to build program without xattr functional tarball: mhddfs_$(VERSION).tar.gz @echo '>>>> mhddfs_$(VERSION).tar.gz created' @@ -136,6 +164,11 @@ -./$@ rm -f $@ +symlinks_test: $(TARGET) + bash tests/utimes.sh + + + test-images: test1.img test2.img rename-test: $(TARGET) @@ -158,7 +191,8 @@ .PHONY: all clean open_project tarball \ release_svn_thread test-mount test-umount \ - images-mount test tests rename-test + images-mount test tests rename-test \ + help update_version include $(wildcard obj/*.d) diff -Nru mhddfs-0.1.28/README mhddfs-0.1.38/README --- mhddfs-0.1.28/README 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/README 2011-11-18 13:36:23.000000000 +0000 @@ -25,11 +25,16 @@ less than the threshold specified then a drive containing most free space will be choosen. -Default value is 4G, minimum value is 100M. +Default value is 25%, minimum value is 100M. This option accepts suffixes: [mM] - megabytes [gG] - gigabytes [kK] - kilobytes +[%] - percent + +If mlimit is equal 100% or contain a number which is more than the +largest of mount directories, mhddfs will try to allocate files +regularly. For an information about the additional options see output of 'mhddfs -h'. @@ -108,13 +113,6 @@ Most of the functions are supported. -Some are not (and it seems will not be supported): -- hardlinks (no reason use a hard links in a file system working - on a many nodes) - -Not implemented yet: -- extended file attributes (xattr). - Functions are supported: - get/set attributes of file system objects; - get/set file system information (total size, size of @@ -124,6 +122,9 @@ - symbolic links; - device files, sockets and fifo; - file locks; +- hardlinks (only on a single device; no moving support for + hardlinked files) +- extended file attributes (xattr); Install ~~~~~~~ diff -Nru mhddfs-0.1.28/README.ru.UTF-8 mhddfs-0.1.38/README.ru.UTF-8 --- mhddfs-0.1.28/README.ru.UTF-8 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/README.ru.UTF-8 2011-11-18 13:36:23.000000000 +0000 @@ -106,12 +106,6 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Поддерживается большинство функций. -Не поддерживается (и видимо не будет поддерживаться): - * жесткие ссылки (hardlinks) - в файловой системе работающей на многих узлах жесткие - ссылки не имеют смысла. -Пока не реализованы: - * Расширенные атрибуты файлов (xattr). Поддерживаются функции: * Получение/установка атрибутов об объектах файловой системы; @@ -122,7 +116,10 @@ * Чтение/удаление/создание/запись файлов; * Символьные ссылки (symlinks); * Файлы устройств, сокеты и fifo; - * Блокировки файлов. + * Блокировки файлов; + * частичная поддержка жёстких ссылок: работает создание, не работает + перемещение файлов на другой диск если ссылок больше одной; + * Расширенные атрибуты файлов (xattr); Установка ~~~~~~~~~ diff -Nru mhddfs-0.1.28/src/main.c mhddfs-0.1.38/src/main.c --- mhddfs-0.1.28/src/main.c 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/src/main.c 2011-11-18 13:36:23.000000000 +0000 @@ -19,6 +19,7 @@ (added support for extended attributes.) */ #define _XOPEN_SOURCE 500 +#define _BSD_SOURCE 1 #include #include #include @@ -31,7 +32,10 @@ #include #include #include + +#ifndef WITHOUT_XATTR #include +#endif #include "parse_options.h" #include "tools.h" @@ -56,19 +60,31 @@ //statvfs static int mhdd_statfs(const char *path, struct statvfs *buf) { - int i; + int i, j; struct statvfs * stats; + struct stat st; + dev_t * devices; mhdd_debug(MHDD_MSG, "mhdd_statfs: %s\n", path); stats = calloc(mhdd.cdirs, sizeof(struct statvfs)); + devices = calloc(mhdd.cdirs, sizeof(dev_t)); for (i = 0; i < mhdd.cdirs; i++) { int ret = statvfs(mhdd.dirs[i], stats+i); if (ret != 0) { free(stats); + free(devices); return -errno; } + + ret = stat(mhdd.dirs[i], &st); + if (ret != 0) { + free(stats); + free(devices); + return -errno; + } + devices[i] = st.st_dev; } unsigned long @@ -100,6 +116,21 @@ memcpy(buf, stats, sizeof(struct statvfs)); for (i = 1; if_namemaxf_namemax = stats[i].f_namemax; } @@ -110,8 +141,9 @@ buf->f_bfree += stats[i].f_bfree; buf->f_blocks += stats[i].f_blocks; } - free(stats); + free(stats); + free(devices); return 0; } @@ -672,7 +704,7 @@ tv[1].tv_sec = ts[1].tv_sec; tv[1].tv_usec = ts[1].tv_nsec / 1000; - res = utimes(object, tv); + res = lutimes(object, tv); free(object); if (res == -1) return -errno; @@ -777,6 +809,35 @@ return -errno; } +// link +static int mhdd_link(const char *from, const char *to) +{ + mhdd_debug(MHDD_MSG, "mhdd_link: from = %s to = %s\n", from, to); + + int dir_id = find_path_id(from); + + if (dir_id == -1) { + errno = ENOENT; + return -errno; + } + + int res = create_parent_dirs(dir_id, to); + if (res != 0) { + return res; + } + + char *path_from = create_path(mhdd.dirs[dir_id], from); + char *path_to = create_path(mhdd.dirs[dir_id], to); + + res = link(path_from, path_to); + free(path_from); + free(path_to); + + if (res == 0) + return 0; + return -errno; +} + // mknod static int mhdd_mknod(const char *path, mode_t mode, dev_t rdev) { @@ -833,7 +894,7 @@ return -errno; } -#if _POSIX_SYNCHRONIZED_IO + 0 > 0 +#if _POSIX_SYNCHRONIZED_IO + 0 > 0 || defined(__FreeBSD__) #undef HAVE_FDATASYNC #else #define HAVE_FDATASYNC 1 @@ -869,6 +930,8 @@ } // Define extended attribute support + +#ifndef WITHOUT_XATTR static int mhdd_setxattr(const char *path, const char *attrname, const char *attrval, size_t attrvalsize, int flags) { @@ -884,7 +947,9 @@ if (res == -1) return -errno; return 0; } +#endif +#ifndef WITHOUT_XATTR static int mhdd_getxattr(const char *path, const char *attrname, char *buf, size_t count) { int size = 0; @@ -900,7 +965,9 @@ if (size == -1) return -errno; return size; } +#endif +#ifndef WITHOUT_XATTR static int mhdd_listxattr(const char *path, char *buf, size_t count) { int ret = 0; @@ -917,7 +984,9 @@ if (ret == -1) return -errno; return ret; } +#endif +#ifndef WITHOUT_XATTR static int mhdd_removexattr(const char *path, const char *attrname) { char * real_path = find_path(path); @@ -933,35 +1002,39 @@ if (res == -1) return -errno; return 0; } +#endif // functions links static struct fuse_operations mhdd_oper = { - .getattr = mhdd_stat, - .statfs = mhdd_statfs, - .readdir = mhdd_readdir, - .readlink = mhdd_readlink, - .open = mhdd_fileopen, - .release = mhdd_release, - .read = mhdd_read, - .write = mhdd_write, - .create = mhdd_create, - .truncate = mhdd_truncate, - .ftruncate = mhdd_ftruncate, - .access = mhdd_access, - .mkdir = mhdd_mkdir, - .rmdir = mhdd_rmdir, - .unlink = mhdd_unlink, - .rename = mhdd_rename, - .utimens = mhdd_utimens, - .chmod = mhdd_chmod, - .chown = mhdd_chown, - .symlink = mhdd_symlink, - .mknod = mhdd_mknod, - .fsync = mhdd_fsync, - .setxattr = mhdd_setxattr, - .getxattr = mhdd_getxattr, - .listxattr = mhdd_listxattr, - .removexattr= mhdd_removexattr, + .getattr = mhdd_stat, + .statfs = mhdd_statfs, + .readdir = mhdd_readdir, + .readlink = mhdd_readlink, + .open = mhdd_fileopen, + .release = mhdd_release, + .read = mhdd_read, + .write = mhdd_write, + .create = mhdd_create, + .truncate = mhdd_truncate, + .ftruncate = mhdd_ftruncate, + .access = mhdd_access, + .mkdir = mhdd_mkdir, + .rmdir = mhdd_rmdir, + .unlink = mhdd_unlink, + .rename = mhdd_rename, + .utimens = mhdd_utimens, + .chmod = mhdd_chmod, + .chown = mhdd_chown, + .symlink = mhdd_symlink, + .mknod = mhdd_mknod, + .fsync = mhdd_fsync, + .link = mhdd_link, +#ifndef WITHOUT_XATTR + .setxattr = mhdd_setxattr, + .getxattr = mhdd_getxattr, + .listxattr = mhdd_listxattr, + .removexattr = mhdd_removexattr, +#endif }; diff -Nru mhddfs-0.1.28/src/parse_options.c mhddfs-0.1.38/src/parse_options.c --- mhddfs-0.1.28/src/parse_options.c 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/src/parse_options.c 2011-11-18 13:36:23.000000000 +0000 @@ -46,6 +46,11 @@ #define FUSE_MP_OPT_STR "-ofsname=mhddfs#" #endif +/* the number less (or equal) than 100 is in percent, + more than 100 is in bytes */ +#define DEFAULT_MLIMIT ( 4l * 1024 * 1024 * 1024 ) +#define MINIMUM_MLIMIT ( 50l * 1024 * 1024 ) + static struct fuse_opt mhddfs_opts[]={ MHDDFS_OPT("mlimit=%s", mlimit_str, 0), MHDDFS_OPT("logfile=%s", debug_file, 0), @@ -57,7 +62,6 @@ FUSE_OPT_END }; - static void add_mhdd_dirs(const char * dir) { int i; @@ -123,6 +127,51 @@ return 1; } +static void check_if_unique_mountpoints(void) +{ + int i, j; + struct stat * stats = calloc(mhdd.cdirs, sizeof(struct stat)); + + for (i = 0; i < mhdd.cdirs; i++) { + if (stat(mhdd.dirs[i], stats + i) != 0) + memset(stats + i, 0, sizeof(struct stat)); + + + for (j = 0; j < i; j++) { + if (strcmp(mhdd.dirs[i], mhdd.dirs[j]) != 0) { + /* mountdir isn't unique */ + if (stats[j].st_dev != stats[i].st_dev) + continue; + if (stats[j].st_ino != stats[i].st_ino) + continue; + if (!stats[i].st_dev) + continue; + if (!stats[i].st_ino) + continue; + } + + fprintf(stderr, + "mhddfs: Duplicate directories: %s %s\n" + "\t%s was excluded from dirlist\n", + mhdd.dirs[i], + mhdd.dirs[j], + mhdd.dirs[i] + ); + + free(mhdd.dirs[i]); + mhdd.dirs[i] = 0; + + for (j = i; j < mhdd.cdirs - 1; j++) + mhdd.dirs[j] = mhdd.dirs[j+1]; + mhdd.cdirs--; + i--; + break; + } + } + + free(stats); +} + struct fuse_args * parse_options(int argc, char *argv[]) { struct fuse_args * args=calloc(1, sizeof(struct fuse_args)); @@ -142,6 +191,8 @@ mhdd.mount=mhdd.dirs[--mhdd.cdirs]; mhdd.dirs[mhdd.cdirs]=0; + check_if_unique_mountpoints(); + for (i=l=0; i 100) + mhdd.move_limit = MINIMUM_MLIMIT; + } + } } - fprintf(stderr, "mhddfs: move size limit %lld bytes\n", - (long long)mhdd.move_limit); + if (mhdd.move_limit <= 100) + fprintf(stderr, "mhddfs: move size limit %lld%%\n", + (long long)mhdd.move_limit); + else + fprintf(stderr, "mhddfs: move size limit %lld bytes\n", + (long long)mhdd.move_limit); mhdd_debug(MHDD_MSG, " >>>>> mhdd " VERSION " started <<<<<\n"); diff -Nru mhddfs-0.1.28/src/test/stat.pl mhddfs-0.1.38/src/test/stat.pl --- mhddfs-0.1.28/src/test/stat.pl 1970-01-01 00:00:00.000000000 +0000 +++ mhddfs-0.1.38/src/test/stat.pl 2011-11-18 13:36:23.000000000 +0000 @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use utf8; +use open qw(:std :utf8); + +for (@ARGV) { + my ( + $dev, $ino, $mode, $nlink, + $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, + $blocks + ) = stat $_; + + print "\n$_\n"; + unless (defined $dev) { + print "$!\n"; + last; + } + printf < #include #include + +#ifndef WITHOUT_XATTR #include +#endif #include "tools.h" #include "debug.h" @@ -40,31 +43,59 @@ // get diridx for maximum free space int get_free_dir(void) { - int i, max; + int i, max, max_perc, max_perc_space = 0; struct statvfs stf; - fsblkcnt_t max_space=0; + fsblkcnt_t max_space = 0; - for (max=i=0; i=mhdd.move_limit) return i; + if (mhdd.move_limit <= 100) { - if(space>max_space) - { - max_space=space; - max=i; + int perc; + + if (mhdd.move_limit != 100) { + fsblkcnt_t perclimit = stf.f_blocks; + + if (mhdd.move_limit != 99) { + perclimit *= mhdd.move_limit + 1; + perclimit /= 100; + } + + if (stf.f_bavail >= perclimit) + return i; + } + + perc = 100 * stf.f_bavail / stf.f_blocks; + + if (perc > max_perc_space) { + max_perc_space = perc; + max_perc = i; + } + } else { + if (space >= mhdd.move_limit) + return i; + } + + if(space > max_space) { + max_space = space; + max = i; } } - if (!max_space) - { + + if (!max_space && !max_perc_space) { mhdd_debug(MHDD_INFO, "get_free_dir: Can't find freespace\n"); return -1; } + + if (max_perc_space) + return max_perc; return max; } @@ -202,6 +233,17 @@ from, strerror(errno)); return -errno; } + + /* Hard link support is limited to a single device, and files with + >1 hardlinks cannot be moved between devices since this would + (a) result in partial files on the source device (b) not free + the space from the source device during unlink. */ + if (st.st_nlink > 1) { + mhdd_debug(MHDD_MSG, "move_file: cannot move " + "files with >1 hardlinks\n"); + return -ENOTSUP; + } + size = st.st_size; if (size < wsize) size=wsize; @@ -262,11 +304,13 @@ ftime.modtime = st.st_mtime; utime(to, &ftime); +#ifndef WITHOUT_XATTR // extended attributes if (copy_xattrs(from, to) == -1) mhdd_debug(MHDD_MSG, "copy_xattrs: error copying xattrs from %s to %s\n", from, to); +#endif from = strdup(from); @@ -282,6 +326,7 @@ return ret; } +#ifndef WITHOUT_XATTR int copy_xattrs(const char *from, const char *to) { int listsize=0, attrvalsize=0; @@ -350,6 +395,7 @@ free(listbuf); return 0; } +#endif char * create_path(const char *dir, const char * file) { @@ -465,11 +511,13 @@ strerror(errno)); } +#ifndef WITHOUT_XATTR // copy extended attributes of parent dir if (copy_xattrs(exists, path_parent) == -1) mhdd_debug(MHDD_MSG, "copy_xattrs: error copying xattrs from %s to %s\n", exists, path_parent); +#endif free(exists); free(path_parent); diff -Nru mhddfs-0.1.28/src/version.h mhddfs-0.1.38/src/version.h --- mhddfs-0.1.28/src/version.h 2009-12-18 20:01:40.000000000 +0000 +++ mhddfs-0.1.38/src/version.h 2011-11-18 13:36:23.000000000 +0000 @@ -19,6 +19,6 @@ #ifndef __MHDDFS__VERSION__H__ #define __MHDDFS__VERSION__H__ -#define VERSION "0.1.28" +#define VERSION "0.1.38" #endif diff -Nru mhddfs-0.1.28/tests/access.pl mhddfs-0.1.38/tests/access.pl --- mhddfs-0.1.28/tests/access.pl 1970-01-01 00:00:00.000000000 +0000 +++ mhddfs-0.1.38/tests/access.pl 2011-11-18 13:36:23.000000000 +0000 @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use utf8; +use open qw(:std :utf8); + +use POSIX; +use Encode qw(decode); + +unless (@ARGV) { + print "Usage $0 object1 object2\n"; +} + + +for (@ARGV) { + $_ = decode(utf8 => $_) unless utf8::is_utf8($_); + print "Test $_ R_OK..."; + if (POSIX::access($_, &POSIX::R_OK)) { + print " ok\n"; + } else { + print " fail\n"; + } + + print "Test $_ W_OK..."; + if (POSIX::access($_, &POSIX::W_OK)) { + print " ok\n"; + } else { + print " fail\n"; + } + + print "Test $_ X_OK..."; + if (POSIX::access($_, &POSIX::X_OK)) { + print " ok\n"; + } else { + print " fail\n"; + } + + print "\n"; +} diff -Nru mhddfs-0.1.28/tests/statvfs.pl mhddfs-0.1.38/tests/statvfs.pl --- mhddfs-0.1.28/tests/statvfs.pl 1970-01-01 00:00:00.000000000 +0000 +++ mhddfs-0.1.38/tests/statvfs.pl 2011-11-18 13:36:23.000000000 +0000 @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use utf8; +use open qw(:std :utf8); + +use Getopt::Std qw(getopts); +use Filesys::Statvfs; + + +sub usage() +{ + print <) { + my @f = split /\s+/, $_; + next unless @f > 3; + next unless $f[1] eq 'on'; + push @paths, $f[2]; + } +} + +for (@paths) { + my @stat = statvfs $_; + + my @hi = ( + 'File system block size', + 'Fragment size', + 'Size of fs in "Fragment size" units', + 'Free blocks', + 'Free blocks for unprivileged users', + 'Inodes', + 'Free inodes', + 'Free inodes for unprivileged users', + 'Mount flags', + 'Maximum filename length' + ); + + printf "%s\n\t%s\n\n", $_, + join "\n\t", map { sprintf "%40s: %s", $hi[$_], $stat[$_] } 0 .. $#stat; +} + diff -Nru mhddfs-0.1.28/tests/utimes.sh mhddfs-0.1.38/tests/utimes.sh --- mhddfs-0.1.28/tests/utimes.sh 1970-01-01 00:00:00.000000000 +0000 +++ mhddfs-0.1.38/tests/utimes.sh 2011-11-18 13:36:23.000000000 +0000 @@ -0,0 +1,40 @@ +#!/bin/bash + +dir1=`mktemp -d` +dir2=`mktemp -d` +mnt=`mktemp -d` +log=`mktemp` + +ret=0 + +cleantemp() { + rm -fr $dir1 $dir2 $mnt $log +} + +mkdir -p $dir1/1/{2,3,4}/{5,6,7} +cwd=`pwd` +cd $dir1/1 +find -type d -exec ln -s '{}' '{}link' ';' +cd $cwd + +sleep 1 + +./mhddfs $dir1 $dir2 $mnt + +rsync -a $mnt/1 $mnt/2 2> $log + +logrsync=`cat $log` + +fusermount -u $mnt + + +if test -z "$logrsync"; then + echo "**************** PASSED ******************" + cleantemp + exit 0 +else + echo "FAILED:" + cat $log + cleantemp + exit -1 +fi