aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Csaba Henk <csaba.henk@creo.hu>2006-09-24 14:53:29 +0000
committerGravatar Csaba Henk <csaba.henk@creo.hu>2006-09-24 14:53:29 +0000
commit3e3a125bd5f1d0f216bb78345cea2dc860082fba (patch)
tree7460bcc517020af691ff835812a810cad6fd7bd8 /lib
parenteafdf42a69455f49fc8f935270fec7550bbc4e7c (diff)
Support for nanosec times on FBSD and other FBSD fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/fuse.c21
-rw-r--r--lib/fuse_lowlevel.c14
-rw-r--r--lib/fuse_misc.h16
-rw-r--r--lib/ulockmgr.c1
4 files changed, 35 insertions, 17 deletions
diff --git a/lib/fuse.c b/lib/fuse.c
index 16eb7ad..14789b7 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -702,16 +702,16 @@ static int hide_node(struct fuse *f, fuse_req_t req, const char *oldpath,
static int mtime_eq(const struct stat *stbuf, const struct timespec *ts)
{
return stbuf->st_mtime == ts->tv_sec
-#ifdef HAVE_STRUCT_STAT_ST_ATIM
- && stbuf->st_mtim.tv_nsec == ts->tv_nsec
+#ifdef FUSE_STAT_HAS_NANOSEC
+ && ST_MTIM(stbuf).tv_nsec == ts->tv_nsec
#endif
;
}
static void mtime_set(const struct stat *stbuf, struct timespec *ts)
{
-#ifdef HAVE_STRUCT_STAT_ST_ATIM
- *ts = stbuf->st_mtim;
+#ifdef FUSE_STAT_HAS_NANOSEC
+ *ts = ST_MTIM(stbuf);
#else
ts->tv_sec = stbuf->st_mtime;
#endif
@@ -1027,8 +1027,15 @@ static int do_utimens(struct fuse *f, fuse_req_t req, const char *path,
err = -ENOSYS;
if (f->op.utimens) {
struct timespec tv[2];
- tv[0] = attr->st_atim;
- tv[1] = attr->st_mtim;
+#ifdef FUSE_STAT_HAS_NANOSEC
+ tv[0] = ST_ATIM(attr);
+ tv[1] = ST_MTIM(attr);
+#else
+ tv[0].tv_sec = attr->st_atime;
+ tv[0].tv_nsec = 0;
+ tv[1].tv_sec = attr->st_mtime;
+ tv[1].tv_nsec = 0;
+#endif
fuse_prepare_interrupt(f, req, &d);
err = f->op.utimens(path, tv);
fuse_finish_interrupt(f, req, &d);
@@ -2973,7 +2980,7 @@ static int fuse_compat_opendir(struct fuse *f, fuse_req_t req, char *path,
return fuse_do_opendir(f, req, path, fi);
}
-static int fuse_do_statfs(struct fuse *f, fuse_req_t req, struct statvfs *buf)
+static int fuse_compat_statfs(struct fuse *f, fuse_req_t req, struct statvfs *buf)
{
return fuse_do_statfs(f, req, "/", buf);
}
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 27a3d20..f014e6e 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -72,10 +72,10 @@ static void convert_stat(const struct stat *stbuf, struct fuse_attr *attr)
attr->atime = stbuf->st_atime;
attr->mtime = stbuf->st_mtime;
attr->ctime = stbuf->st_ctime;
-#ifdef HAVE_STRUCT_STAT_ST_ATIM
- attr->atimensec = stbuf->st_atim.tv_nsec;
- attr->mtimensec = stbuf->st_mtim.tv_nsec;
- attr->ctimensec = stbuf->st_ctim.tv_nsec;
+#ifdef FUSE_STAT_HAS_NANOSEC
+ attr->atimensec = ST_ATIM(stbuf).tv_nsec;
+ attr->mtimensec = ST_MTIM(stbuf).tv_nsec;
+ attr->ctimensec = ST_CTIM(stbuf).tv_nsec;
#endif
}
@@ -87,9 +87,9 @@ static void convert_attr(const struct fuse_setattr_in *attr, struct stat *stbuf)
stbuf->st_size = attr->size;
stbuf->st_atime = attr->atime;
stbuf->st_mtime = attr->mtime;
-#ifdef HAVE_STRUCT_STAT_ST_ATIM
- stbuf->st_atim.tv_nsec = attr->atimensec;
- stbuf->st_mtim.tv_nsec = attr->mtimensec;
+#ifdef FUSE_STAT_HAS_NANOSEC
+ ST_ATIM(stbuf).tv_nsec = attr->atimensec;
+ ST_MTIM(stbuf).tv_nsec = attr->mtimensec;
#endif
}
diff --git a/lib/fuse_misc.h b/lib/fuse_misc.h
index 3a02655..57a1e37 100644
--- a/lib/fuse_misc.h
+++ b/lib/fuse_misc.h
@@ -22,6 +22,16 @@ static inline void fuse_mutex_init(pthread_mutex_t *mut)
}
#endif
-
-
-
+#ifdef HAVE_STRUCT_STAT_ST_ATIM
+/* Linux */
+#define ST_ATIM(stbuf) (stbuf)->st_atim
+#define ST_CTIM(stbuf) (stbuf)->st_ctim
+#define ST_MTIM(stbuf) (stbuf)->st_mtim
+#define FUSE_STAT_HAS_NANOSEC 1
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
+/* FreeBSD */
+#define ST_ATIM(stbuf) (stbuf)->st_atimespec
+#define ST_CTIM(stbuf) (stbuf)->st_ctimespec
+#define ST_MTIM(stbuf) (stbuf)->st_mtimespec
+#define FUSE_STAT_HAS_NANOSEC 1
+#endif
diff --git a/lib/ulockmgr.c b/lib/ulockmgr.c
index 795fc41..012a450 100644
--- a/lib/ulockmgr.c
+++ b/lib/ulockmgr.c
@@ -16,6 +16,7 @@
#include <pthread.h>
#include <errno.h>
#include <assert.h>
+#include <signal.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/wait.h>