From 9115735709c570347236bccbe34ddc8fe6e6e8dc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 29 Mar 2004 18:23:21 +0000 Subject: some cleanups git-svn-id: file:///home/lennart/svn/public/fusedav/trunk@4 e35a362c-bbd6-0310-a59f-a4efcb1729c4 --- src/Makefile | 9 +++------ src/fusedav.c | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/Makefile b/src/Makefile index bea2a08..e0dca3b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,16 +1,13 @@ CC=gcc -CFLAGS=-g -Wall -pipe -O0 -I/usr/include/neon +CFLAGS=-g -Wall -pipe -O0 -I/usr/include/neon -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -ansi LIBS=/usr/lib/libfuse.a -lpthread -lneon -all: fusexmp fusedav - -fusexmp: fusexmp.o - $(CC) -o $@ $^ $(LIBS) +all: fusedav fusedav: fusedav.o statcache.o filecache.o session.o openssl-thread.o $(CC) -o $@ $^ $(LIBS) clean: - rm -f *.o fusexmp fusedav + rm -f *.o fusedav .PHONY: clean all diff --git a/src/fusedav.c b/src/fusedav.c index 17f1001..355feae 100644 --- a/src/fusedav.c +++ b/src/fusedav.c @@ -111,7 +111,9 @@ static void fill_stat(struct stat* st, const ne_prop_result_set *results, int is st->st_mtime = glm ? ne_rfc1123_parse(glm) : 0; st->st_ctime = cd ? ne_iso8601_parse(cd) : 0; - //fprintf(stderr, "a: %u; m: %u; c: %u\n", st->st_atime, st->st_mtime, st->st_ctime); + + st->st_blocks = (st->st_size+511)/512; + /*fprintf(stderr, "a: %u; m: %u; c: %u\n", st->st_atime, st->st_mtime, st->st_ctime);*/ st->st_mode &= ~mask; @@ -612,7 +614,7 @@ static void usage(char *argv0) { } static void exit_handler(int s) { - static const char m[] = "Signal caught\n"; + static const char m[] = "*** Caught signal ***\n"; write(2, m, strlen(m)); if(fuse != NULL) fuse_exit(fuse); @@ -648,6 +650,8 @@ int main(int argc, char *argv[]) { char *u=NULL, *p = NULL; int fuse_fd = -1; int ret = 1; + char mountpoint[PATH_MAX]; + static const char *mount_args[] = { "-n", NULL, "-l", "-c", NULL }; if (ne_sock_init()) { fprintf(stderr, "Failed to initialize libneon.\n"); @@ -696,7 +700,17 @@ int main(int argc, char *argv[]) { goto finish; } - if ((fuse_fd = fuse_mount(argv[optind+1], NULL)) < 0) { + if (argv[optind+1][0] == '/') + snprintf(mountpoint, sizeof(mountpoint), "%s", argv[optind+1]); + else { + char *pwd = get_current_dir_name(); + snprintf(mountpoint, sizeof(mountpoint), "%s/%s", pwd, argv[optind+1]); + free(pwd); + } + + mount_args[1] = argv[optind]; + + if ((fuse_fd = fuse_mount(mountpoint, mount_args)) < 0) { fprintf(stderr, "Failed to mount FUSE file system.\n"); goto finish; } @@ -716,7 +730,7 @@ finish: fuse_destroy(fuse); if (fuse_fd >= 0) - fuse_unmount(argv[optind]); + fuse_unmount(mountpoint); file_cache_close_all(); cache_free(); -- cgit