Date: Wed, 20 Feb 2019 02:49:26 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344334 - head/sys/fs/fuse Message-ID: <201902200249.x1K2nQk8079803@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Wed Feb 20 02:49:26 2019 New Revision: 344334 URL: https://svnweb.freebsd.org/changeset/base/344334 Log: 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. Modified: head/sys/fs/fuse/fuse.h head/sys/fs/fuse/fuse_device.c head/sys/fs/fuse/fuse_file.c head/sys/fs/fuse/fuse_file.h head/sys/fs/fuse/fuse_internal.h head/sys/fs/fuse/fuse_ipc.c head/sys/fs/fuse/fuse_ipc.h head/sys/fs/fuse/fuse_node.c head/sys/fs/fuse/fuse_node.h head/sys/fs/fuse/fuse_vfsops.c head/sys/fs/fuse/fuse_vnops.c Modified: head/sys/fs/fuse/fuse.h ============================================================================== --- head/sys/fs/fuse/fuse.h Wed Feb 20 02:48:59 2019 (r344333) +++ head/sys/fs/fuse/fuse.h Wed Feb 20 02:49:26 2019 (r344334) @@ -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); Modified: head/sys/fs/fuse/fuse_device.c ============================================================================== --- head/sys/fs/fuse/fuse_device.c Wed Feb 20 02:48:59 2019 (r344333) +++ head/sys/fs/fuse/fuse_device.c Wed Feb 20 02:49:26 2019 (r344334) @@ -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", Modified: head/sys/fs/fuse/fuse_file.c ============================================================================== --- head/sys/fs/fuse/fuse_file.c Wed Feb 20 02:48:59 2019 (r344333) +++ head/sys/fs/fuse/fuse_file.c Wed Feb 20 02:49:26 2019 (r344334) @@ -91,11 +91,8 @@ SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLF &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 fu } 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; Modified: head/sys/fs/fuse/fuse_file.h ============================================================================== --- head/sys/fs/fuse/fuse_file.h Wed Feb 20 02:48:59 2019 (r344333) +++ head/sys/fs/fuse/fuse_file.h Wed Feb 20 02:49:26 2019 (r344334) @@ -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); Modified: head/sys/fs/fuse/fuse_internal.h ============================================================================== --- head/sys/fs/fuse/fuse_internal.h Wed Feb 20 02:48:59 2019 (r344333) +++ head/sys/fs/fuse/fuse_internal.h Wed Feb 20 02:49:26 2019 (r344334) @@ -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 * 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(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_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(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_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 */ Modified: head/sys/fs/fuse/fuse_ipc.c ============================================================================== --- head/sys/fs/fuse/fuse_ipc.c Wed Feb 20 02:48:59 2019 (r344333) +++ head/sys/fs/fuse/fuse_ipc.c Wed Feb 20 02:49:26 2019 (r344334) @@ -91,19 +91,11 @@ static struct fuse_ticket *fticket_alloc(struct fuse_d 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, struc } 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); Modified: head/sys/fs/fuse/fuse_ipc.h ============================================================================== --- head/sys/fs/fuse/fuse_ipc.h Wed Feb 20 02:48:59 2019 (r344333) +++ head/sys/fs/fuse/fuse_ipc.h Wed Feb 20 02:49:26 2019 (r344334) @@ -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; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902200249.x1K2nQk8079803>