[Reproducible-commits] [disorderfs] 01/08: Propagate locks to underlying filesystem

Andrew Ayer agwa at andrewayer.name
Wed Sep 23 16:27:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

agwa-guest pushed a commit to branch debian
in repository disorderfs.

commit 8c3572b9fb82d5aa346f5a94128ccecbbb29fa3c
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Wed Sep 23 09:13:50 2015 -0700

    Propagate locks to underlying filesystem
---
 Makefile       |  2 +-
 disorderfs.cpp | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index fda0dfe..41c1067 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ HAS_A2X ?= $(shell command -v a2x >/dev/null && echo yes || echo no)
 
 # FUSE
 FUSE_CFLAGS ?= $(shell pkg-config --cflags fuse) -DFUSE_USE_VERSION=26
-FUSE_LIBS ?= $(shell pkg-config --libs fuse)
+FUSE_LIBS ?= $(shell pkg-config --libs fuse) -lulockmgr
 
 # CXXFLAGS
 CXXFLAGS += -std=c++11 -Wno-unused-parameter
diff --git a/disorderfs.cpp b/disorderfs.cpp
index f5d1ce3..cd27f05 100644
--- a/disorderfs.cpp
+++ b/disorderfs.cpp
@@ -23,6 +23,9 @@
 #include <string>
 #include <fstream>
 #include <fuse.h>
+extern "C" {
+#include <ulockmgr.h>
+}
 #include <dirent.h>
 #include <iostream>
 #include <memory>
@@ -36,6 +39,7 @@
 #include <attr/xattr.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
+#include <sys/file.h>
 #include <stddef.h>
 
 #define DISORDERFS_VERSION "0.3.0"
@@ -387,12 +391,12 @@ int	main (int argc, char** argv)
 		st->st_blocks += config.pad_blocks;
 		return 0;
 	};
-	/* TODO: locking
-	disorderfs_fuse_operations.loc = [] (const char *, struct fuse_file_info *, int cmd, struct flock *) -> int {
+	disorderfs_fuse_operations.lock = [] (const char* path, struct fuse_file_info* info, int cmd, struct flock* lock) -> int {
+		return ulockmgr_op(info->fh, cmd, lock, &info->lock_owner, sizeof(info->lock_owner));
 	};
-	disorderfs_fuse_operations.flock = [] (const char *, struct fuse_file_info *, int op) -> int {
+	disorderfs_fuse_operations.flock = [] (const char* path, struct fuse_file_info* info, int op) -> int {
+		return wrap(flock(info->fh, op));
 	};
-	*/
 	disorderfs_fuse_operations.utimens = [] (const char* path, const struct timespec tv[2]) -> int {
 		Guard g;
 		return wrap(utimensat(AT_FDCWD, (root + path).c_str(), tv, AT_SYMLINK_NOFOLLOW));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/disorderfs.git



More information about the Reproducible-commits mailing list