Fuse: whitespace and style(9) cleanup

Take a pass through fixing some of the most egregious whitespace issues in
fs/fuse.  Also fix some style(9) warts while here.  Not 100% cleaned up, but
somewhat less painful to look at and edit.

No functional change.
This commit is contained in:
Conrad Meyer 2019-02-20 02:49:26 +00:00
parent bd4cb2a46d
commit 02295caf43
11 changed files with 471 additions and 583 deletions

View File

@ -197,26 +197,27 @@ do { \
#define FUSE_TRACE 0
#endif
#define DEBUGX(cond, fmt, ...) do { \
if (((cond))) { \
printf("%s: " fmt, __func__, ## __VA_ARGS__); \
} } while (0)
#define DEBUGX(cond, fmt, ...) do { \
if (((cond))) { \
printf("%s: " fmt, __func__, ## __VA_ARGS__); \
} \
} while (0)
#define fuse_lck_mtx_lock(mtx) do { \
DEBUGX(FUSE_DEBUG_LOCK, "0: lock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
mtx_lock(&(mtx)); \
DEBUGX(FUSE_DEBUG_LOCK, "1: lock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
} while (0)
#define fuse_lck_mtx_lock(mtx) do { \
DEBUGX(FUSE_DEBUG_LOCK, "0: lock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
mtx_lock(&(mtx)); \
DEBUGX(FUSE_DEBUG_LOCK, "1: lock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
} while (0)
#define fuse_lck_mtx_unlock(mtx) do { \
DEBUGX(FUSE_DEBUG_LOCK, "0: unlock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
mtx_unlock(&(mtx)); \
DEBUGX(FUSE_DEBUG_LOCK, "1: unlock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
} while (0)
#define fuse_lck_mtx_unlock(mtx) do { \
DEBUGX(FUSE_DEBUG_LOCK, "0: unlock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
mtx_unlock(&(mtx)); \
DEBUGX(FUSE_DEBUG_LOCK, "1: unlock(%s): %s@%d by %d\n", \
__STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid); \
} while (0)
void fuse_ipc_init(void);
void fuse_ipc_destroy(void);

View File

@ -317,7 +317,7 @@ again:
return (err);
}
static __inline int
static inline int
fuse_ohead_audit(struct fuse_out_header *ohead, struct uio *uio)
{
FS_DEBUG("Out header -- len: %i, error: %i, unique: %llu; iovecs: %d\n",

View File

@ -91,11 +91,8 @@ SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLFLAG_RD,
&fuse_fh_count, 0, "number of open FUSE filehandles");
int
fuse_filehandle_open(struct vnode *vp,
fufh_type_t fufh_type,
struct fuse_filehandle **fufhp,
struct thread *td,
struct ucred *cred)
fuse_filehandle_open(struct vnode *vp, fufh_type_t fufh_type,
struct fuse_filehandle **fufhp, struct thread *td, struct ucred *cred)
{
struct fuse_dispatcher fdi;
struct fuse_open_in *foi;
@ -114,8 +111,8 @@ fuse_filehandle_open(struct vnode *vp,
/* NOTREACHED */
}
/*
* Note that this means we are effectively FILTERING OUT open() flags.
*/
* Note that this means we are effectively FILTERING OUT open() flags.
*/
oflags = fuse_filehandle_xlate_to_oflags(fufh_type);
if (vnode_isdir(vp)) {
@ -159,10 +156,8 @@ out:
}
int
fuse_filehandle_close(struct vnode *vp,
fufh_type_t fufh_type,
struct thread *td,
struct ucred *cred)
fuse_filehandle_close(struct vnode *vp, fufh_type_t fufh_type,
struct thread *td, struct ucred *cred)
{
struct fuse_dispatcher fdi;
struct fuse_release_in *fri;
@ -265,10 +260,8 @@ fuse_filehandle_getrw(struct vnode *vp, fufh_type_t fufh_type,
}
void
fuse_filehandle_init(struct vnode *vp,
fufh_type_t fufh_type,
struct fuse_filehandle **fufhp,
uint64_t fh_id)
fuse_filehandle_init(struct vnode *vp, fufh_type_t fufh_type,
struct fuse_filehandle **fufhp, uint64_t fh_id)
{
struct fuse_vnode_data *fvdat = VTOFUD(vp);
struct fuse_filehandle *fufh;

View File

@ -67,75 +67,65 @@
#include <sys/vnode.h>
typedef enum fufh_type {
FUFH_INVALID = -1,
FUFH_RDONLY = 0,
FUFH_WRONLY = 1,
FUFH_RDWR = 2,
FUFH_MAXTYPE = 3,
FUFH_INVALID = -1,
FUFH_RDONLY = 0,
FUFH_WRONLY = 1,
FUFH_RDWR = 2,
FUFH_MAXTYPE = 3,
} fufh_type_t;
_Static_assert(FUFH_RDONLY == O_RDONLY, "RDONLY");
_Static_assert(FUFH_WRONLY == O_WRONLY, "WRONLY");
_Static_assert(FUFH_RDWR == O_RDWR, "RDWR");
struct fuse_filehandle {
uint64_t fh_id;
fufh_type_t fh_type;
uint64_t fh_id;
fufh_type_t fh_type;
};
#define FUFH_IS_VALID(f) ((f)->fh_type != FUFH_INVALID)
static __inline__
fufh_type_t
static inline fufh_type_t
fuse_filehandle_xlate_from_mmap(int fflags)
{
if (fflags & (PROT_READ | PROT_WRITE)) {
return FUFH_RDWR;
} else if (fflags & (PROT_WRITE)) {
return FUFH_WRONLY;
} else if ((fflags & PROT_READ) || (fflags & PROT_EXEC)) {
return FUFH_RDONLY;
} else {
return FUFH_INVALID;
}
if (fflags & (PROT_READ | PROT_WRITE))
return FUFH_RDWR;
else if (fflags & (PROT_WRITE))
return FUFH_WRONLY;
else if ((fflags & PROT_READ) || (fflags & PROT_EXEC))
return FUFH_RDONLY;
else
return FUFH_INVALID;
}
static __inline__
fufh_type_t
static inline fufh_type_t
fuse_filehandle_xlate_from_fflags(int fflags)
{
if ((fflags & FREAD) && (fflags & FWRITE)) {
return FUFH_RDWR;
} else if (fflags & (FWRITE)) {
return FUFH_WRONLY;
} else if (fflags & (FREAD)) {
return FUFH_RDONLY;
} else {
panic("FUSE: What kind of a flag is this (%x)?", fflags);
}
if ((fflags & FREAD) && (fflags & FWRITE))
return FUFH_RDWR;
else if (fflags & (FWRITE))
return FUFH_WRONLY;
else if (fflags & (FREAD))
return FUFH_RDONLY;
else
panic("FUSE: What kind of a flag is this (%x)?", fflags);
}
static __inline__
int
static inline int
fuse_filehandle_xlate_to_oflags(fufh_type_t type)
{
int oflags = -1;
int oflags = -1;
switch (type) {
switch (type) {
case FUFH_RDONLY:
case FUFH_WRONLY:
case FUFH_RDWR:
oflags = type;
break;
default:
break;
}
case FUFH_RDONLY:
oflags = O_RDONLY;
break;
case FUFH_WRONLY:
oflags = O_WRONLY;
break;
case FUFH_RDWR:
oflags = O_RDWR;
break;
default:
break;
}
return oflags;
return oflags;
}
int fuse_filehandle_valid(struct vnode *vp, fufh_type_t fufh_type);

View File

@ -68,116 +68,114 @@
#include "fuse_ipc.h"
#include "fuse_node.h"
static __inline int
static inline bool
vfs_isrdonly(struct mount *mp)
{
return ((mp->mnt_flag & MNT_RDONLY) != 0 ? 1 : 0);
return ((mp->mnt_flag & MNT_RDONLY) != 0);
}
static __inline struct mount *
static inline struct mount *
vnode_mount(struct vnode *vp)
{
return (vp->v_mount);
}
static __inline int
static inline bool
vnode_mountedhere(struct vnode *vp)
{
return (vp->v_mountedhere != NULL ? 1 : 0);
return (vp->v_mountedhere != NULL);
}
static __inline enum vtype
static inline enum vtype
vnode_vtype(struct vnode *vp)
{
return (vp->v_type);
return (vp->v_type);
}
static __inline int
static inline bool
vnode_isvroot(struct vnode *vp)
{
return ((vp->v_vflag & VV_ROOT) != 0 ? 1 : 0);
return ((vp->v_vflag & VV_ROOT) != 0);
}
static __inline int
static inline bool
vnode_isreg(struct vnode *vp)
{
return (vp->v_type == VREG ? 1 : 0);
return (vp->v_type == VREG);
}
static __inline int
static inline bool
vnode_isdir(struct vnode *vp)
{
return (vp->v_type == VDIR ? 1 : 0);
return (vp->v_type == VDIR);
}
static __inline int
static inline bool
vnode_islnk(struct vnode *vp)
{
return (vp->v_type == VLNK ? 1 : 0);
return (vp->v_type == VLNK);
}
static __inline ssize_t
static inline ssize_t
uio_resid(struct uio *uio)
{
return (uio->uio_resid);
return (uio->uio_resid);
}
static __inline off_t
static inline off_t
uio_offset(struct uio *uio)
{
return (uio->uio_offset);
return (uio->uio_offset);
}
static __inline void
static inline void
uio_setoffset(struct uio *uio, off_t offset)
{
uio->uio_offset = offset;
uio->uio_offset = offset;
}
static __inline void
static inline void
uio_setresid(struct uio *uio, ssize_t resid)
{
uio->uio_resid = resid;
uio->uio_resid = resid;
}
/* miscellaneous */
static __inline__
int
static inline bool
fuse_isdeadfs(struct vnode *vp)
{
struct fuse_data *data = fuse_get_mpdata(vnode_mount(vp));
struct fuse_data *data = fuse_get_mpdata(vnode_mount(vp));
return (data->dataflags & FSESS_DEAD);
return (data->dataflags & FSESS_DEAD);
}
static __inline__
int
static inline uint64_t
fuse_iosize(struct vnode *vp)
{
return vp->v_mount->mnt_stat.f_iosize;
return (vp->v_mount->mnt_stat.f_iosize);
}
/* access */
#define FVP_ACCESS_NOOP 0x01
#define FVP_ACCESS_NOOP 0x01
#define FACCESS_VA_VALID 0x01
#define FACCESS_DO_ACCESS 0x02
#define FACCESS_STICKY 0x04
#define FACCESS_CHOWN 0x08
#define FACCESS_NOCHECKSPY 0x10
#define FACCESS_SETGID 0x12
#define FACCESS_VA_VALID 0x01
#define FACCESS_DO_ACCESS 0x02
#define FACCESS_STICKY 0x04
#define FACCESS_CHOWN 0x08
#define FACCESS_NOCHECKSPY 0x10
#define FACCESS_SETGID 0x12
#define FACCESS_XQUERIES FACCESS_STICKY | FACCESS_CHOWN | FACCESS_SETGID
#define FACCESS_XQUERIES (FACCESS_STICKY | FACCESS_CHOWN | FACCESS_SETGID)
struct fuse_access_param {
uid_t xuid;
gid_t xgid;
uint32_t facc_flags;
uid_t xuid;
gid_t xgid;
uint32_t facc_flags;
};
static __inline int
static inline int
fuse_match_cred(struct ucred *basecred, struct ucred *usercred)
{
if (basecred->cr_uid == usercred->cr_uid &&
@ -186,17 +184,13 @@ fuse_match_cred(struct ucred *basecred, struct ucred *usercred)
basecred->cr_groups[0] == usercred->cr_groups[0] &&
basecred->cr_groups[0] == usercred->cr_rgid &&
basecred->cr_groups[0] == usercred->cr_svgid)
return 0;
return (0);
return EPERM;
return (EPERM);
}
int
fuse_internal_access(struct vnode *vp,
mode_t mode,
struct fuse_access_param *facp,
struct thread *td,
struct ucred *cred);
int fuse_internal_access(struct vnode *vp, mode_t mode,
struct fuse_access_param *facp, struct thread *td, struct ucred *cred);
/* attributes */
@ -209,186 +203,143 @@ fuse_internal_access(struct vnode *vp,
* If the nominal attribute cache TTL is zero, do not cache on the 'vp' (but do
* return the result to the caller).
*/
static __inline
void
fuse_internal_attr_fat2vat(struct vnode *vp,
struct fuse_attr *fat,
uint64_t attr_valid,
uint32_t attr_valid_nsec,
struct vattr *vap)
static inline void
fuse_internal_attr_fat2vat(struct vnode *vp, struct fuse_attr *fat,
uint64_t attr_valid, uint32_t attr_valid_nsec, struct vattr *vap)
{
struct mount *mp;
struct fuse_vnode_data *fvdat;
struct vattr *vp_cache_at;
struct mount *mp;
struct fuse_vnode_data *fvdat;
struct vattr *vp_cache_at;
mp = vnode_mount(vp);
fvdat = VTOFUD(vp);
mp = vnode_mount(vp);
fvdat = VTOFUD(vp);
DEBUGX(FUSE_DEBUG_INTERNAL,
"node #%ju, mode 0%o\n", (uintmax_t)fat->ino, fat->mode);
DEBUGX(FUSE_DEBUG_INTERNAL, "node #%ju, mode 0%o\n",
(uintmax_t)fat->ino, fat->mode);
/* Honor explicit do-not-cache requests from user filesystems. */
if (attr_valid == 0 && attr_valid_nsec == 0)
fvdat->valid_attr_cache = false;
else
fvdat->valid_attr_cache = true;
/* Honor explicit do-not-cache requests from user filesystems. */
if (attr_valid == 0 && attr_valid_nsec == 0)
fvdat->valid_attr_cache = false;
else
fvdat->valid_attr_cache = true;
vp_cache_at = VTOVA(vp);
vp_cache_at = VTOVA(vp);
if (vap == NULL && vp_cache_at == NULL)
return;
if (vap == NULL && vp_cache_at == NULL)
return;
if (vap == NULL)
vap = vp_cache_at;
if (vap == NULL)
vap = vp_cache_at;
vattr_null(vap);
vattr_null(vap);
vap->va_fsid = mp->mnt_stat.f_fsid.val[0];
vap->va_fileid = fat->ino;
vap->va_mode = fat->mode & ~S_IFMT;
vap->va_nlink = fat->nlink;
vap->va_uid = fat->uid;
vap->va_gid = fat->gid;
vap->va_rdev = fat->rdev;
vap->va_size = fat->size;
vap->va_atime.tv_sec = fat->atime; /* XXX on some platforms cast from 64 bits to 32 */
vap->va_atime.tv_nsec = fat->atimensec;
vap->va_mtime.tv_sec = fat->mtime;
vap->va_mtime.tv_nsec = fat->mtimensec;
vap->va_ctime.tv_sec = fat->ctime;
vap->va_ctime.tv_nsec = fat->ctimensec;
vap->va_blocksize = PAGE_SIZE;
vap->va_type = IFTOVT(fat->mode);
vap->va_bytes = fat->blocks * S_BLKSIZE;
vap->va_flags = 0;
vap->va_fsid = mp->mnt_stat.f_fsid.val[0];
vap->va_fileid = fat->ino;
vap->va_mode = fat->mode & ~S_IFMT;
vap->va_nlink = fat->nlink;
vap->va_uid = fat->uid;
vap->va_gid = fat->gid;
vap->va_rdev = fat->rdev;
vap->va_size = fat->size;
/* XXX on i386, seconds are truncated to 32 bits */
vap->va_atime.tv_sec = fat->atime;
vap->va_atime.tv_nsec = fat->atimensec;
vap->va_mtime.tv_sec = fat->mtime;
vap->va_mtime.tv_nsec = fat->mtimensec;
vap->va_ctime.tv_sec = fat->ctime;
vap->va_ctime.tv_nsec = fat->ctimensec;
vap->va_blocksize = PAGE_SIZE;
vap->va_type = IFTOVT(fat->mode);
vap->va_bytes = fat->blocks * S_BLKSIZE;
vap->va_flags = 0;
if (vap != vp_cache_at && vp_cache_at != NULL)
memcpy(vp_cache_at, vap, sizeof(*vap));
if (vap != vp_cache_at && vp_cache_at != NULL)
memcpy(vp_cache_at, vap, sizeof(*vap));
}
#define cache_attrs(vp, fuse_out, vap_out) \
fuse_internal_attr_fat2vat((vp), &(fuse_out)->attr, \
(fuse_out)->attr_valid, (fuse_out)->attr_valid_nsec, (vap_out))
fuse_internal_attr_fat2vat((vp), &(fuse_out)->attr, \
(fuse_out)->attr_valid, (fuse_out)->attr_valid_nsec, (vap_out))
/* fsync */
int
fuse_internal_fsync(struct vnode *vp,
struct thread *td,
struct ucred *cred,
struct fuse_filehandle *fufh);
int
fuse_internal_fsync_callback(struct fuse_ticket *tick, struct uio *uio);
int fuse_internal_fsync(struct vnode *vp, struct thread *td,
struct ucred *cred, struct fuse_filehandle *fufh);
int fuse_internal_fsync_callback(struct fuse_ticket *tick, struct uio *uio);
/* readdir */
struct pseudo_dirent {
uint32_t d_namlen;
uint32_t d_namlen;
};
int
fuse_internal_readdir(struct vnode *vp,
struct uio *uio,
struct fuse_filehandle *fufh,
struct fuse_iov *cookediov);
int
fuse_internal_readdir_processdata(struct uio *uio,
size_t reqsize,
void *buf,
size_t bufsize,
void *param);
int fuse_internal_readdir(struct vnode *vp, struct uio *uio,
struct fuse_filehandle *fufh, struct fuse_iov *cookediov);
int fuse_internal_readdir_processdata(struct uio *uio, size_t reqsize,
void *buf, size_t bufsize, void *param);
/* remove */
int
fuse_internal_remove(struct vnode *dvp,
struct vnode *vp,
struct componentname *cnp,
enum fuse_opcode op);
int fuse_internal_remove(struct vnode *dvp, struct vnode *vp,
struct componentname *cnp, enum fuse_opcode op);
/* rename */
int
fuse_internal_rename(struct vnode *fdvp,
struct componentname *fcnp,
struct vnode *tdvp,
struct componentname *tcnp);
int fuse_internal_rename(struct vnode *fdvp, struct componentname *fcnp,
struct vnode *tdvp, struct componentname *tcnp);
/* revoke */
void
fuse_internal_vnode_disappear(struct vnode *vp);
void fuse_internal_vnode_disappear(struct vnode *vp);
/* strategy */
/* entity creation */
static __inline
int
static inline int
fuse_internal_checkentry(struct fuse_entry_out *feo, enum vtype vtyp)
{
DEBUGX(FUSE_DEBUG_INTERNAL,
"feo=%p, vtype=%d\n", feo, vtyp);
DEBUGX(FUSE_DEBUG_INTERNAL,
"feo=%p, vtype=%d\n", feo, vtyp);
if (vtyp != IFTOVT(feo->attr.mode)) {
DEBUGX(FUSE_DEBUG_INTERNAL,
"EINVAL -- %x != %x\n", vtyp, IFTOVT(feo->attr.mode));
return EINVAL;
}
if (vtyp != IFTOVT(feo->attr.mode)) {
DEBUGX(FUSE_DEBUG_INTERNAL,
"EINVAL -- %x != %x\n", vtyp, IFTOVT(feo->attr.mode));
return (EINVAL);
}
if (feo->nodeid == FUSE_NULL_ID) {
DEBUGX(FUSE_DEBUG_INTERNAL,
"EINVAL -- feo->nodeid is NULL\n");
return EINVAL;
}
if (feo->nodeid == FUSE_NULL_ID) {
DEBUGX(FUSE_DEBUG_INTERNAL,
"EINVAL -- feo->nodeid is NULL\n");
return (EINVAL);
}
if (feo->nodeid == FUSE_ROOT_ID) {
DEBUGX(FUSE_DEBUG_INTERNAL,
"EINVAL -- feo->nodeid is FUSE_ROOT_ID\n");
return EINVAL;
}
if (feo->nodeid == FUSE_ROOT_ID) {
DEBUGX(FUSE_DEBUG_INTERNAL,
"EINVAL -- feo->nodeid is FUSE_ROOT_ID\n");
return (EINVAL);
}
return 0;
return (0);
}
int
fuse_internal_newentry(struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp,
enum fuse_opcode op,
void *buf,
size_t bufsize,
enum vtype vtyp);
int fuse_internal_newentry(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, enum fuse_opcode op, void *buf, size_t bufsize,
enum vtype vtyp);
void
fuse_internal_newentry_makerequest(struct mount *mp,
uint64_t dnid,
struct componentname *cnp,
enum fuse_opcode op,
void *buf,
size_t bufsize,
struct fuse_dispatcher *fdip);
void fuse_internal_newentry_makerequest(struct mount *mp, uint64_t dnid,
struct componentname *cnp, enum fuse_opcode op, void *buf, size_t bufsize,
struct fuse_dispatcher *fdip);
int
fuse_internal_newentry_core(struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp,
enum vtype vtyp,
struct fuse_dispatcher *fdip);
int fuse_internal_newentry_core(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, enum vtype vtyp, struct fuse_dispatcher *fdip);
/* entity destruction */
int
fuse_internal_forget_callback(struct fuse_ticket *tick, struct uio *uio);
void
fuse_internal_forget_send(struct mount *mp,
struct thread *td,
struct ucred *cred,
uint64_t nodeid,
uint64_t nlookup);
int fuse_internal_forget_callback(struct fuse_ticket *tick, struct uio *uio);
void fuse_internal_forget_send(struct mount *mp, struct thread *td,
struct ucred *cred, uint64_t nodeid, uint64_t nlookup);
/* fuse start/stop */

View File

@ -91,19 +91,11 @@ static struct fuse_ticket *fticket_alloc(struct fuse_data *data);
static void fticket_refresh(struct fuse_ticket *ftick);
static void fticket_destroy(struct fuse_ticket *ftick);
static int fticket_wait_answer(struct fuse_ticket *ftick);
static __inline__ int
static inline int
fticket_aw_pull_uio(struct fuse_ticket *ftick,
struct uio *uio);
static int fuse_body_audit(struct fuse_ticket *ftick, size_t blen);
static __inline__ void
fuse_setup_ihead(struct fuse_in_header *ihead,
struct fuse_ticket *ftick,
uint64_t nid,
enum fuse_opcode op,
size_t blen,
pid_t pid,
struct ucred *cred);
static fuse_handler_t fuse_standard_handler;
@ -274,19 +266,19 @@ fticket_fini(void *mem, int size)
mtx_destroy(&ftick->tk_aw_mtx);
}
static __inline struct fuse_ticket *
static inline struct fuse_ticket *
fticket_alloc(struct fuse_data *data)
{
return uma_zalloc_arg(ticket_zone, data, M_WAITOK);
}
static __inline void
static inline void
fticket_destroy(struct fuse_ticket *ftick)
{
return uma_zfree(ticket_zone, ftick);
}
static __inline__
static inline
void
fticket_refresh(struct fuse_ticket *ftick)
{
@ -354,7 +346,7 @@ out:
return err;
}
static __inline__
static inline
int
fticket_aw_pull_uio(struct fuse_ticket *ftick, struct uio *uio)
{
@ -717,13 +709,9 @@ fuse_body_audit(struct fuse_ticket *ftick, size_t blen)
return err;
}
static void
fuse_setup_ihead(struct fuse_in_header *ihead,
struct fuse_ticket *ftick,
uint64_t nid,
enum fuse_opcode op,
size_t blen,
pid_t pid,
static inline void
fuse_setup_ihead(struct fuse_in_header *ihead, struct fuse_ticket *ftick,
uint64_t nid, enum fuse_opcode op, size_t blen, pid_t pid,
struct ucred *cred)
{
ihead->len = sizeof(*ihead) + blen;
@ -767,12 +755,8 @@ fuse_standard_handler(struct fuse_ticket *ftick, struct uio *uio)
}
void
fdisp_make_pid(struct fuse_dispatcher *fdip,
enum fuse_opcode op,
struct mount *mp,
uint64_t nid,
pid_t pid,
struct ucred *cred)
fdisp_make_pid(struct fuse_dispatcher *fdip, enum fuse_opcode op,
struct mount *mp, uint64_t nid, pid_t pid, struct ucred *cred)
{
struct fuse_data *data = fuse_get_mpdata(mp);
@ -792,12 +776,8 @@ fdisp_make_pid(struct fuse_dispatcher *fdip,
}
void
fdisp_make(struct fuse_dispatcher *fdip,
enum fuse_opcode op,
struct mount *mp,
uint64_t nid,
struct thread *td,
struct ucred *cred)
fdisp_make(struct fuse_dispatcher *fdip, enum fuse_opcode op, struct mount *mp,
uint64_t nid, struct thread *td, struct ucred *cred)
{
RECTIFY_TDCR(td, cred);
@ -805,11 +785,8 @@ fdisp_make(struct fuse_dispatcher *fdip,
}
void
fdisp_make_vp(struct fuse_dispatcher *fdip,
enum fuse_opcode op,
struct vnode *vp,
struct thread *td,
struct ucred *cred)
fdisp_make_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op,
struct vnode *vp, struct thread *td, struct ucred *cred)
{
debug_printf("fdip=%p, op=%d, vp=%p\n", fdip, op, vp);
RECTIFY_TDCR(td, cred);

View File

@ -64,10 +64,10 @@
#include <sys/refcount.h>
struct fuse_iov {
void *base;
size_t len;
size_t allocated_size;
int credit;
void *base;
size_t len;
size_t allocated_size;
int credit;
};
void fiov_init(struct fuse_iov *fiov, size_t size);
@ -75,23 +75,22 @@ void fiov_teardown(struct fuse_iov *fiov);
void fiov_refresh(struct fuse_iov *fiov);
void fiov_adjust(struct fuse_iov *fiov, size_t size);
#define FUSE_DIMALLOC(fiov, spc1, spc2, amnt) \
do { \
fiov_adjust(fiov, (sizeof(*(spc1)) + (amnt))); \
(spc1) = (fiov)->base; \
(spc2) = (char *)(fiov)->base + (sizeof(*(spc1))); \
#define FUSE_DIMALLOC(fiov, spc1, spc2, amnt) do { \
fiov_adjust(fiov, (sizeof(*(spc1)) + (amnt))); \
(spc1) = (fiov)->base; \
(spc2) = (char *)(fiov)->base + (sizeof(*(spc1))); \
} while (0)
#define FU_AT_LEAST(siz) max((siz), 160)
#define FUSE_ASSERT_AW_DONE(ftick) \
KASSERT((ftick)->tk_aw_link.tqe_next == NULL && \
(ftick)->tk_aw_link.tqe_prev == NULL, \
("FUSE: ticket still on answer delivery list %p", (ftick))) \
#define FUSE_ASSERT_AW_DONE(ftick) \
KASSERT((ftick)->tk_aw_link.tqe_next == NULL && \
(ftick)->tk_aw_link.tqe_prev == NULL, \
("FUSE: ticket still on answer delivery list %p", (ftick)))
#define FUSE_ASSERT_MS_DONE(ftick) \
KASSERT((ftick)->tk_ms_link.stqe_next == NULL, \
("FUSE: ticket still on message list %p", (ftick)))
#define FUSE_ASSERT_MS_DONE(ftick) \
KASSERT((ftick)->tk_ms_link.stqe_next == NULL, \
("FUSE: ticket still on message list %p", (ftick)))
struct fuse_ticket;
struct fuse_data;
@ -99,66 +98,62 @@ struct fuse_data;
typedef int fuse_handler_t(struct fuse_ticket *ftick, struct uio *uio);
struct fuse_ticket {
/* fields giving the identity of the ticket */
uint64_t tk_unique;
struct fuse_data *tk_data;
int tk_flag;
u_int tk_refcount;
/* fields giving the identity of the ticket */
uint64_t tk_unique;
struct fuse_data *tk_data;
int tk_flag;
u_int tk_refcount;
/* fields for initiating an upgoing message */
struct fuse_iov tk_ms_fiov;
void *tk_ms_bufdata;
size_t tk_ms_bufsize;
enum { FT_M_FIOV, FT_M_BUF } tk_ms_type;
STAILQ_ENTRY(fuse_ticket) tk_ms_link;
/* fields for initiating an upgoing message */
struct fuse_iov tk_ms_fiov;
void *tk_ms_bufdata;
size_t tk_ms_bufsize;
enum { FT_M_FIOV, FT_M_BUF } tk_ms_type;
STAILQ_ENTRY(fuse_ticket) tk_ms_link;
/* fields for handling answers coming from userspace */
struct fuse_iov tk_aw_fiov;
void *tk_aw_bufdata;
size_t tk_aw_bufsize;
enum { FT_A_FIOV, FT_A_BUF } tk_aw_type;
/* fields for handling answers coming from userspace */
struct fuse_iov tk_aw_fiov;
void *tk_aw_bufdata;
size_t tk_aw_bufsize;
enum { FT_A_FIOV, FT_A_BUF } tk_aw_type;
struct fuse_out_header tk_aw_ohead;
int tk_aw_errno;
struct mtx tk_aw_mtx;
fuse_handler_t *tk_aw_handler;
TAILQ_ENTRY(fuse_ticket) tk_aw_link;
struct fuse_out_header tk_aw_ohead;
int tk_aw_errno;
struct mtx tk_aw_mtx;
fuse_handler_t *tk_aw_handler;
TAILQ_ENTRY(fuse_ticket) tk_aw_link;
};
#define FT_ANSW 0x01 /* request of ticket has already been answered */
#define FT_DIRTY 0x04 /* ticket has been used */
static __inline__
struct fuse_iov *
static inline struct fuse_iov *
fticket_resp(struct fuse_ticket *ftick)
{
return (&ftick->tk_aw_fiov);
return (&ftick->tk_aw_fiov);
}
static __inline__
int
static inline bool
fticket_answered(struct fuse_ticket *ftick)
{
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
mtx_assert(&ftick->tk_aw_mtx, MA_OWNED);
return (ftick->tk_flag & FT_ANSW);
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
mtx_assert(&ftick->tk_aw_mtx, MA_OWNED);
return (ftick->tk_flag & FT_ANSW);
}
static __inline__
void
static inline void
fticket_set_answered(struct fuse_ticket *ftick)
{
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
mtx_assert(&ftick->tk_aw_mtx, MA_OWNED);
ftick->tk_flag |= FT_ANSW;
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
mtx_assert(&ftick->tk_aw_mtx, MA_OWNED);
ftick->tk_flag |= FT_ANSW;
}
static __inline__
enum fuse_opcode
static inline enum fuse_opcode
fticket_opcode(struct fuse_ticket *ftick)
{
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
return (((struct fuse_in_header *)(ftick->tk_ms_fiov.base))->opcode);
DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick);
return (((struct fuse_in_header *)(ftick->tk_ms_fiov.base))->opcode);
}
int fticket_pull(struct fuse_ticket *ftick, struct uio *uio);
@ -169,35 +164,35 @@ enum mountpri { FM_NOMOUNTED, FM_PRIMARY, FM_SECONDARY };
* The data representing a FUSE session.
*/
struct fuse_data {
struct cdev *fdev;
struct mount *mp;
struct vnode *vroot;
struct ucred *daemoncred;
int dataflags;
int ref;
struct cdev *fdev;
struct mount *mp;
struct vnode *vroot;
struct ucred *daemoncred;
int dataflags;
int ref;
struct mtx ms_mtx;
STAILQ_HEAD(, fuse_ticket) ms_head;
struct mtx ms_mtx;
STAILQ_HEAD(, fuse_ticket) ms_head;
struct mtx aw_mtx;
TAILQ_HEAD(, fuse_ticket) aw_head;
struct mtx aw_mtx;
TAILQ_HEAD(, fuse_ticket) aw_head;
u_long ticketer;
u_long ticketer;
struct sx rename_lock;
struct sx rename_lock;
uint32_t fuse_libabi_major;
uint32_t fuse_libabi_minor;
uint32_t fuse_libabi_major;
uint32_t fuse_libabi_minor;
uint32_t max_write;
uint32_t max_read;
uint32_t subtype;
char volname[MAXPATHLEN];
uint32_t max_write;
uint32_t max_read;
uint32_t subtype;
char volname[MAXPATHLEN];
struct selinfo ks_rsel;
struct selinfo ks_rsel;
int daemon_timeout;
uint64_t notimpl;
int daemon_timeout;
uint64_t notimpl;
};
#define FSESS_DEAD 0x0001 /* session is to be closed */
@ -226,127 +221,120 @@ extern int fuse_mmap_enable;
extern int fuse_sync_resize;
extern int fuse_fix_broken_io;
static __inline__
struct fuse_data *
static inline struct fuse_data *
fuse_get_mpdata(struct mount *mp)
{
return mp->mnt_data;
return mp->mnt_data;
}
static __inline int
static inline bool
fsess_isimpl(struct mount *mp, int opcode)
{
struct fuse_data *data = fuse_get_mpdata(mp);
struct fuse_data *data = fuse_get_mpdata(mp);
return (data->notimpl & (1ULL << opcode)) == 0;
return ((data->notimpl & (1ULL << opcode)) == 0);
}
static __inline void
static inline void
fsess_set_notimpl(struct mount *mp, int opcode)
{
struct fuse_data *data = fuse_get_mpdata(mp);
struct fuse_data *data = fuse_get_mpdata(mp);
data->notimpl |= (1ULL << opcode);
data->notimpl |= (1ULL << opcode);
}
static __inline int
static inline bool
fsess_opt_datacache(struct mount *mp)
{
struct fuse_data *data = fuse_get_mpdata(mp);
struct fuse_data *data = fuse_get_mpdata(mp);
return (fuse_data_cache_mode != FUSE_CACHE_UC &&
(data->dataflags & FSESS_NO_DATACACHE) == 0);
return (fuse_data_cache_mode != FUSE_CACHE_UC &&
(data->dataflags & FSESS_NO_DATACACHE) == 0);
}
static __inline int
static inline bool
fsess_opt_mmap(struct mount *mp)
{
struct fuse_data *data = fuse_get_mpdata(mp);
struct fuse_data *data = fuse_get_mpdata(mp);
if (!fuse_mmap_enable || fuse_data_cache_mode == FUSE_CACHE_UC)
return 0;
return ((data->dataflags & (FSESS_NO_DATACACHE | FSESS_NO_MMAP)) == 0);
if (!fuse_mmap_enable || fuse_data_cache_mode == FUSE_CACHE_UC)
return (false);
return ((data->dataflags & (FSESS_NO_DATACACHE | FSESS_NO_MMAP)) == 0);
}
static __inline int
static inline bool
fsess_opt_brokenio(struct mount *mp)
{
struct fuse_data *data = fuse_get_mpdata(mp);
struct fuse_data *data = fuse_get_mpdata(mp);
return (fuse_fix_broken_io || (data->dataflags & FSESS_BROKENIO));
return (fuse_fix_broken_io || (data->dataflags & FSESS_BROKENIO));
}
static __inline__
void
static inline void
fuse_ms_push(struct fuse_ticket *ftick)
{
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n",
ftick, ftick->tk_refcount + 1);
mtx_assert(&ftick->tk_data->ms_mtx, MA_OWNED);
refcount_acquire(&ftick->tk_refcount);
STAILQ_INSERT_TAIL(&ftick->tk_data->ms_head, ftick, tk_ms_link);
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
ftick->tk_refcount + 1);
mtx_assert(&ftick->tk_data->ms_mtx, MA_OWNED);
refcount_acquire(&ftick->tk_refcount);
STAILQ_INSERT_TAIL(&ftick->tk_data->ms_head, ftick, tk_ms_link);
}
static __inline__
struct fuse_ticket *
static inline struct fuse_ticket *
fuse_ms_pop(struct fuse_data *data)
{
struct fuse_ticket *ftick = NULL;
struct fuse_ticket *ftick = NULL;
mtx_assert(&data->ms_mtx, MA_OWNED);
mtx_assert(&data->ms_mtx, MA_OWNED);
if ((ftick = STAILQ_FIRST(&data->ms_head))) {
STAILQ_REMOVE_HEAD(&data->ms_head, tk_ms_link);
if ((ftick = STAILQ_FIRST(&data->ms_head))) {
STAILQ_REMOVE_HEAD(&data->ms_head, tk_ms_link);
#ifdef INVARIANTS
ftick->tk_ms_link.stqe_next = NULL;
ftick->tk_ms_link.stqe_next = NULL;
#endif
}
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n",
ftick, ftick ? ftick->tk_refcount : -1);
}
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
ftick ? ftick->tk_refcount : -1);
return ftick;
return (ftick);
}
static __inline__
void
static inline void
fuse_aw_push(struct fuse_ticket *ftick)
{
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n",
ftick, ftick->tk_refcount + 1);
mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED);
refcount_acquire(&ftick->tk_refcount);
TAILQ_INSERT_TAIL(&ftick->tk_data->aw_head, ftick, tk_aw_link);
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
ftick->tk_refcount + 1);
mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED);
refcount_acquire(&ftick->tk_refcount);
TAILQ_INSERT_TAIL(&ftick->tk_data->aw_head, ftick, tk_aw_link);
}
static __inline__
void
static inline void
fuse_aw_remove(struct fuse_ticket *ftick)
{
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n",
ftick, ftick->tk_refcount);
mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED);
TAILQ_REMOVE(&ftick->tk_data->aw_head, ftick, tk_aw_link);
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n",
ftick, ftick->tk_refcount);
mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED);
TAILQ_REMOVE(&ftick->tk_data->aw_head, ftick, tk_aw_link);
#ifdef INVARIANTS
ftick->tk_aw_link.tqe_next = NULL;
ftick->tk_aw_link.tqe_prev = NULL;
ftick->tk_aw_link.tqe_next = NULL;
ftick->tk_aw_link.tqe_prev = NULL;
#endif
}
static __inline__
struct fuse_ticket *
static inline struct fuse_ticket *
fuse_aw_pop(struct fuse_data *data)
{
struct fuse_ticket *ftick = NULL;
struct fuse_ticket *ftick;
mtx_assert(&data->aw_mtx, MA_OWNED);
mtx_assert(&data->aw_mtx, MA_OWNED);
if ((ftick = TAILQ_FIRST(&data->aw_head))) {
fuse_aw_remove(ftick);
}
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n",
ftick, ftick ? ftick->tk_refcount : -1);
if ((ftick = TAILQ_FIRST(&data->aw_head)) != NULL)
fuse_aw_remove(ftick);
DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick,
ftick ? ftick->tk_refcount : -1);
return ftick;
return (ftick);
}
struct fuse_ticket *fuse_ticket_fetch(struct fuse_data *data);
@ -354,78 +342,71 @@ int fuse_ticket_drop(struct fuse_ticket *ftick);
void fuse_insert_callback(struct fuse_ticket *ftick, fuse_handler_t *handler);
void fuse_insert_message(struct fuse_ticket *ftick);
static __inline__
int
static inline bool
fuse_libabi_geq(struct fuse_data *data, uint32_t abi_maj, uint32_t abi_min)
{
return (data->fuse_libabi_major > abi_maj ||
(data->fuse_libabi_major == abi_maj && data->fuse_libabi_minor >= abi_min));
return (data->fuse_libabi_major > abi_maj ||
(data->fuse_libabi_major == abi_maj &&
data->fuse_libabi_minor >= abi_min));
}
struct fuse_data *fdata_alloc(struct cdev *dev, struct ucred *cred);
void fdata_trydestroy(struct fuse_data *data);
void fdata_set_dead(struct fuse_data *data);
static __inline__
int
static inline bool
fdata_get_dead(struct fuse_data *data)
{
return (data->dataflags & FSESS_DEAD);
return (data->dataflags & FSESS_DEAD);
}
struct fuse_dispatcher {
struct fuse_ticket *tick;
struct fuse_in_header *finh;
struct fuse_ticket *tick;
struct fuse_in_header *finh;
void *indata;
size_t iosize;
uint64_t nodeid;
int answ_stat;
void *answ;
void *indata;
size_t iosize;
uint64_t nodeid;
int answ_stat;
void *answ;
};
static __inline__
void
static inline void
fdisp_init(struct fuse_dispatcher *fdisp, size_t iosize)
{
DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, iosize=%zx\n", fdisp, iosize);
fdisp->iosize = iosize;
fdisp->tick = NULL;
DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, iosize=%zx\n", fdisp, iosize);
fdisp->iosize = iosize;
fdisp->tick = NULL;
}
static __inline__
void
static inline void
fdisp_destroy(struct fuse_dispatcher *fdisp)
{
DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, ftick=%p\n", fdisp, fdisp->tick);
fuse_ticket_drop(fdisp->tick);
DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, ftick=%p\n", fdisp, fdisp->tick);
fuse_ticket_drop(fdisp->tick);
#ifdef INVARIANTS
fdisp->tick = NULL;
fdisp->tick = NULL;
#endif
}
void fdisp_make(struct fuse_dispatcher *fdip, enum fuse_opcode op,
struct mount *mp, uint64_t nid, struct thread *td,
struct ucred *cred);
struct mount *mp, uint64_t nid, struct thread *td, struct ucred *cred);
void fdisp_make_pid(struct fuse_dispatcher *fdip, enum fuse_opcode op,
struct mount *mp, uint64_t nid, pid_t pid,
struct ucred *cred);
struct mount *mp, uint64_t nid, pid_t pid, struct ucred *cred);
void fdisp_make_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op,
struct vnode *vp, struct thread *td, struct ucred *cred);
struct vnode *vp, struct thread *td, struct ucred *cred);
int fdisp_wait_answ(struct fuse_dispatcher *fdip);
int fdisp_wait_answ(struct fuse_dispatcher *fdip);
static __inline__
int
static inline int
fdisp_simple_putget_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op,
struct vnode *vp, struct thread *td, struct ucred *cred)
struct vnode *vp, struct thread *td, struct ucred *cred)
{
DEBUGX(FUSE_DEBUG_IPC, "-> fdip=%p, opcode=%d, vp=%p\n", fdip, op, vp);
fdisp_make_vp(fdip, op, vp, td, cred);
return fdisp_wait_answ(fdip);
DEBUGX(FUSE_DEBUG_IPC, "-> fdip=%p, opcode=%d, vp=%p\n", fdip, op, vp);
fdisp_make_vp(fdip, op, vp, td, cred);
return (fdisp_wait_answ(fdip));
}
#endif /* _FUSE_IPC_H_ */

View File

@ -202,7 +202,7 @@ fuse_vnode_cmp(struct vnode *vp, void *nidp)
return (VTOI(vp) != *((uint64_t *)nidp));
}
static uint32_t __inline
static uint32_t inline
fuse_vnode_hash(uint64_t id)
{
return (fnv_32_buf(&id, sizeof(id), FNV1_32_INIT));

View File

@ -72,61 +72,56 @@
#define FN_DIRECTIO 0x00000200
struct fuse_vnode_data {
/** self **/
uint64_t nid;
/** self **/
uint64_t nid;
/** parent **/
/* XXXIP very likely to be stale, it's not updated in rename() */
uint64_t parent_nid;
/** parent **/
/* XXXIP very likely to be stale, it's not updated in rename() */
uint64_t parent_nid;
/** I/O **/
struct fuse_filehandle fufh[FUFH_MAXTYPE];
/** I/O **/
struct fuse_filehandle fufh[FUFH_MAXTYPE];
/** flags **/
uint32_t flag;
/** flags **/
uint32_t flag;
/** meta **/
bool valid_attr_cache;
struct vattr cached_attrs;
off_t filesize;
uint64_t nlookup;
enum vtype vtype;
/** meta **/
bool valid_attr_cache;
struct vattr cached_attrs;
off_t filesize;
uint64_t nlookup;
enum vtype vtype;
};
#define VTOFUD(vp) \
((struct fuse_vnode_data *)((vp)->v_data))
((struct fuse_vnode_data *)((vp)->v_data))
#define VTOI(vp) (VTOFUD(vp)->nid)
#define VTOVA(vp) \
(VTOFUD(vp)->valid_attr_cache ? \
&(VTOFUD(vp)->cached_attrs) : NULL)
(VTOFUD(vp)->valid_attr_cache ? \
&(VTOFUD(vp)->cached_attrs) : NULL)
#define VTOILLU(vp) ((uint64_t)(VTOFUD(vp) ? VTOI(vp) : 0))
#define FUSE_NULL_ID 0
extern struct vop_vector fuse_vnops;
static __inline void
static inline void
fuse_vnode_setparent(struct vnode *vp, struct vnode *dvp)
{
if (dvp != NULL && vp->v_type == VDIR) {
MPASS(dvp->v_type == VDIR);
VTOFUD(vp)->parent_nid = VTOI(dvp);
}
if (dvp != NULL && vp->v_type == VDIR) {
MPASS(dvp->v_type == VDIR);
VTOFUD(vp)->parent_nid = VTOI(dvp);
}
}
void fuse_vnode_destroy(struct vnode *vp);
int fuse_vnode_get(struct mount *mp,
struct fuse_entry_out *feo,
uint64_t nodeid,
struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp,
enum vtype vtyp);
int fuse_vnode_get(struct mount *mp, struct fuse_entry_out *feo,
uint64_t nodeid, struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, enum vtype vtyp);
void fuse_vnode_open(struct vnode *vp,
int32_t fuse_open_flags,
struct thread *td);
void fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags,
struct thread *td);
void fuse_vnode_refreshsize(struct vnode *vp, struct ucred *cred);

View File

@ -138,9 +138,9 @@ fuse_getdevice(const char *fspec, struct thread *td, struct cdev **fdevp)
int err;
/*
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible disk device.
*/
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible disk device.
*/
NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td);
if ((err = namei(ndp)) != 0)
@ -183,9 +183,9 @@ fuse_getdevice(const char *fspec, struct thread *td, struct cdev **fdevp)
}
}
/*
* according to coda code, no extra lock is needed --
* although in sys/vnode.h this field is marked "v"
*/
* according to coda code, no extra lock is needed --
* although in sys/vnode.h this field is marked "v"
*/
vrele(devvp);
if (!fdev->si_devsw ||
@ -199,8 +199,8 @@ fuse_getdevice(const char *fspec, struct thread *td, struct cdev **fdevp)
}
#define FUSE_FLAGOPT(fnam, fval) do { \
vfs_flagopt(opts, #fnam, &mntopts, fval); \
vfs_flagopt(opts, "__" #fnam, &__mntopts, fval); \
vfs_flagopt(opts, #fnam, &mntopts, fval); \
vfs_flagopt(opts, "__" #fnam, &__mntopts, fval); \
} while (0)
static int
@ -262,9 +262,9 @@ fuse_vfsop_mount(struct mount *mp)
return err;
/*
* With the help of underscored options the mount program
* can inform us from the flags it sets by default
*/
* With the help of underscored options the mount program
* can inform us from the flags it sets by default
*/
FUSE_FLAGOPT(allow_other, FSESS_DAEMON_CAN_SPY);
FUSE_FLAGOPT(push_symlinks_in, FSESS_PUSH_SYMLINKS_IN);
FUSE_FLAGOPT(default_permissions, FSESS_DEFAULT_PERMISSIONS);
@ -295,7 +295,7 @@ fuse_vfsop_mount(struct mount *mp)
}
fptmp = td->td_fpop;
td->td_fpop = fp;
err = devfs_get_cdevpriv((void **)&data);
err = devfs_get_cdevpriv((void **)&data);
td->td_fpop = fptmp;
fdrop(fp, td);
FUSE_LOCK();

View File

@ -210,14 +210,14 @@ uma_zone_t fuse_pbuf_zone;
/*
struct vnop_access_args {
struct vnode *a_vp;
struct vnode *a_vp;
#if VOP_ACCESS_TAKES_ACCMODE_T
accmode_t a_accmode;
accmode_t a_accmode;
#else
int a_mode;
int a_mode;
#endif
struct ucred *a_cred;
struct thread *a_td;
struct ucred *a_cred;
struct thread *a_td;
};
*/
static int
@ -699,11 +699,11 @@ fuse_vnop_lookup(struct vop_lookup_args *ap)
return EROFS;
}
/*
* We do access check prior to doing anything else only in the case
* when we are at fs root (we'd like to say, "we are at the first
* component", but that's not exactly the same... nevermind).
* See further comments at further access checks.
*/
* We do access check prior to doing anything else only in the case
* when we are at fs root (we'd like to say, "we are at the first
* component", but that's not exactly the same... nevermind).
* See further comments at further access checks.
*/
bzero(&facp, sizeof(facp));
if (vnode_isvroot(dvp)) { /* early permission check hack */
@ -1477,10 +1477,10 @@ fuse_vnop_rename(struct vop_rename_args *ap)
cache_purge(fvp);
/*
* FUSE library is expected to check if target directory is not
* under the source directory in the file system tree.
* Linux performs this check at VFS level.
*/
* FUSE library is expected to check if target directory is not
* under the source directory in the file system tree.
* Linux performs this check at VFS level.
*/
data = fuse_get_mpdata(vnode_mount(tdvp));
sx_xlock(&data->rename_lock);
err = fuse_internal_rename(fdvp, fcnp, tdvp, tcnp);
@ -1750,12 +1750,12 @@ fuse_vnop_symlink(struct vop_symlink_args *ap)
return ENXIO;
}
/*
* Unlike the other creator type calls, here we have to create a message
* where the name of the new entry comes first, and the data describing
* the entry comes second.
* Hence we can't rely on our handy fuse_internal_newentry() routine,
* but put together the message manually and just call the core part.
*/
* Unlike the other creator type calls, here we have to create a message
* where the name of the new entry comes first, and the data describing
* the entry comes second.
* Hence we can't rely on our handy fuse_internal_newentry() routine,
* but put together the message manually and just call the core part.
*/
len = strlen(target) + 1;
fdisp_init(&fdi, len + cnp->cn_namelen + 1);
@ -1802,10 +1802,10 @@ fuse_vnop_write(struct vop_write_args *ap)
/*
struct vnop_getpages_args {
struct vnode *a_vp;
vm_page_t *a_m;
int a_count;
int a_reqpage;
struct vnode *a_vp;
vm_page_t *a_m;
int a_count;
int a_reqpage;
};
*/
static int
@ -1930,12 +1930,12 @@ out:
/*
struct vnop_putpages_args {
struct vnode *a_vp;
vm_page_t *a_m;
int a_count;
int a_sync;
int *a_rtvals;
vm_ooffset_t a_offset;
struct vnode *a_vp;
vm_page_t *a_m;
int a_count;
int a_sync;
int *a_rtvals;
vm_ooffset_t a_offset;
};
*/
static int
@ -2025,14 +2025,14 @@ static const char extattr_namespace_separator = '.';
/*
struct vop_getextattr_args {
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
const char *a_name;
struct uio *a_uio;
size_t *a_size;
struct ucred *a_cred;
struct thread *a_td;
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
const char *a_name;
struct uio *a_uio;
size_t *a_size;
struct ucred *a_cred;
struct thread *a_td;
};
*/
static int
@ -2107,13 +2107,13 @@ out:
/*
struct vop_setextattr_args {
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
const char *a_name;
struct uio *a_uio;
struct ucred *a_cred;
struct thread *a_td;
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
const char *a_name;
struct uio *a_uio;
struct ucred *a_cred;
struct thread *a_td;
};
*/
static int
@ -2233,13 +2233,13 @@ fuse_xattrlist_convert(char *prefix, const char *list, int list_len,
/*
struct vop_listextattr_args {
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
struct uio *a_uio;
size_t *a_size;
struct ucred *a_cred;
struct thread *a_td;
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
struct uio *a_uio;
size_t *a_size;
struct ucred *a_cred;
struct thread *a_td;
};
*/
static int
@ -2347,12 +2347,12 @@ out:
/*
struct vop_deleteextattr_args {
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
const char *a_name;
struct ucred *a_cred;
struct thread *a_td;
struct vop_generic_args a_gen;
struct vnode *a_vp;
int a_attrnamespace;
const char *a_name;
struct ucred *a_cred;
struct thread *a_td;
};
*/
static int
@ -2402,7 +2402,7 @@ fuse_vnop_deleteextattr(struct vop_deleteextattr_args *ap)
/*
struct vnop_print_args {
struct vnode *a_vp;
struct vnode *a_vp;
};
*/
static int