Inserted conditions on fuse patches to avoid constraints on older kernels

N2009_11_14_FIXES
jpandre 2009-07-30 13:11:50 +00:00
parent 8db3f0a2ab
commit b725b77e88
6 changed files with 54 additions and 6 deletions

View File

@ -442,8 +442,10 @@ struct fuse_context {
/** Private filesystem data */
void *private_data;
#ifdef POSIXACLS
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
#endif
};
/* ----------------------------------------------------------- *

View File

@ -23,7 +23,11 @@
#define FUSE_MAJOR_VERSION 2
/** Minor version of FUSE library interface */
#ifdef POSIXACLS
#define FUSE_MINOR_VERSION 8
#else
#define FUSE_MINOR_VERSION 7
#endif
#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
@ -32,11 +36,12 @@
extern "C" {
#endif
#ifdef POSIXACLS
/*
* FUSE_CAP_DONT_MASK: don't apply umask to file mode on create operations
*/
#define FUSE_CAP_DONT_MASK (1 << 6)
#endif
/**
* Information about open files
@ -111,12 +116,19 @@ struct fuse_conn_info {
*/
unsigned max_readahead;
unsigned capable; /* JPA */
unsigned want; /* JPA */
#ifdef POSIXACLS
unsigned capable;
unsigned want;
/**
* For future use.
*/
unsigned reserved[25 /* was 27 JPA */];
unsigned reserved[25];
#else
/**
* For future use.
*/
unsigned reserved[27];
#endif
};
struct fuse_session;

View File

@ -49,7 +49,11 @@
#define FUSE_KERNEL_VERSION 7
/** Minor version number of this interface */
#ifdef POSIXACLS
#define FUSE_KERNEL_MINOR_VERSION 12
#else
#define FUSE_KERNEL_MINOR_VERSION 8
#endif
/** The node ID of the root inode */
#define FUSE_ROOT_ID 1
@ -78,7 +82,9 @@ struct fuse_attr {
__u32 uid;
__u32 gid;
__u32 rdev;
__u64 filling; /* JPA needed, but do not know how to fill */
#ifdef POSIXACLS
__u64 filling; /* JPA needed, but do not know how to fill */
#endif
};
struct fuse_kstatfs {
@ -203,8 +209,10 @@ struct fuse_attr_out {
struct fuse_mknod_in {
__u32 mode;
__u32 rdev;
#ifdef POSIXACLS
__u32 umask;
__u32 padding;
#endif
};
struct fuse_mkdir_in {
@ -241,14 +249,20 @@ struct fuse_setattr_in {
struct fuse_open_in {
__u32 flags;
#ifdef POSIXACLS
__u32 unused;
#else
__u32 mode;
#endif
};
struct fuse_create_in {
__u32 flags;
__u32 mode;
#ifdef POSIXACLS
__u32 umask;
__u32 padding;
#endif
};
struct fuse_open_out {
@ -285,9 +299,11 @@ struct fuse_write_in {
__u64 offset;
__u32 size;
__u32 write_flags;
#ifdef POSIXACLS
__u64 lock_owner; /* JPA */
__u32 flags; /* JPA */
__u32 padding; /* JPA */
#endif
};
struct fuse_write_out {

View File

@ -101,8 +101,10 @@ struct fuse_ctx {
/** Thread ID of the calling process */
pid_t pid;
#ifdef POSIXACLS
/** Umask of the calling process (introduced in version 2.8) */
mode_t umask;
#endif
};
/* 'to_set' flags in setattr */
@ -923,6 +925,7 @@ int fuse_reply_write(fuse_req_t req, size_t count);
*/
int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
#ifdef POSIXACLS
/**
* Reply with data vector
*
@ -935,6 +938,7 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
* @return zero for success, -errno for failure to send reply
*/
int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count);
#endif
/**
* Reply with filesystem statistics

View File

@ -1021,7 +1021,9 @@ static struct fuse *req_fuse_prepare(fuse_req_t req)
c->ctx.uid = ctx->uid;
c->ctx.gid = ctx->gid;
c->ctx.pid = ctx->pid;
#ifdef POSIXACLS
c->ctx.umask = ctx->umask;
#endif
return c->ctx.fuse;
}

View File

@ -78,7 +78,9 @@ static void convert_stat(const struct stat *stbuf, struct fuse_attr *attr)
attr->atimensec = ST_ATIM_NSEC(stbuf);
attr->mtimensec = ST_MTIM_NSEC(stbuf);
attr->ctimensec = ST_CTIM_NSEC(stbuf);
attr->filling = 0; /* JPA trying to be safe */
#ifdef POSIXACLS
attr->filling = 0; /* JPA trying to be safe */
#endif
}
static void convert_attr(const struct fuse_setattr_in *attr, struct stat *stbuf)
@ -512,9 +514,11 @@ static void do_mknod(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
const struct fuse_mknod_in *arg = (const struct fuse_mknod_in *) inarg;
const char *name = PARAM(arg);
#ifdef POSIXACLS
if (req->f->conn.proto_minor >= 12)
req->ctx.umask = arg->umask;
else
#endif
name = (const char *) inarg + FUSE_COMPAT_MKNOD_IN_SIZE;
if (req->f->op.mknod)
@ -527,8 +531,10 @@ static void do_mkdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
{
const struct fuse_mkdir_in *arg = (const struct fuse_mkdir_in *) inarg;
#ifdef POSIXACLS
if (req->f->conn.proto_minor >= 12)
req->ctx.umask = arg->umask;
#endif
if (req->f->op.mkdir)
req->f->op.mkdir(req, nodeid, PARAM(arg), arg->mode);
@ -600,9 +606,11 @@ static void do_create(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
memset(&fi, 0, sizeof(fi));
fi.flags = arg->flags;
#ifdef POSIXACLS
if (req->f->conn.proto_minor >= 12)
req->ctx.umask = arg->umask;
else
#endif
name = (const char *) inarg + sizeof(struct fuse_open_in);
req->f->op.create(req, nodeid, name, arg->mode, &fi);
@ -999,8 +1007,10 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
f->conn.async_read = arg->flags & FUSE_ASYNC_READ;
if (arg->max_readahead < f->conn.max_readahead)
f->conn.max_readahead = arg->max_readahead;
#ifdef POSIXACLS
if (arg->flags & FUSE_DONT_MASK)
f->conn.capable |= FUSE_CAP_DONT_MASK;
#endif
} else {
f->conn.async_read = 0;
f->conn.max_readahead = 0;
@ -1027,8 +1037,10 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outarg.flags |= FUSE_ASYNC_READ;
if (f->op.getlk && f->op.setlk)
outarg.flags |= FUSE_POSIX_LOCKS;
#ifdef POSIXACLS
if (f->conn.want & FUSE_CAP_DONT_MASK)
outarg.flags |= FUSE_DONT_MASK;
#endif
outarg.max_readahead = f->conn.max_readahead;
outarg.max_write = f->conn.max_write;