Browse Source

Merge pull request #969 from trapexit/node-size

Reduce struct node size
pull/972/head
trapexit 3 years ago
committed by GitHub
parent
commit
50ede1ba97
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      libfuse/Makefile
  2. 101
      libfuse/include/fuse_lowlevel.h
  3. 112
      libfuse/lib/crc32b.c
  4. 32
      libfuse/lib/crc32b.h
  5. 417
      libfuse/lib/fuse.c
  6. 7
      libfuse/lib/fuse_i.h
  7. 270
      libfuse/lib/fuse_lowlevel.c

5
libfuse/Makefile

@ -32,14 +32,15 @@ INSTALLMAN1DIR = $(DESTDIR)$(MAN1DIR)
AR ?= ar AR ?= ar
SRC = \ SRC = \
lib/fuse_node.c \
lib/buffer.c \ lib/buffer.c \
lib/fuse_dirents.c \
lib/crc32b.c \
lib/fuse.c \ lib/fuse.c \
lib/fuse_dirents.c \
lib/fuse_kern_chan.c \ lib/fuse_kern_chan.c \
lib/fuse_loop_mt.c \ lib/fuse_loop_mt.c \
lib/fuse_lowlevel.c \ lib/fuse_lowlevel.c \
lib/fuse_mt.c \ lib/fuse_mt.c \
lib/fuse_node.c \
lib/fuse_opt.c \ lib/fuse_opt.c \
lib/fuse_session.c \ lib/fuse_session.c \
lib/fuse_signals.c \ lib/fuse_signals.c \

101
libfuse/include/fuse_lowlevel.h

@ -43,9 +43,6 @@ EXTERN_C_BEGIN
/** The node ID of the root inode */ /** The node ID of the root inode */
#define FUSE_ROOT_ID 1 #define FUSE_ROOT_ID 1
/** Inode number type */
typedef uint64_t fuse_ino_t;
/** Request pointer type */ /** Request pointer type */
typedef struct fuse_req *fuse_req_t; typedef struct fuse_req *fuse_req_t;
@ -74,7 +71,7 @@ struct fuse_entry_param
* ino the kernel may cache negative entries for entry_timeout * ino the kernel may cache negative entries for entry_timeout
* seconds. * seconds.
*/ */
fuse_ino_t ino;
uint64_t ino;
/** Generation number for this entry. /** Generation number for this entry.
* *
@ -122,7 +119,7 @@ struct fuse_ctx
struct fuse_forget_data struct fuse_forget_data
{ {
fuse_ino_t ino;
uint64_t ino;
uint64_t nlookup; uint64_t nlookup;
}; };
@ -186,7 +183,7 @@ struct fuse_lowlevel_ops
* @param parent inode number of the parent directory * @param parent inode number of the parent directory
* @param name the name to look up * @param name the name to look up
*/ */
void (*lookup)(fuse_req_t req, fuse_ino_t parent, const char *name);
void (*lookup)(fuse_req_t req, uint64_t parent, const char *name);
/** /**
* Forget about an inode * Forget about an inode
@ -224,7 +221,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param nlookup the number of lookups to forget * @param nlookup the number of lookups to forget
*/ */
void (*forget)(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup);
void (*forget)(fuse_req_t req, uint64_t ino, uint64_t nlookup);
/** /**
* Get file attributes * Get file attributes
@ -237,7 +234,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param fi for future use, currently always NULL * @param fi for future use, currently always NULL
*/ */
void (*getattr)(fuse_req_t req, fuse_ino_t ino,
void (*getattr)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -267,7 +264,7 @@ struct fuse_lowlevel_ops
* Changed in version 2.5: * Changed in version 2.5:
* file information filled in for ftruncate * file information filled in for ftruncate
*/ */
void (*setattr)(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
void (*setattr)(fuse_req_t req, uint64_t ino, struct stat *attr,
int to_set, fuse_file_info_t *fi); int to_set, fuse_file_info_t *fi);
/** /**
@ -280,7 +277,7 @@ struct fuse_lowlevel_ops
* @param req request handle * @param req request handle
* @param ino the inode number * @param ino the inode number
*/ */
void (*readlink)(fuse_req_t req, fuse_ino_t ino);
void (*readlink)(fuse_req_t req, uint64_t ino);
/** /**
* Create file node * Create file node
@ -298,7 +295,7 @@ struct fuse_lowlevel_ops
* @param mode file type and mode with which to create the new file * @param mode file type and mode with which to create the new file
* @param rdev the device number (only valid if created file is a device) * @param rdev the device number (only valid if created file is a device)
*/ */
void (*mknod)(fuse_req_t req, fuse_ino_t parent, const char *name,
void (*mknod)(fuse_req_t req, uint64_t parent, const char *name,
mode_t mode, dev_t rdev); mode_t mode, dev_t rdev);
/** /**
@ -313,7 +310,7 @@ struct fuse_lowlevel_ops
* @param name to create * @param name to create
* @param mode with which to create the new file * @param mode with which to create the new file
*/ */
void (*mkdir)(fuse_req_t req, fuse_ino_t parent, const char *name,
void (*mkdir)(fuse_req_t req, uint64_t parent, const char *name,
mode_t mode); mode_t mode);
/** /**
@ -331,7 +328,7 @@ struct fuse_lowlevel_ops
* @param parent inode number of the parent directory * @param parent inode number of the parent directory
* @param name to remove * @param name to remove
*/ */
void (*unlink)(fuse_req_t req, fuse_ino_t parent, const char *name);
void (*unlink)(fuse_req_t req, uint64_t parent, const char *name);
/** /**
* Remove a directory * Remove a directory
@ -348,7 +345,7 @@ struct fuse_lowlevel_ops
* @param parent inode number of the parent directory * @param parent inode number of the parent directory
* @param name to remove * @param name to remove
*/ */
void (*rmdir)(fuse_req_t req, fuse_ino_t parent, const char *name);
void (*rmdir)(fuse_req_t req, uint64_t parent, const char *name);
/** /**
* Create a symbolic link * Create a symbolic link
@ -362,7 +359,7 @@ struct fuse_lowlevel_ops
* @param parent inode number of the parent directory * @param parent inode number of the parent directory
* @param name to create * @param name to create
*/ */
void (*symlink)(fuse_req_t req, const char *link, fuse_ino_t parent,
void (*symlink)(fuse_req_t req, const char *link, uint64_t parent,
const char *name); const char *name);
/** Rename a file /** Rename a file
@ -382,8 +379,8 @@ struct fuse_lowlevel_ops
* @param newparent inode number of the new parent directory * @param newparent inode number of the new parent directory
* @param newname new name * @param newname new name
*/ */
void (*rename)(fuse_req_t req, fuse_ino_t parent, const char *name,
fuse_ino_t newparent, const char *newname);
void (*rename)(fuse_req_t req, uint64_t parent, const char *name,
uint64_t newparent, const char *newname);
/** /**
* Create a hard link * Create a hard link
@ -397,7 +394,7 @@ struct fuse_lowlevel_ops
* @param newparent inode number of the new parent directory * @param newparent inode number of the new parent directory
* @param newname new name to create * @param newname new name to create
*/ */
void (*link)(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
void (*link)(fuse_req_t req, uint64_t ino, uint64_t newparent,
const char *newname); const char *newname);
/** /**
@ -425,7 +422,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param fi file information * @param fi file information
*/ */
void (*open)(fuse_req_t req, fuse_ino_t ino,
void (*open)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -453,7 +450,7 @@ struct fuse_lowlevel_ops
* @param off offset to read from * @param off offset to read from
* @param fi file information * @param fi file information
*/ */
void (*read)(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
void (*read)(fuse_req_t req, uint64_t ino, size_t size, off_t off,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -479,7 +476,7 @@ struct fuse_lowlevel_ops
* @param off offset to write to * @param off offset to write to
* @param fi file information * @param fi file information
*/ */
void (*write)(fuse_req_t req, fuse_ino_t ino, const char *buf,
void (*write)(fuse_req_t req, uint64_t ino, const char *buf,
size_t size, off_t off, fuse_file_info_t *fi); size_t size, off_t off, fuse_file_info_t *fi);
/** /**
@ -511,7 +508,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param fi file information * @param fi file information
*/ */
void (*flush)(fuse_req_t req, fuse_ino_t ino,
void (*flush)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -538,7 +535,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param fi file information * @param fi file information
*/ */
void (*release)(fuse_req_t req, fuse_ino_t ino,
void (*release)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -555,7 +552,7 @@ struct fuse_lowlevel_ops
* @param datasync flag indicating if only data should be flushed * @param datasync flag indicating if only data should be flushed
* @param fi file information * @param fi file information
*/ */
void (*fsync)(fuse_req_t req, fuse_ino_t ino, int datasync,
void (*fsync)(fuse_req_t req, uint64_t ino, int datasync,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -579,7 +576,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param fi file information * @param fi file information
*/ */
void (*opendir)(fuse_req_t req, fuse_ino_t ino,
void (*opendir)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -603,10 +600,10 @@ struct fuse_lowlevel_ops
* @param off offset to continue reading the directory stream * @param off offset to continue reading the directory stream
* @param fi file information * @param fi file information
*/ */
void (*readdir)(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
void (*readdir)(fuse_req_t req, uint64_t ino, size_t size, off_t off,
fuse_file_info_t *llffi); fuse_file_info_t *llffi);
void (*readdir_plus)(fuse_req_t req, fuse_ino_t ino,
void (*readdir_plus)(fuse_req_t req, uint64_t ino,
size_t size, off_t off, size_t size, off_t off,
fuse_file_info_t *ffi); fuse_file_info_t *ffi);
@ -626,7 +623,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param fi file information * @param fi file information
*/ */
void (*releasedir)(fuse_req_t req, fuse_ino_t ino,
void (*releasedir)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -646,7 +643,7 @@ struct fuse_lowlevel_ops
* @param datasync flag indicating if only data should be flushed * @param datasync flag indicating if only data should be flushed
* @param fi file information * @param fi file information
*/ */
void (*fsyncdir)(fuse_req_t req, fuse_ino_t ino, int datasync,
void (*fsyncdir)(fuse_req_t req, uint64_t ino, int datasync,
fuse_file_info_t *fi); fuse_file_info_t *fi);
/** /**
@ -659,7 +656,7 @@ struct fuse_lowlevel_ops
* @param req request handle * @param req request handle
* @param ino the inode number, zero means "undefined" * @param ino the inode number, zero means "undefined"
*/ */
void (*statfs)(fuse_req_t req, fuse_ino_t ino);
void (*statfs)(fuse_req_t req, uint64_t ino);
/** /**
* Set an extended attribute * Set an extended attribute
@ -667,7 +664,7 @@ struct fuse_lowlevel_ops
* Valid replies: * Valid replies:
* fuse_reply_err * fuse_reply_err
*/ */
void (*setxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
void (*setxattr)(fuse_req_t req, uint64_t ino, const char *name,
const char *value, size_t size, int flags); const char *value, size_t size, int flags);
/** /**
@ -693,7 +690,7 @@ struct fuse_lowlevel_ops
* @param name of the extended attribute * @param name of the extended attribute
* @param size maximum size of the value to send * @param size maximum size of the value to send
*/ */
void (*getxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
void (*getxattr)(fuse_req_t req, uint64_t ino, const char *name,
size_t size); size_t size);
/** /**
@ -719,7 +716,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param size maximum size of the list to send * @param size maximum size of the list to send
*/ */
void (*listxattr)(fuse_req_t req, fuse_ino_t ino, size_t size);
void (*listxattr)(fuse_req_t req, uint64_t ino, size_t size);
/** /**
* Remove an extended attribute * Remove an extended attribute
@ -731,7 +728,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param name of the extended attribute * @param name of the extended attribute
*/ */
void (*removexattr)(fuse_req_t req, fuse_ino_t ino, const char *name);
void (*removexattr)(fuse_req_t req, uint64_t ino, const char *name);
/** /**
* Check file access permissions * Check file access permissions
@ -751,7 +748,7 @@ struct fuse_lowlevel_ops
* @param ino the inode number * @param ino the inode number
* @param mask requested access mode * @param mask requested access mode
*/ */
void (*access)(fuse_req_t req, fuse_ino_t ino, int mask);
void (*access)(fuse_req_t req, uint64_t ino, int mask);
/** /**
* Create and open a file * Create and open a file
@ -786,7 +783,7 @@ struct fuse_lowlevel_ops
* @param mode file type and mode with which to create the new file * @param mode file type and mode with which to create the new file
* @param fi file information * @param fi file information
*/ */
void (*create)(fuse_req_t req, fuse_ino_t parent, const char *name,
void (*create)(fuse_req_t req, uint64_t parent, const char *name,
mode_t mode, fuse_file_info_t *fi); mode_t mode, fuse_file_info_t *fi);
/** /**
@ -803,7 +800,7 @@ struct fuse_lowlevel_ops
* @param fi file information * @param fi file information
* @param lock the region/type to test * @param lock the region/type to test
*/ */
void (*getlk)(fuse_req_t req, fuse_ino_t ino,
void (*getlk)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi, struct flock *lock); fuse_file_info_t *fi, struct flock *lock);
/** /**
@ -830,7 +827,7 @@ struct fuse_lowlevel_ops
* @param lock the region/type to set * @param lock the region/type to set
* @param sleep locking operation may sleep * @param sleep locking operation may sleep
*/ */
void (*setlk)(fuse_req_t req, fuse_ino_t ino,
void (*setlk)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi, fuse_file_info_t *fi,
struct flock *lock, int sleep); struct flock *lock, int sleep);
@ -851,7 +848,7 @@ struct fuse_lowlevel_ops
* @param blocksize unit of block index * @param blocksize unit of block index
* @param idx block index within file * @param idx block index within file
*/ */
void (*bmap)(fuse_req_t req, fuse_ino_t ino, size_t blocksize,
void (*bmap)(fuse_req_t req, uint64_t ino, size_t blocksize,
uint64_t idx); uint64_t idx);
/** /**
@ -881,7 +878,7 @@ struct fuse_lowlevel_ops
* @param in_bufsz number of fetched bytes * @param in_bufsz number of fetched bytes
* @param out_bufsz maximum size of output data * @param out_bufsz maximum size of output data
*/ */
void (*ioctl)(fuse_req_t req, fuse_ino_t ino, unsigned long cmd, void *arg,
void (*ioctl)(fuse_req_t req, uint64_t ino, unsigned long cmd, void *arg,
fuse_file_info_t *fi, unsigned flags, fuse_file_info_t *fi, unsigned flags,
const void *in_buf, uint32_t in_bufsz, uint32_t out_bufsz); const void *in_buf, uint32_t in_bufsz, uint32_t out_bufsz);
@ -912,7 +909,7 @@ struct fuse_lowlevel_ops
* @param ph poll handle to be used for notification * @param ph poll handle to be used for notification
*/ */
void (*poll)(fuse_req_t req, void (*poll)(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi, fuse_file_info_t *fi,
fuse_pollhandle_t *ph); fuse_pollhandle_t *ph);
@ -942,7 +939,7 @@ struct fuse_lowlevel_ops
* @param off offset to write to * @param off offset to write to
* @param fi file information * @param fi file information
*/ */
void (*write_buf)(fuse_req_t req, fuse_ino_t ino,
void (*write_buf)(fuse_req_t req, uint64_t ino,
struct fuse_bufvec *bufv, off_t off, struct fuse_bufvec *bufv, off_t off,
fuse_file_info_t *fi); fuse_file_info_t *fi);
@ -960,7 +957,7 @@ struct fuse_lowlevel_ops
* @param offset the offset supplied to fuse_lowlevel_notify_retrieve() * @param offset the offset supplied to fuse_lowlevel_notify_retrieve()
* @param bufv the buffer containing the returned data * @param bufv the buffer containing the returned data
*/ */
void (*retrieve_reply)(fuse_req_t req, void *cookie, fuse_ino_t ino,
void (*retrieve_reply)(fuse_req_t req, void *cookie, uint64_t ino,
off_t offset, struct fuse_bufvec *bufv); off_t offset, struct fuse_bufvec *bufv);
/** /**
@ -996,7 +993,7 @@ struct fuse_lowlevel_ops
* @param fi file information * @param fi file information
* @param op the locking operation, see flock(2) * @param op the locking operation, see flock(2)
*/ */
void (*flock)(fuse_req_t req, fuse_ino_t ino,
void (*flock)(fuse_req_t req, uint64_t ino,
fuse_file_info_t *fi, int op); fuse_file_info_t *fi, int op);
/** /**
@ -1016,7 +1013,7 @@ struct fuse_lowlevel_ops
* @param mode determines the operation to be performed on the given range, * @param mode determines the operation to be performed on the given range,
* see fallocate(2) * see fallocate(2)
*/ */
void (*fallocate)(fuse_req_t req, fuse_ino_t ino, int mode,
void (*fallocate)(fuse_req_t req, uint64_t ino, int mode,
off_t offset, off_t length, fuse_file_info_t *fi); off_t offset, off_t length, fuse_file_info_t *fi);
/** /**
@ -1056,10 +1053,10 @@ struct fuse_lowlevel_ops
* @param flags passed along with the copy_file_range() syscall * @param flags passed along with the copy_file_range() syscall
*/ */
void (*copy_file_range)(fuse_req_t req, void (*copy_file_range)(fuse_req_t req,
fuse_ino_t ino_in,
uint64_t ino_in,
off_t off_in, off_t off_in,
fuse_file_info_t *fi_in, fuse_file_info_t *fi_in,
fuse_ino_t ino_out,
uint64_t ino_out,
off_t off_out, off_t off_out,
fuse_file_info_t *fi_out, fuse_file_info_t *fi_out,
size_t len, size_t len,
@ -1345,7 +1342,7 @@ int fuse_lowlevel_notify_poll(fuse_pollhandle_t *ph);
* @param len the amount of cache to invalidate or 0 for all * @param len the amount of cache to invalidate or 0 for all
* @return zero for success, -errno for failure * @return zero for success, -errno for failure
*/ */
int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, uint64_t ino,
off_t off, off_t len); off_t off, off_t len);
/** /**
@ -1362,7 +1359,7 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
* @param namelen strlen() of file name * @param namelen strlen() of file name
* @return zero for success, -errno for failure * @return zero for success, -errno for failure
*/ */
int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, uint64_t parent,
const char *name, size_t namelen); const char *name, size_t namelen);
/** /**
@ -1382,7 +1379,7 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
* @return zero for success, -errno for failure * @return zero for success, -errno for failure
*/ */
int fuse_lowlevel_notify_delete(struct fuse_chan *ch, int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
fuse_ino_t parent, fuse_ino_t child,
uint64_t parent, uint64_t child,
const char *name, size_t namelen); const char *name, size_t namelen);
/** /**
@ -1406,7 +1403,7 @@ int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
* @param flags flags controlling the copy * @param flags flags controlling the copy
* @return zero for success, -errno for failure * @return zero for success, -errno for failure
*/ */
int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
int fuse_lowlevel_notify_store(struct fuse_chan *ch, uint64_t ino,
off_t offset, struct fuse_bufvec *bufv, off_t offset, struct fuse_bufvec *bufv,
enum fuse_buf_copy_flags flags); enum fuse_buf_copy_flags flags);
/** /**
@ -1434,7 +1431,7 @@ int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
* @param cookie user data to supply to the reply callback * @param cookie user data to supply to the reply callback
* @return zero for success, -errno for failure * @return zero for success, -errno for failure
*/ */
int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, uint64_t ino,
size_t size, off_t offset, void *cookie); size_t size, off_t offset, void *cookie);

112
libfuse/lib/crc32b.c

@ -0,0 +1,112 @@
/*
ISC License
Copyright (c) 2021, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "crc32b.h"
static
const
crc32b_t CRC32BTABLE[256] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
};
crc32b_t
crc32b_start(void)
{
return 0xFFFFFFFF;
}
crc32b_t
crc32b_continue(const void *buf_,
const crc32b_t len_,
const crc32b_t crc_)
{
int i;
char *buf;
crc32b_t crc;
crc = crc_;
buf = (char*)buf_;
for(i = 0; i < len_; i++)
{
crc = (CRC32BTABLE[(crc ^ buf[i]) & 0xFFL] ^ (crc >> 8));
}
return crc;
}
crc32b_t
crc32b_finish(const crc32b_t crc_)
{
return (crc_ ^ 0xFFFFFFFF);
}
crc32b_t
crc32b(const void *buf_,
const crc32b_t len_)
{
crc32b_t crc;
crc = crc32b_start();
crc = crc32b_continue(buf_,len_,crc);
crc = crc32b_finish(crc);
return crc;
}

32
libfuse/lib/crc32b.h

@ -0,0 +1,32 @@
/*
ISC License
Copyright (c) 2021, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef CRC32B_H_INCLUDED
#define CRC32B_H_INCLUDED
typedef unsigned int crc32b_t;
crc32b_t crc32b_start(void);
crc32b_t crc32b_continue(const void *buf,
const crc32b_t len,
const crc32b_t crc);
crc32b_t crc32b_finish(const crc32b_t crc);
crc32b_t crc32b(const void *buf, crc32b_t len);
#endif

417
libfuse/lib/fuse.c

@ -9,9 +9,11 @@
/* For pthread_rwlock_t */ /* For pthread_rwlock_t */
#define _GNU_SOURCE #define _GNU_SOURCE
#include "crc32b.h"
#include "fuse_node.h" #include "fuse_node.h"
#include "lfmp.h"
#include "khash.h"
#include "kvec.h" #include "kvec.h"
#include "lfmp.h"
#include "config.h" #include "config.h"
#include "fuse_i.h" #include "fuse_i.h"
@ -75,11 +77,11 @@ struct lock_queue_element
{ {
struct lock_queue_element *next; struct lock_queue_element *next;
pthread_cond_t cond; pthread_cond_t cond;
fuse_ino_t nodeid1;
uint64_t nodeid1;
const char *name1; const char *name1;
char **path1; char **path1;
struct node **wnode1; struct node **wnode1;
fuse_ino_t nodeid2;
uint64_t nodeid2;
const char *name2; const char *name2;
char **path2; char **path2;
struct node **wnode2; struct node **wnode2;
@ -117,13 +119,19 @@ struct remembered_node_t
time_t time; time_t time;
}; };
typedef struct nodeid_gen_t nodeid_gen_t;
struct nodeid_gen_t
{
uint64_t nodeid;
uint64_t generation;
};
struct fuse struct fuse
{ {
struct fuse_session *se; struct fuse_session *se;
struct node_table name_table; struct node_table name_table;
struct node_table id_table; struct node_table id_table;
fuse_ino_t ctr;
uint64_t generation;
nodeid_gen_t nodeid_gen;
unsigned int hidectr; unsigned int hidectr;
pthread_mutex_t lock; pthread_mutex_t lock;
struct fuse_config conf; struct fuse_config conf;
@ -149,22 +157,23 @@ struct node
{ {
struct node *name_next; struct node *name_next;
struct node *id_next; struct node *id_next;
fuse_ino_t nodeid;
uint64_t generation;
int refctr;
struct node *parent;
uint64_t nodeid;
char *name; char *name;
struct node *parent;
uint64_t nlookup; uint64_t nlookup;
int open_count;
struct lock *locks;
uint32_t refctr;
uint32_t open_count;
uint64_t hidden_fh; uint64_t hidden_fh;
char is_hidden;
int treelock;
ino_t ino;
off_t size;
struct timespec mtim;
char stat_cache_valid;
int32_t treelock;
struct lock *locks;
uint32_t stat_crc32b;
char inline_name[32]; char inline_name[32];
uint8_t is_hidden:1;
uint8_t is_stat_cache_valid:1;
}; };
@ -188,6 +197,38 @@ static pthread_key_t fuse_context_key;
static pthread_mutex_t fuse_context_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t fuse_context_lock = PTHREAD_MUTEX_INITIALIZER;
static int fuse_context_ref; static int fuse_context_ref;
/*
Why was the nodeid:generation logic simplified?
nodeid is uint64_t: max value of 18446744073709551616
If nodes were created at a rate of 1048576 per second it would take
over 500 thousand years to roll over. I'm fine with risking that.
*/
static
uint64_t
generate_nodeid(nodeid_gen_t *ng_)
{
ng_->nodeid++;
return ng_->nodeid;
}
static
char*
filename_strdup(struct fuse *f_,
const char *fn_)
{
return strdup(fn_);
}
static
void
filename_free(struct fuse *f_,
char *fn_)
{
free(fn_);
}
static static
void void
list_add(struct list_head *new, list_add(struct list_head *new,
@ -248,7 +289,7 @@ free_node_mem(struct fuse *f,
static static
size_t size_t
id_hash(struct fuse *f, id_hash(struct fuse *f,
fuse_ino_t ino)
uint64_t ino)
{ {
uint64_t hash = ((uint32_t)ino * 2654435761U) % f->id_table.size; uint64_t hash = ((uint32_t)ino * 2654435761U) % f->id_table.size;
uint64_t oldhash = hash % (f->id_table.size / 2); uint64_t oldhash = hash % (f->id_table.size / 2);
@ -262,7 +303,7 @@ id_hash(struct fuse *f,
static static
struct node* struct node*
get_node_nocheck(struct fuse *f, get_node_nocheck(struct fuse *f,
fuse_ino_t nodeid)
uint64_t nodeid)
{ {
size_t hash = id_hash(f,nodeid); size_t hash = id_hash(f,nodeid);
struct node *node; struct node *node;
@ -277,7 +318,7 @@ get_node_nocheck(struct fuse *f,
static static
struct node* struct node*
get_node(struct fuse *f, get_node(struct fuse *f,
const fuse_ino_t nodeid)
const uint64_t nodeid)
{ {
struct node *node = get_node_nocheck(f,nodeid); struct node *node = get_node_nocheck(f,nodeid);
@ -306,6 +347,21 @@ remove_remembered_node(struct fuse *f_,
} }
} }
static
uint32_t
stat_crc32b(const struct stat *st_)
{
uint32_t crc;
crc = crc32b_start();
crc = crc32b_continue(&st_->st_ino,sizeof(st_->st_ino),crc);
crc = crc32b_continue(&st_->st_size,sizeof(st_->st_size),crc);
crc = crc32b_continue(&st_->st_mtim,sizeof(st_->st_mtim),crc);
crc = crc32b_finish(crc);
return crc;
}
#ifndef CLOCK_MONOTONIC #ifndef CLOCK_MONOTONIC
# define CLOCK_MONOTONIC CLOCK_REALTIME # define CLOCK_MONOTONIC CLOCK_REALTIME
#endif #endif
@ -337,7 +393,7 @@ free_node(struct fuse *f_,
struct node *node_) struct node *node_)
{ {
if(node_->name != node_->inline_name) if(node_->name != node_->inline_name)
free(node_->name);
filename_free(f_,node_->name);
if(node_->is_hidden) if(node_->is_hidden)
fuse_fs_free_hide(f_->fs,node_->hidden_fh); fuse_fs_free_hide(f_->fs,node_->hidden_fh);
@ -486,7 +542,7 @@ hash_id(struct fuse *f,
static static
size_t size_t
name_hash(struct fuse *f, name_hash(struct fuse *f,
fuse_ino_t parent,
uint64_t parent,
const char *name) const char *name)
{ {
uint64_t hash = parent; uint64_t hash = parent;
@ -554,7 +610,7 @@ unhash_name(struct fuse *f,
node->name_next = NULL; node->name_next = NULL;
unref_node(f,node->parent); unref_node(f,node->parent);
if(node->name != node->inline_name) if(node->name != node->inline_name)
free(node->name);
filename_free(f,node->name);
node->name = NULL; node->name = NULL;
node->parent = NULL; node->parent = NULL;
f->name_table.use--; f->name_table.use--;
@ -612,7 +668,7 @@ static
int int
hash_name(struct fuse *f, hash_name(struct fuse *f,
struct node *node, struct node *node,
fuse_ino_t parentid,
uint64_t parentid,
const char *name) const char *name)
{ {
size_t hash = name_hash(f,parentid,name); size_t hash = name_hash(f,parentid,name);
@ -624,7 +680,7 @@ hash_name(struct fuse *f,
} }
else else
{ {
node->name = strdup(name);
node->name = filename_strdup(f,name);
if(node->name == NULL) if(node->name == NULL)
return -1; return -1;
} }
@ -686,26 +742,10 @@ rand64(void)
return rv; return rv;
} }
static
fuse_ino_t
next_id(struct fuse *f)
{
do
{
f->ctr = ((f->ctr + 1) & UINT64_MAX);
if(f->ctr == 0)
f->generation++;
} while((f->ctr == 0) ||
(f->ctr == FUSE_UNKNOWN_INO) ||
(get_node_nocheck(f,f->ctr) != NULL));
return f->ctr;
}
static static
struct node* struct node*
lookup_node(struct fuse *f, lookup_node(struct fuse *f,
fuse_ino_t parent,
uint64_t parent,
const char *name) const char *name)
{ {
size_t hash; size_t hash;
@ -731,7 +771,7 @@ inc_nlookup(struct node *node)
static static
struct node* struct node*
find_node(struct fuse *f, find_node(struct fuse *f,
fuse_ino_t parent,
uint64_t parent,
const char *name) const char *name)
{ {
struct node *node; struct node *node;
@ -748,8 +788,7 @@ find_node(struct fuse *f,
if(node == NULL) if(node == NULL)
goto out_err; goto out_err;
node->nodeid = next_id(f);
node->generation = f->generation;
node->nodeid = generate_nodeid(&f->nodeid_gen);
if(f->conf.remember) if(f->conf.remember)
inc_nlookup(node); inc_nlookup(node);
@ -814,7 +853,7 @@ add_name(char **buf,
static static
void void
unlock_path(struct fuse *f, unlock_path(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
struct node *wnode, struct node *wnode,
struct node *end) struct node *end)
{ {
@ -840,7 +879,7 @@ unlock_path(struct fuse *f,
static static
int int
try_get_path(struct fuse *f, try_get_path(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
const char *name, const char *name,
char **path, char **path,
struct node **wnodep, struct node **wnodep,
@ -1072,7 +1111,7 @@ wait_path(struct fuse *f,
static static
int int
get_path_common(struct fuse *f, get_path_common(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
const char *name, const char *name,
char **path, char **path,
struct node **wnode) struct node **wnode)
@ -1100,7 +1139,7 @@ get_path_common(struct fuse *f,
static static
int int
get_path(struct fuse *f, get_path(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
char **path) char **path)
{ {
return get_path_common(f,nodeid,NULL,path,NULL); return get_path_common(f,nodeid,NULL,path,NULL);
@ -1109,7 +1148,7 @@ get_path(struct fuse *f,
static static
int int
get_path_name(struct fuse *f, get_path_name(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
const char *name, const char *name,
char **path) char **path)
{ {
@ -1119,7 +1158,7 @@ get_path_name(struct fuse *f,
static static
int int
get_path_wrlock(struct fuse *f, get_path_wrlock(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
const char *name, const char *name,
char **path, char **path,
struct node **wnode) struct node **wnode)
@ -1130,9 +1169,9 @@ get_path_wrlock(struct fuse *f,
static static
int int
try_get_path2(struct fuse *f, try_get_path2(struct fuse *f,
fuse_ino_t nodeid1,
uint64_t nodeid1,
const char *name1, const char *name1,
fuse_ino_t nodeid2,
uint64_t nodeid2,
const char *name2, const char *name2,
char **path1, char **path1,
char **path2, char **path2,
@ -1161,9 +1200,9 @@ try_get_path2(struct fuse *f,
static static
int int
get_path2(struct fuse *f, get_path2(struct fuse *f,
fuse_ino_t nodeid1,
uint64_t nodeid1,
const char *name1, const char *name1,
fuse_ino_t nodeid2,
uint64_t nodeid2,
const char *name2, const char *name2,
char **path1, char **path1,
char **path2, char **path2,
@ -1198,7 +1237,7 @@ get_path2(struct fuse *f,
static static
void void
free_path_wrlock(struct fuse *f, free_path_wrlock(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
struct node *wnode, struct node *wnode,
char *path) char *path)
{ {
@ -1213,7 +1252,7 @@ free_path_wrlock(struct fuse *f,
static static
void void
free_path(struct fuse *f, free_path(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
char *path) char *path)
{ {
if(path) if(path)
@ -1223,8 +1262,8 @@ free_path(struct fuse *f,
static static
void void
free_path2(struct fuse *f, free_path2(struct fuse *f,
fuse_ino_t nodeid1,
fuse_ino_t nodeid2,
uint64_t nodeid1,
uint64_t nodeid2,
struct node *wnode1, struct node *wnode1,
struct node *wnode2, struct node *wnode2,
char *path1, char *path1,
@ -1242,7 +1281,7 @@ free_path2(struct fuse *f,
static static
void void
forget_node(struct fuse *f, forget_node(struct fuse *f,
const fuse_ino_t nodeid,
const uint64_t nodeid,
const uint64_t nlookup) const uint64_t nlookup)
{ {
struct node *node; struct node *node;
@ -1310,7 +1349,7 @@ unlink_node(struct fuse *f,
static static
void void
remove_node(struct fuse *f, remove_node(struct fuse *f,
fuse_ino_t dir,
uint64_t dir,
const char *name) const char *name)
{ {
struct node *node; struct node *node;
@ -1325,9 +1364,9 @@ remove_node(struct fuse *f,
static static
int int
rename_node(struct fuse *f, rename_node(struct fuse *f,
fuse_ino_t olddir,
uint64_t olddir,
const char *oldname, const char *oldname,
fuse_ino_t newdir,
uint64_t newdir,
const char *newname) const char *newname)
{ {
struct node *node; struct node *node;
@ -1358,7 +1397,7 @@ rename_node(struct fuse *f,
static static
void void
set_stat(struct fuse *f, set_stat(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
struct stat *stbuf) struct stat *stbuf)
{ {
if(!f->conf.use_ino) if(!f->conf.use_ino)
@ -1786,22 +1825,20 @@ void
update_stat(struct node *node_, update_stat(struct node *node_,
const struct stat *stnew_) const struct stat *stnew_)
{ {
if((node_->stat_cache_valid) &&
((node_->mtim.tv_sec != stnew_->st_mtim.tv_sec) ||
(node_->mtim.tv_nsec != stnew_->st_mtim.tv_nsec) ||
(node_->ino != stnew_->st_ino) ||
(node_->size != stnew_->st_size)))
node_->stat_cache_valid = 0;
uint32_t crc32b;
crc32b = stat_crc32b(stnew_);
if(node_->is_stat_cache_valid && (crc32b != node_->stat_crc32b))
node_->is_stat_cache_valid = 0;
node_->ino = stnew_->st_ino;
node_->size = stnew_->st_size;
node_->mtim = stnew_->st_mtim;
node_->stat_crc32b = crc32b;
} }
static static
int int
set_path_info(struct fuse *f, set_path_info(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
const char *name, const char *name,
struct fuse_entry_param *e) struct fuse_entry_param *e)
{ {
@ -1812,7 +1849,7 @@ set_path_info(struct fuse *f,
return -ENOMEM; return -ENOMEM;
e->ino = node->nodeid; e->ino = node->nodeid;
e->generation = node->generation;
e->generation = f->nodeid_gen.generation;
pthread_mutex_lock(&f->lock); pthread_mutex_lock(&f->lock);
update_stat(node,&e->attr); update_stat(node,&e->attr);
@ -1826,7 +1863,7 @@ set_path_info(struct fuse *f,
static static
int int
lookup_path(struct fuse *f, lookup_path(struct fuse *f,
fuse_ino_t nodeid,
uint64_t nodeid,
const char *name, const char *name,
const char *path, const char *path,
struct fuse_entry_param *e, struct fuse_entry_param *e,
@ -2005,7 +2042,7 @@ fuse_lib_destroy(void *data)
static static
void void
fuse_lib_lookup(fuse_req_t req, fuse_lib_lookup(fuse_req_t req,
fuse_ino_t parent,
uint64_t parent,
const char *name) const char *name)
{ {
struct fuse *f = req_fuse_prepare(req); struct fuse *f = req_fuse_prepare(req);
@ -2064,7 +2101,7 @@ fuse_lib_lookup(fuse_req_t req,
static static
void void
do_forget(struct fuse *f, do_forget(struct fuse *f,
const fuse_ino_t ino,
const uint64_t ino,
const uint64_t nlookup) const uint64_t nlookup)
{ {
forget_node(f,ino,nlookup); forget_node(f,ino,nlookup);
@ -2073,7 +2110,7 @@ do_forget(struct fuse *f,
static static
void void
fuse_lib_forget(fuse_req_t req, fuse_lib_forget(fuse_req_t req,
const fuse_ino_t ino,
const uint64_t ino,
const uint64_t nlookup) const uint64_t nlookup)
{ {
do_forget(req_fuse(req),ino,nlookup); do_forget(req_fuse(req),ino,nlookup);
@ -2099,7 +2136,7 @@ fuse_lib_forget_multi(fuse_req_t req,
static static
void void
fuse_lib_getattr(fuse_req_t req, fuse_lib_getattr(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
@ -2174,7 +2211,7 @@ fuse_fs_fchmod(struct fuse_fs *fs_,
static static
void void
fuse_lib_setattr(fuse_req_t req, fuse_lib_setattr(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
struct stat *attr, struct stat *attr,
int valid, int valid,
fuse_file_info_t *fi) fuse_file_info_t *fi)
@ -2293,7 +2330,7 @@ fuse_lib_setattr(fuse_req_t req,
static static
void void
fuse_lib_access(fuse_req_t req, fuse_lib_access(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
int mask) int mask)
{ {
struct fuse *f = req_fuse_prepare(req); struct fuse *f = req_fuse_prepare(req);
@ -2313,7 +2350,7 @@ fuse_lib_access(fuse_req_t req,
static static
void void
fuse_lib_readlink(fuse_req_t req, fuse_lib_readlink(fuse_req_t req,
fuse_ino_t ino)
uint64_t ino)
{ {
struct fuse *f = req_fuse_prepare(req); struct fuse *f = req_fuse_prepare(req);
char linkname[PATH_MAX + 1]; char linkname[PATH_MAX + 1];
@ -2341,7 +2378,7 @@ fuse_lib_readlink(fuse_req_t req,
static static
void void
fuse_lib_mknod(fuse_req_t req, fuse_lib_mknod(fuse_req_t req,
fuse_ino_t parent,
uint64_t parent,
const char *name, const char *name,
mode_t mode, mode_t mode,
dev_t rdev) dev_t rdev)
@ -2383,7 +2420,7 @@ fuse_lib_mknod(fuse_req_t req,
static static
void void
fuse_lib_mkdir(fuse_req_t req, fuse_lib_mkdir(fuse_req_t req,
fuse_ino_t parent,
uint64_t parent,
const char *name, const char *name,
mode_t mode) mode_t mode)
{ {
@ -2406,7 +2443,7 @@ fuse_lib_mkdir(fuse_req_t req,
static static
void void
fuse_lib_unlink(fuse_req_t req, fuse_lib_unlink(fuse_req_t req,
fuse_ino_t parent,
uint64_t parent,
const char *name) const char *name)
{ {
int err; int err;
@ -2441,7 +2478,7 @@ fuse_lib_unlink(fuse_req_t req,
static static
void void
fuse_lib_rmdir(fuse_req_t req, fuse_lib_rmdir(fuse_req_t req,
fuse_ino_t parent,
uint64_t parent,
const char *name) const char *name)
{ {
struct fuse *f = req_fuse_prepare(req); struct fuse *f = req_fuse_prepare(req);
@ -2465,7 +2502,7 @@ static
void void
fuse_lib_symlink(fuse_req_t req_, fuse_lib_symlink(fuse_req_t req_,
const char *linkname_, const char *linkname_,
fuse_ino_t parent_,
uint64_t parent_,
const char *name_) const char *name_)
{ {
int rv; int rv;
@ -2490,9 +2527,9 @@ fuse_lib_symlink(fuse_req_t req_,
static static
void void
fuse_lib_rename(fuse_req_t req, fuse_lib_rename(fuse_req_t req,
fuse_ino_t olddir,
uint64_t olddir,
const char *oldname, const char *oldname,
fuse_ino_t newdir,
uint64_t newdir,
const char *newname) const char *newname)
{ {
int err; int err;
@ -2530,8 +2567,8 @@ fuse_lib_rename(fuse_req_t req,
static static
void void
fuse_lib_link(fuse_req_t req, fuse_lib_link(fuse_req_t req,
fuse_ino_t ino,
fuse_ino_t newparent,
uint64_t ino,
uint64_t newparent,
const char *newname) const char *newname)
{ {
int rv; int rv;
@ -2558,7 +2595,7 @@ fuse_lib_link(fuse_req_t req,
static static
void void
fuse_do_release(struct fuse *f, fuse_do_release(struct fuse *f,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
struct node *node; struct node *node;
@ -2588,7 +2625,7 @@ fuse_do_release(struct fuse *f,
static static
void void
fuse_lib_create(fuse_req_t req, fuse_lib_create(fuse_req_t req,
fuse_ino_t parent,
uint64_t parent,
const char *name, const char *name,
mode_t mode, mode_t mode,
fuse_file_info_t *fi) fuse_file_info_t *fi)
@ -2644,7 +2681,7 @@ fuse_lib_create(fuse_req_t req,
static static
void void
open_auto_cache(struct fuse *f, open_auto_cache(struct fuse *f,
fuse_ino_t ino,
uint64_t ino,
const char *path, const char *path,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
@ -2654,7 +2691,7 @@ open_auto_cache(struct fuse *f,
pthread_mutex_lock(&f->lock); pthread_mutex_lock(&f->lock);
node = get_node(f,ino); node = get_node(f,ino);
if(node->stat_cache_valid)
if(node->is_stat_cache_valid)
{ {
int err; int err;
struct stat stbuf; struct stat stbuf;
@ -2666,13 +2703,13 @@ open_auto_cache(struct fuse *f,
if(!err) if(!err)
update_stat(node,&stbuf); update_stat(node,&stbuf);
else else
node->stat_cache_valid = 0;
node->is_stat_cache_valid = 0;
} }
if(node->stat_cache_valid)
if(node->is_stat_cache_valid)
fi->keep_cache = 1; fi->keep_cache = 1;
node->stat_cache_valid = 1;
node->is_stat_cache_valid = 1;
pthread_mutex_unlock(&f->lock); pthread_mutex_unlock(&f->lock);
} }
@ -2680,7 +2717,7 @@ open_auto_cache(struct fuse *f,
static static
void void
fuse_lib_open(fuse_req_t req, fuse_lib_open(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
int err; int err;
@ -2719,7 +2756,7 @@ fuse_lib_open(fuse_req_t req,
static static
void void
fuse_lib_read(fuse_req_t req, fuse_lib_read(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
size_t size, size_t size,
off_t off, off_t off,
fuse_file_info_t *fi) fuse_file_info_t *fi)
@ -2741,7 +2778,7 @@ fuse_lib_read(fuse_req_t req,
static static
void void
fuse_lib_write_buf(fuse_req_t req, fuse_lib_write_buf(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
struct fuse_bufvec *buf, struct fuse_bufvec *buf,
off_t off, off_t off,
fuse_file_info_t *fi) fuse_file_info_t *fi)
@ -2761,7 +2798,7 @@ fuse_lib_write_buf(fuse_req_t req,
static static
void void
fuse_lib_fsync(fuse_req_t req, fuse_lib_fsync(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
int datasync, int datasync,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
@ -2787,7 +2824,7 @@ get_dirhandle(const fuse_file_info_t *llfi,
static static
void void
fuse_lib_opendir(fuse_req_t req, fuse_lib_opendir(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *llfi) fuse_file_info_t *llfi)
{ {
int err; int err;
@ -2868,7 +2905,7 @@ readdir_buf(fuse_dirents_t *d_,
static static
void void
fuse_lib_readdir(fuse_req_t req_, fuse_lib_readdir(fuse_req_t req_,
fuse_ino_t ino_,
uint64_t ino_,
size_t size_, size_t size_,
off_t off_, off_t off_,
fuse_file_info_t *llffi_) fuse_file_info_t *llffi_)
@ -2908,7 +2945,7 @@ fuse_lib_readdir(fuse_req_t req_,
static static
void void
fuse_lib_readdir_plus(fuse_req_t req_, fuse_lib_readdir_plus(fuse_req_t req_,
fuse_ino_t ino_,
uint64_t ino_,
size_t size_, size_t size_,
off_t off_, off_t off_,
fuse_file_info_t *llffi_) fuse_file_info_t *llffi_)
@ -2948,7 +2985,7 @@ fuse_lib_readdir_plus(fuse_req_t req_,
static static
void void
fuse_lib_releasedir(fuse_req_t req_, fuse_lib_releasedir(fuse_req_t req_,
fuse_ino_t ino_,
uint64_t ino_,
fuse_file_info_t *llfi_) fuse_file_info_t *llfi_)
{ {
struct fuse *f; struct fuse *f;
@ -2972,7 +3009,7 @@ fuse_lib_releasedir(fuse_req_t req_,
static static
void void
fuse_lib_fsyncdir(fuse_req_t req, fuse_lib_fsyncdir(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
int datasync, int datasync,
fuse_file_info_t *llfi) fuse_file_info_t *llfi)
{ {
@ -2990,7 +3027,7 @@ fuse_lib_fsyncdir(fuse_req_t req,
static static
void void
fuse_lib_statfs(fuse_req_t req, fuse_lib_statfs(fuse_req_t req,
fuse_ino_t ino)
uint64_t ino)
{ {
struct fuse *f = req_fuse_prepare(req); struct fuse *f = req_fuse_prepare(req);
struct statvfs buf; struct statvfs buf;
@ -3016,7 +3053,7 @@ fuse_lib_statfs(fuse_req_t req,
static static
void void
fuse_lib_setxattr(fuse_req_t req, fuse_lib_setxattr(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
const char *name, const char *name,
const char *value, const char *value,
size_t size, size_t size,
@ -3040,7 +3077,7 @@ static
int int
common_getxattr(struct fuse *f, common_getxattr(struct fuse *f,
fuse_req_t req, fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
const char *name, const char *name,
char *value, char *value,
size_t size) size_t size)
@ -3062,7 +3099,7 @@ common_getxattr(struct fuse *f,
static static
void void
fuse_lib_getxattr(fuse_req_t req, fuse_lib_getxattr(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
const char *name, const char *name,
size_t size) size_t size)
{ {
@ -3099,7 +3136,7 @@ static
int int
common_listxattr(struct fuse *f, common_listxattr(struct fuse *f,
fuse_req_t req, fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
char *list, char *list,
size_t size) size_t size)
{ {
@ -3119,7 +3156,7 @@ common_listxattr(struct fuse *f,
static static
void void
fuse_lib_listxattr(fuse_req_t req, fuse_lib_listxattr(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
size_t size) size_t size)
{ {
struct fuse *f = req_fuse_prepare(req); struct fuse *f = req_fuse_prepare(req);
@ -3154,7 +3191,7 @@ fuse_lib_listxattr(fuse_req_t req,
static static
void void
fuse_lib_removexattr(fuse_req_t req, fuse_lib_removexattr(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
const char *name) const char *name)
{ {
struct fuse *f = req_fuse_prepare(req); struct fuse *f = req_fuse_prepare(req);
@ -3174,10 +3211,10 @@ fuse_lib_removexattr(fuse_req_t req,
static static
void void
fuse_lib_copy_file_range(fuse_req_t req_, fuse_lib_copy_file_range(fuse_req_t req_,
fuse_ino_t nodeid_in_,
uint64_t nodeid_in_,
off_t off_in_, off_t off_in_,
fuse_file_info_t *ffi_in_, fuse_file_info_t *ffi_in_,
fuse_ino_t nodeid_out_,
uint64_t nodeid_out_,
off_t off_out_, off_t off_out_,
fuse_file_info_t *ffi_out_, fuse_file_info_t *ffi_out_,
size_t len_, size_t len_,
@ -3348,7 +3385,7 @@ static
int int
fuse_flush_common(struct fuse *f, fuse_flush_common(struct fuse *f,
fuse_req_t req, fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
struct flock lock; struct flock lock;
@ -3382,7 +3419,7 @@ fuse_flush_common(struct fuse *f,
static static
void void
fuse_lib_release(fuse_req_t req, fuse_lib_release(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
int err = 0; int err = 0;
@ -3403,7 +3440,7 @@ fuse_lib_release(fuse_req_t req,
static static
void void
fuse_lib_flush(fuse_req_t req, fuse_lib_flush(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi) fuse_file_info_t *fi)
{ {
int err; int err;
@ -3417,7 +3454,7 @@ fuse_lib_flush(fuse_req_t req,
static static
int int
fuse_lock_common(fuse_req_t req, fuse_lock_common(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi, fuse_file_info_t *fi,
struct flock *lock, struct flock *lock,
int cmd) int cmd)
@ -3433,7 +3470,7 @@ fuse_lock_common(fuse_req_t req,
static static
void void
fuse_lib_getlk(fuse_req_t req, fuse_lib_getlk(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi, fuse_file_info_t *fi,
struct flock *lock) struct flock *lock)
{ {
@ -3463,7 +3500,7 @@ fuse_lib_getlk(fuse_req_t req,
static static
void void
fuse_lib_setlk(fuse_req_t req, fuse_lib_setlk(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi, fuse_file_info_t *fi,
struct flock *lock, struct flock *lock,
int sleep) int sleep)
@ -3487,7 +3524,7 @@ fuse_lib_setlk(fuse_req_t req,
static static
void void
fuse_lib_flock(fuse_req_t req, fuse_lib_flock(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi, fuse_file_info_t *fi,
int op) int op)
{ {
@ -3502,7 +3539,7 @@ fuse_lib_flock(fuse_req_t req,
static static
void void
fuse_lib_bmap(fuse_req_t req, fuse_lib_bmap(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
size_t blocksize, size_t blocksize,
uint64_t idx) uint64_t idx)
{ {
@ -3526,7 +3563,7 @@ fuse_lib_bmap(fuse_req_t req,
static static
void void
fuse_lib_ioctl(fuse_req_t req, fuse_lib_ioctl(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
unsigned long cmd, unsigned long cmd,
void *arg, void *arg,
fuse_file_info_t *llfi, fuse_file_info_t *llfi,
@ -3576,7 +3613,7 @@ fuse_lib_ioctl(fuse_req_t req,
static static
void void
fuse_lib_poll(fuse_req_t req, fuse_lib_poll(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
fuse_file_info_t *fi, fuse_file_info_t *fi,
fuse_pollhandle_t *ph) fuse_pollhandle_t *ph)
{ {
@ -3595,7 +3632,7 @@ fuse_lib_poll(fuse_req_t req,
static static
void void
fuse_lib_fallocate(fuse_req_t req, fuse_lib_fallocate(fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
int mode, int mode,
off_t offset, off_t offset,
off_t length, off_t length,
@ -3724,48 +3761,48 @@ fuse_prune_remembered_nodes(struct fuse *f_)
static struct fuse_lowlevel_ops fuse_path_ops = static struct fuse_lowlevel_ops fuse_path_ops =
{ {
.access = fuse_lib_access,
.bmap = fuse_lib_bmap,
.copy_file_range = fuse_lib_copy_file_range,
.create = fuse_lib_create,
.destroy = fuse_lib_destroy,
.fallocate = fuse_lib_fallocate,
.flock = fuse_lib_flock,
.flush = fuse_lib_flush,
.forget = fuse_lib_forget,
.forget_multi = fuse_lib_forget_multi,
.fsync = fuse_lib_fsync,
.fsyncdir = fuse_lib_fsyncdir,
.getattr = fuse_lib_getattr,
.getlk = fuse_lib_getlk,
.getxattr = fuse_lib_getxattr,
.init = fuse_lib_init,
.ioctl = fuse_lib_ioctl,
.link = fuse_lib_link,
.listxattr = fuse_lib_listxattr,
.lookup = fuse_lib_lookup,
.mkdir = fuse_lib_mkdir,
.mknod = fuse_lib_mknod,
.open = fuse_lib_open,
.opendir = fuse_lib_opendir,
.poll = fuse_lib_poll,
.read = fuse_lib_read,
.readdir = fuse_lib_readdir,
.readdir_plus = fuse_lib_readdir_plus,
.readlink = fuse_lib_readlink,
.release = fuse_lib_release,
.releasedir = fuse_lib_releasedir,
.removexattr = fuse_lib_removexattr,
.rename = fuse_lib_rename,
.retrieve_reply = NULL,
.rmdir = fuse_lib_rmdir,
.setattr = fuse_lib_setattr,
.setlk = fuse_lib_setlk,
.setxattr = fuse_lib_setxattr,
.statfs = fuse_lib_statfs,
.symlink = fuse_lib_symlink,
.unlink = fuse_lib_unlink,
.write_buf = fuse_lib_write_buf,
.access = fuse_lib_access,
.bmap = fuse_lib_bmap,
.copy_file_range = fuse_lib_copy_file_range,
.create = fuse_lib_create,
.destroy = fuse_lib_destroy,
.fallocate = fuse_lib_fallocate,
.flock = fuse_lib_flock,
.flush = fuse_lib_flush,
.forget = fuse_lib_forget,
.forget_multi = fuse_lib_forget_multi,
.fsync = fuse_lib_fsync,
.fsyncdir = fuse_lib_fsyncdir,
.getattr = fuse_lib_getattr,
.getlk = fuse_lib_getlk,
.getxattr = fuse_lib_getxattr,
.init = fuse_lib_init,
.ioctl = fuse_lib_ioctl,
.link = fuse_lib_link,
.listxattr = fuse_lib_listxattr,
.lookup = fuse_lib_lookup,
.mkdir = fuse_lib_mkdir,
.mknod = fuse_lib_mknod,
.open = fuse_lib_open,
.opendir = fuse_lib_opendir,
.poll = fuse_lib_poll,
.read = fuse_lib_read,
.readdir = fuse_lib_readdir,
.readdir_plus = fuse_lib_readdir_plus,
.readlink = fuse_lib_readlink,
.release = fuse_lib_release,
.releasedir = fuse_lib_releasedir,
.removexattr = fuse_lib_removexattr,
.rename = fuse_lib_rename,
.retrieve_reply = NULL,
.rmdir = fuse_lib_rmdir,
.setattr = fuse_lib_setattr,
.setlk = fuse_lib_setlk,
.setxattr = fuse_lib_setxattr,
.statfs = fuse_lib_statfs,
.symlink = fuse_lib_symlink,
.unlink = fuse_lib_unlink,
.write_buf = fuse_lib_write_buf,
}; };
int int
@ -3862,30 +3899,30 @@ fuse_get_context(void)
} }
enum { enum {
KEY_HELP,
KEY_HELP,
}; };
#define FUSE_LIB_OPT(t,p,v) { t,offsetof(struct fuse_config,p),v } #define FUSE_LIB_OPT(t,p,v) { t,offsetof(struct fuse_config,p),v }
static const struct fuse_opt fuse_lib_opts[] = static const struct fuse_opt fuse_lib_opts[] =
{ {
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP),
FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP),
FUSE_LIB_OPT("debug", debug,1),
FUSE_LIB_OPT("-d", debug,1),
FUSE_LIB_OPT("umask=", set_mode,1),
FUSE_LIB_OPT("umask=%o", umask,0),
FUSE_LIB_OPT("uid=", set_uid,1),
FUSE_LIB_OPT("uid=%d", uid,0),
FUSE_LIB_OPT("gid=", set_gid,1),
FUSE_LIB_OPT("gid=%d", gid,0),
FUSE_LIB_OPT("noforget", remember,-1),
FUSE_LIB_OPT("remember=%u", remember,0),
FUSE_LIB_OPT("threads=%d", threads,0),
FUSE_LIB_OPT("use_ino", use_ino,1),
FUSE_OPT_END
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP),
FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP),
FUSE_LIB_OPT("debug", debug,1),
FUSE_LIB_OPT("-d", debug,1),
FUSE_LIB_OPT("umask=", set_mode,1),
FUSE_LIB_OPT("umask=%o", umask,0),
FUSE_LIB_OPT("uid=", set_uid,1),
FUSE_LIB_OPT("uid=%d", uid,0),
FUSE_LIB_OPT("gid=", set_gid,1),
FUSE_LIB_OPT("gid=%d", gid,0),
FUSE_LIB_OPT("noforget", remember,-1),
FUSE_LIB_OPT("remember=%u", remember,0),
FUSE_LIB_OPT("threads=%d", threads,0),
FUSE_LIB_OPT("use_ino", use_ino,1),
FUSE_OPT_END
}; };
static void fuse_lib_help(void) static void fuse_lib_help(void)
@ -4068,8 +4105,8 @@ fuse_new_common(struct fuse_chan *ch,
/* Trace topmost layer by default */ /* Trace topmost layer by default */
srand(time(NULL)); srand(time(NULL));
f->ctr = 0;
f->generation = rand64();
f->nodeid_gen.nodeid = FUSE_ROOT_ID;
f->nodeid_gen.generation = rand64();
if(node_table_init(&f->name_table) == -1) if(node_table_init(&f->name_table) == -1)
goto out_free_session; goto out_free_session;

7
libfuse/lib/fuse_i.h

@ -43,8 +43,11 @@ struct fuse_req
struct fuse_notify_req struct fuse_notify_req
{ {
uint64_t unique; uint64_t unique;
void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
const void *, const struct fuse_buf *);
void (*reply)(struct fuse_notify_req *,
fuse_req_t,
uint64_t,
const void *,
const struct fuse_buf *);
struct fuse_notify_req *next; struct fuse_notify_req *next;
struct fuse_notify_req *prev; struct fuse_notify_req *prev;
}; };

270
libfuse/lib/fuse_lowlevel.c

@ -1002,7 +1002,7 @@ fuse_reply_poll(fuse_req_t req,
static static
void void
do_lookup(fuse_req_t req, do_lookup(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
char *name = (char*)inarg; char *name = (char*)inarg;
@ -1013,7 +1013,7 @@ do_lookup(fuse_req_t req,
static static
void void
do_forget(fuse_req_t req, do_forget(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_forget_in *arg = (struct fuse_forget_in*)inarg; struct fuse_forget_in *arg = (struct fuse_forget_in*)inarg;
@ -1024,7 +1024,7 @@ do_forget(fuse_req_t req,
static static
void void
do_batch_forget(fuse_req_t req, do_batch_forget(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_batch_forget_in *arg = (void *) inarg; struct fuse_batch_forget_in *arg = (void *) inarg;
@ -1040,7 +1040,7 @@ do_batch_forget(fuse_req_t req,
static static
void void
do_getattr(fuse_req_t req, do_getattr(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t *fip = NULL; fuse_file_info_t *fip = NULL;
@ -1063,7 +1063,7 @@ do_getattr(fuse_req_t req,
static static
void void
do_setattr(fuse_req_t req_, do_setattr(fuse_req_t req_,
fuse_ino_t nodeid_,
uint64_t nodeid_,
const void *inarg_) const void *inarg_)
{ {
struct stat stbuf = {0}; struct stat stbuf = {0};
@ -1101,7 +1101,7 @@ do_setattr(fuse_req_t req_,
static static
void void
do_access(fuse_req_t req, do_access(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_access_in *arg = (struct fuse_access_in *)inarg; struct fuse_access_in *arg = (struct fuse_access_in *)inarg;
@ -1112,7 +1112,7 @@ do_access(fuse_req_t req,
static static
void void
do_readlink(fuse_req_t req, do_readlink(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
(void)inarg; (void)inarg;
@ -1123,7 +1123,7 @@ do_readlink(fuse_req_t req,
static static
void void
do_mknod(fuse_req_t req, do_mknod(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_mknod_in *arg = (struct fuse_mknod_in *) inarg; struct fuse_mknod_in *arg = (struct fuse_mknod_in *) inarg;
@ -1140,7 +1140,7 @@ do_mknod(fuse_req_t req,
static static
void void
do_mkdir(fuse_req_t req, do_mkdir(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_mkdir_in *arg = (struct fuse_mkdir_in *) inarg; struct fuse_mkdir_in *arg = (struct fuse_mkdir_in *) inarg;
@ -1154,7 +1154,7 @@ do_mkdir(fuse_req_t req,
static static
void void
do_unlink(fuse_req_t req, do_unlink(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
char *name = (char*)inarg; char *name = (char*)inarg;
@ -1165,7 +1165,7 @@ do_unlink(fuse_req_t req,
static static
void void
do_rmdir(fuse_req_t req, do_rmdir(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
char *name = (char*)inarg; char *name = (char*)inarg;
@ -1176,7 +1176,7 @@ do_rmdir(fuse_req_t req,
static static
void void
do_symlink(fuse_req_t req, do_symlink(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
char *name = (char*)inarg; char *name = (char*)inarg;
@ -1188,7 +1188,7 @@ do_symlink(fuse_req_t req,
static static
void void
do_rename(fuse_req_t req, do_rename(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_rename_in *arg = (struct fuse_rename_in*)inarg; struct fuse_rename_in *arg = (struct fuse_rename_in*)inarg;
@ -1201,7 +1201,7 @@ do_rename(fuse_req_t req,
static static
void void
do_link(fuse_req_t req, do_link(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_link_in *arg = (struct fuse_link_in*)inarg; struct fuse_link_in *arg = (struct fuse_link_in*)inarg;
@ -1212,7 +1212,7 @@ do_link(fuse_req_t req,
static static
void void
do_create(fuse_req_t req, do_create(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_create_in *arg = (struct fuse_create_in*)inarg; struct fuse_create_in *arg = (struct fuse_create_in*)inarg;
@ -1232,7 +1232,7 @@ do_create(fuse_req_t req,
static static
void void
do_open(fuse_req_t req, do_open(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1246,7 +1246,7 @@ do_open(fuse_req_t req,
static static
void void
do_read(fuse_req_t req, do_read(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1265,7 +1265,7 @@ do_read(fuse_req_t req,
static static
void void
do_write(fuse_req_t req, do_write(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
char *param; char *param;
@ -1292,14 +1292,14 @@ do_write(fuse_req_t req,
static static
void void
do_write_buf(fuse_req_t req, do_write_buf(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg, const void *inarg,
const struct fuse_buf *ibuf) const struct fuse_buf *ibuf)
{ {
struct fuse_ll *f = req->f; struct fuse_ll *f = req->f;
struct fuse_bufvec bufv = { struct fuse_bufvec bufv = {
.buf[0] = *ibuf,
.count = 1,
.buf[0] = *ibuf,
.count = 1,
}; };
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
struct fuse_write_in *arg = (struct fuse_write_in *) inarg; struct fuse_write_in *arg = (struct fuse_write_in *) inarg;
@ -1344,7 +1344,7 @@ do_write_buf(fuse_req_t req,
static static
void void
do_flush(fuse_req_t req, do_flush(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1361,7 +1361,7 @@ do_flush(fuse_req_t req,
static static
void void
do_release(fuse_req_t req, do_release(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1387,7 +1387,7 @@ do_release(fuse_req_t req,
static static
void void
do_fsync(fuse_req_t req, do_fsync(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1401,7 +1401,7 @@ do_fsync(fuse_req_t req,
static static
void void
do_opendir(fuse_req_t req, do_opendir(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1415,7 +1415,7 @@ do_opendir(fuse_req_t req,
static static
void void
do_readdir(fuse_req_t req, do_readdir(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1429,7 +1429,7 @@ do_readdir(fuse_req_t req,
static static
void void
do_readdir_plus(fuse_req_t req_, do_readdir_plus(fuse_req_t req_,
fuse_ino_t nodeid_,
uint64_t nodeid_,
const void *inarg_) const void *inarg_)
{ {
const struct fuse_read_in *arg; const struct fuse_read_in *arg;
@ -1444,7 +1444,7 @@ do_readdir_plus(fuse_req_t req_,
static static
void void
do_releasedir(fuse_req_t req, do_releasedir(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1459,7 +1459,7 @@ do_releasedir(fuse_req_t req,
static static
void void
do_fsyncdir(fuse_req_t req, do_fsyncdir(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1473,7 +1473,7 @@ do_fsyncdir(fuse_req_t req,
static static
void void
do_statfs(fuse_req_t req, do_statfs(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
(void)nodeid; (void)nodeid;
@ -1485,7 +1485,7 @@ do_statfs(fuse_req_t req,
static static
void void
do_setxattr(fuse_req_t req, do_setxattr(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_setxattr_in *arg = (struct fuse_setxattr_in*)inarg; struct fuse_setxattr_in *arg = (struct fuse_setxattr_in*)inarg;
@ -1498,7 +1498,7 @@ do_setxattr(fuse_req_t req,
static static
void void
do_getxattr(fuse_req_t req, do_getxattr(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_getxattr_in *arg = (struct fuse_getxattr_in*)inarg; struct fuse_getxattr_in *arg = (struct fuse_getxattr_in*)inarg;
@ -1509,7 +1509,7 @@ do_getxattr(fuse_req_t req,
static static
void void
do_listxattr(fuse_req_t req, do_listxattr(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_getxattr_in *arg = (struct fuse_getxattr_in*)inarg; struct fuse_getxattr_in *arg = (struct fuse_getxattr_in*)inarg;
@ -1520,7 +1520,7 @@ do_listxattr(fuse_req_t req,
static static
void void
do_removexattr(fuse_req_t req, do_removexattr(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
char *name = (char *) inarg; char *name = (char *) inarg;
@ -1547,7 +1547,7 @@ convert_fuse_file_lock(struct fuse_file_lock *fl,
static static
void void
do_getlk(fuse_req_t req, do_getlk(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1565,7 +1565,7 @@ do_getlk(fuse_req_t req,
static static
void void
do_setlk_common(fuse_req_t req, do_setlk_common(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg, const void *inarg,
int sleep) int sleep)
{ {
@ -1609,7 +1609,7 @@ do_setlk_common(fuse_req_t req,
static static
void void
do_setlk(fuse_req_t req, do_setlk(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
do_setlk_common(req, nodeid, inarg, 0); do_setlk_common(req, nodeid, inarg, 0);
@ -1618,7 +1618,7 @@ do_setlk(fuse_req_t req,
static static
void void
do_setlkw(fuse_req_t req, do_setlkw(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
do_setlk_common(req, nodeid, inarg, 1); do_setlk_common(req, nodeid, inarg, 1);
@ -1627,7 +1627,7 @@ do_setlkw(fuse_req_t req,
static static
void void
do_interrupt(fuse_req_t req, do_interrupt(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
destroy_req(req); destroy_req(req);
@ -1636,7 +1636,7 @@ do_interrupt(fuse_req_t req,
static static
void void
do_bmap(fuse_req_t req, do_bmap(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_bmap_in *arg = (struct fuse_bmap_in*)inarg; struct fuse_bmap_in *arg = (struct fuse_bmap_in*)inarg;
@ -1647,7 +1647,7 @@ do_bmap(fuse_req_t req,
static static
void void
do_ioctl(fuse_req_t req, do_ioctl(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1684,7 +1684,7 @@ fuse_pollhandle_destroy(fuse_pollhandle_t *ph)
static static
void void
do_poll(fuse_req_t req, do_poll(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1711,7 +1711,7 @@ do_poll(fuse_req_t req,
static static
void void
do_fallocate(fuse_req_t req, do_fallocate(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
fuse_file_info_t fi = {0}; fuse_file_info_t fi = {0};
@ -1725,7 +1725,7 @@ do_fallocate(fuse_req_t req,
static static
void void
do_init(fuse_req_t req, do_init(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_init_out outarg = {0}; struct fuse_init_out outarg = {0};
@ -1912,7 +1912,7 @@ do_init(fuse_req_t req,
static static
void void
do_destroy(fuse_req_t req, do_destroy(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg) const void *inarg)
{ {
struct fuse_ll *f = req->f; struct fuse_ll *f = req->f;
@ -1959,7 +1959,7 @@ list_init_nreq(struct fuse_notify_req *nreq)
static static
void void
do_notify_reply(fuse_req_t req, do_notify_reply(fuse_req_t req,
fuse_ino_t nodeid,
uint64_t nodeid,
const void *inarg, const void *inarg,
const struct fuse_buf *buf) const struct fuse_buf *buf)
{ {
@ -1986,7 +1986,7 @@ do_notify_reply(fuse_req_t req,
static static
void void
do_copy_file_range(fuse_req_t req_, do_copy_file_range(fuse_req_t req_,
fuse_ino_t nodeid_in_,
uint64_t nodeid_in_,
const void *arg_) const void *arg_)
{ {
@ -2052,7 +2052,7 @@ fuse_lowlevel_notify_poll(fuse_pollhandle_t *ph)
int int
fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch,
fuse_ino_t ino,
uint64_t ino,
off_t off, off_t off,
off_t len) off_t len)
{ {
@ -2079,7 +2079,7 @@ fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch,
int int
fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch,
fuse_ino_t parent,
uint64_t parent,
const char *name, const char *name,
size_t namelen) size_t namelen)
{ {
@ -2108,8 +2108,8 @@ fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch,
int int
fuse_lowlevel_notify_delete(struct fuse_chan *ch, fuse_lowlevel_notify_delete(struct fuse_chan *ch,
fuse_ino_t parent,
fuse_ino_t child,
uint64_t parent,
uint64_t child,
const char *name, const char *name,
size_t namelen) size_t namelen)
{ {
@ -2142,7 +2142,7 @@ fuse_lowlevel_notify_delete(struct fuse_chan *ch,
int int
fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_lowlevel_notify_store(struct fuse_chan *ch,
fuse_ino_t ino,
uint64_t ino,
off_t offset, off_t offset,
struct fuse_bufvec *bufv, struct fuse_bufvec *bufv,
enum fuse_buf_copy_flags flags) enum fuse_buf_copy_flags flags)
@ -2194,7 +2194,7 @@ static
void void
fuse_ll_retrieve_reply(struct fuse_notify_req *nreq, fuse_ll_retrieve_reply(struct fuse_notify_req *nreq,
fuse_req_t req, fuse_req_t req,
fuse_ino_t ino,
uint64_t ino,
const void *inarg, const void *inarg,
const struct fuse_buf *ibuf) const struct fuse_buf *ibuf)
{ {
@ -2203,8 +2203,8 @@ fuse_ll_retrieve_reply(struct fuse_notify_req *nreq,
container_of(nreq, struct fuse_retrieve_req, nreq); container_of(nreq, struct fuse_retrieve_req, nreq);
const struct fuse_notify_retrieve_in *arg = inarg; const struct fuse_notify_retrieve_in *arg = inarg;
struct fuse_bufvec bufv = { struct fuse_bufvec bufv = {
.buf[0] = *ibuf,
.count = 1,
.buf[0] = *ibuf,
.count = 1,
}; };
if (!(bufv.buf[0].flags & FUSE_BUF_IS_FD)) if (!(bufv.buf[0].flags & FUSE_BUF_IS_FD))
@ -2239,7 +2239,7 @@ fuse_ll_retrieve_reply(struct fuse_notify_req *nreq,
int int
fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_lowlevel_notify_retrieve(struct fuse_chan *ch,
fuse_ino_t ino,
uint64_t ino,
size_t size, size_t size,
off_t offset, off_t offset,
void *cookie) void *cookie)
@ -2305,53 +2305,53 @@ fuse_req_ctx(fuse_req_t req)
} }
static struct { static struct {
void (*func)(fuse_req_t, fuse_ino_t, const void *);
void (*func)(fuse_req_t, uint64_t, const void *);
const char *name; const char *name;
} fuse_ll_ops[] = } fuse_ll_ops[] =
{ {
[FUSE_LOOKUP] = { do_lookup, "LOOKUP" },
[FUSE_FORGET] = { do_forget, "FORGET" },
[FUSE_GETATTR] = { do_getattr, "GETATTR" },
[FUSE_SETATTR] = { do_setattr, "SETATTR" },
[FUSE_READLINK] = { do_readlink, "READLINK" },
[FUSE_SYMLINK] = { do_symlink, "SYMLINK" },
[FUSE_MKNOD] = { do_mknod, "MKNOD" },
[FUSE_MKDIR] = { do_mkdir, "MKDIR" },
[FUSE_UNLINK] = { do_unlink, "UNLINK" },
[FUSE_RMDIR] = { do_rmdir, "RMDIR" },
[FUSE_RENAME] = { do_rename, "RENAME" },
[FUSE_LINK] = { do_link, "LINK" },
[FUSE_OPEN] = { do_open, "OPEN" },
[FUSE_READ] = { do_read, "READ" },
[FUSE_WRITE] = { do_write, "WRITE" },
[FUSE_STATFS] = { do_statfs, "STATFS" },
[FUSE_RELEASE] = { do_release, "RELEASE" },
[FUSE_FSYNC] = { do_fsync, "FSYNC" },
[FUSE_SETXATTR] = { do_setxattr, "SETXATTR" },
[FUSE_GETXATTR] = { do_getxattr, "GETXATTR" },
[FUSE_LISTXATTR] = { do_listxattr, "LISTXATTR" },
[FUSE_REMOVEXATTR] = { do_removexattr, "REMOVEXATTR" },
[FUSE_FLUSH] = { do_flush, "FLUSH" },
[FUSE_INIT] = { do_init, "INIT" },
[FUSE_OPENDIR] = { do_opendir, "OPENDIR" },
[FUSE_READDIR] = { do_readdir, "READDIR" },
[FUSE_READDIRPLUS] = { do_readdir_plus, "READDIR_PLUS" },
[FUSE_RELEASEDIR] = { do_releasedir, "RELEASEDIR" },
[FUSE_FSYNCDIR] = { do_fsyncdir, "FSYNCDIR" },
[FUSE_GETLK] = { do_getlk, "GETLK" },
[FUSE_SETLK] = { do_setlk, "SETLK" },
[FUSE_SETLKW] = { do_setlkw, "SETLKW" },
[FUSE_ACCESS] = { do_access, "ACCESS" },
[FUSE_CREATE] = { do_create, "CREATE" },
[FUSE_INTERRUPT] = { do_interrupt, "INTERRUPT" },
[FUSE_BMAP] = { do_bmap, "BMAP" },
[FUSE_IOCTL] = { do_ioctl, "IOCTL" },
[FUSE_POLL] = { do_poll, "POLL" },
[FUSE_FALLOCATE] = { do_fallocate, "FALLOCATE" },
[FUSE_DESTROY] = { do_destroy, "DESTROY" },
[FUSE_NOTIFY_REPLY] = { (void *) 1, "NOTIFY_REPLY" },
[FUSE_BATCH_FORGET] = { do_batch_forget, "BATCH_FORGET" },
[FUSE_COPY_FILE_RANGE] = { do_copy_file_range, "COPY_FILE_RANGE" },
[FUSE_LOOKUP] = { do_lookup, "LOOKUP" },
[FUSE_FORGET] = { do_forget, "FORGET" },
[FUSE_GETATTR] = { do_getattr, "GETATTR" },
[FUSE_SETATTR] = { do_setattr, "SETATTR" },
[FUSE_READLINK] = { do_readlink, "READLINK" },
[FUSE_SYMLINK] = { do_symlink, "SYMLINK" },
[FUSE_MKNOD] = { do_mknod, "MKNOD" },
[FUSE_MKDIR] = { do_mkdir, "MKDIR" },
[FUSE_UNLINK] = { do_unlink, "UNLINK" },
[FUSE_RMDIR] = { do_rmdir, "RMDIR" },
[FUSE_RENAME] = { do_rename, "RENAME" },
[FUSE_LINK] = { do_link, "LINK" },
[FUSE_OPEN] = { do_open, "OPEN" },
[FUSE_READ] = { do_read, "READ" },
[FUSE_WRITE] = { do_write, "WRITE" },
[FUSE_STATFS] = { do_statfs, "STATFS" },
[FUSE_RELEASE] = { do_release, "RELEASE" },
[FUSE_FSYNC] = { do_fsync, "FSYNC" },
[FUSE_SETXATTR] = { do_setxattr, "SETXATTR" },
[FUSE_GETXATTR] = { do_getxattr, "GETXATTR" },
[FUSE_LISTXATTR] = { do_listxattr, "LISTXATTR" },
[FUSE_REMOVEXATTR] = { do_removexattr, "REMOVEXATTR" },
[FUSE_FLUSH] = { do_flush, "FLUSH" },
[FUSE_INIT] = { do_init, "INIT" },
[FUSE_OPENDIR] = { do_opendir, "OPENDIR" },
[FUSE_READDIR] = { do_readdir, "READDIR" },
[FUSE_READDIRPLUS] = { do_readdir_plus, "READDIR_PLUS" },
[FUSE_RELEASEDIR] = { do_releasedir, "RELEASEDIR" },
[FUSE_FSYNCDIR] = { do_fsyncdir, "FSYNCDIR" },
[FUSE_GETLK] = { do_getlk, "GETLK" },
[FUSE_SETLK] = { do_setlk, "SETLK" },
[FUSE_SETLKW] = { do_setlkw, "SETLKW" },
[FUSE_ACCESS] = { do_access, "ACCESS" },
[FUSE_CREATE] = { do_create, "CREATE" },
[FUSE_INTERRUPT] = { do_interrupt, "INTERRUPT" },
[FUSE_BMAP] = { do_bmap, "BMAP" },
[FUSE_IOCTL] = { do_ioctl, "IOCTL" },
[FUSE_POLL] = { do_poll, "POLL" },
[FUSE_FALLOCATE] = { do_fallocate, "FALLOCATE" },
[FUSE_DESTROY] = { do_destroy, "DESTROY" },
[FUSE_NOTIFY_REPLY] = { (void *) 1, "NOTIFY_REPLY" },
[FUSE_BATCH_FORGET] = { do_batch_forget, "BATCH_FORGET" },
[FUSE_COPY_FILE_RANGE] = { do_copy_file_range, "COPY_FILE_RANGE" },
}; };
#define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0])) #define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))
@ -2423,12 +2423,12 @@ fuse_ll_process_buf(void *data,
if (req == NULL) if (req == NULL)
{ {
struct fuse_out_header out = { struct fuse_out_header out = {
.unique = in->unique,
.error = -ENOMEM,
.unique = in->unique,
.error = -ENOMEM,
}; };
struct iovec iov = { struct iovec iov = {
.iov_base = &out,
.iov_len = sizeof(struct fuse_out_header),
.iov_base = &out,
.iov_len = sizeof(struct fuse_out_header),
}; };
fuse_send_msg(f, ch, &iov, 1); fuse_send_msg(f, ch, &iov, 1);
@ -2510,42 +2510,42 @@ fuse_ll_process(void *data,
struct fuse_chan *ch) struct fuse_chan *ch)
{ {
struct fuse_buf fbuf = { struct fuse_buf fbuf = {
.mem = (void *) buf,
.size = len,
.mem = (void *) buf,
.size = len,
}; };
fuse_ll_process_buf(data, &fbuf, ch); fuse_ll_process_buf(data, &fbuf, ch);
} }
enum { enum {
KEY_HELP,
KEY_VERSION,
KEY_HELP,
KEY_VERSION,
}; };
static const struct fuse_opt fuse_ll_opts[] = static const struct fuse_opt fuse_ll_opts[] =
{ {
{ "debug", offsetof(struct fuse_ll, debug), 1 },
{ "-d", offsetof(struct fuse_ll, debug), 1 },
{ "max_readahead=%u", offsetof(struct fuse_ll, conn.max_readahead), 0 },
{ "max_background=%u", offsetof(struct fuse_ll, conn.max_background), 0 },
{ "congestion_threshold=%u",
offsetof(struct fuse_ll, conn.congestion_threshold), 0 },
{ "no_remote_lock", offsetof(struct fuse_ll, no_remote_posix_lock), 1},
{ "no_remote_lock", offsetof(struct fuse_ll, no_remote_flock), 1},
{ "no_remote_flock", offsetof(struct fuse_ll, no_remote_flock), 1},
{ "no_remote_posix_lock", offsetof(struct fuse_ll, no_remote_posix_lock), 1},
{ "splice_write", offsetof(struct fuse_ll, splice_write), 1},
{ "no_splice_write", offsetof(struct fuse_ll, no_splice_write), 1},
{ "splice_move", offsetof(struct fuse_ll, splice_move), 1},
{ "no_splice_move", offsetof(struct fuse_ll, no_splice_move), 1},
{ "splice_read", offsetof(struct fuse_ll, splice_read), 1},
{ "no_splice_read", offsetof(struct fuse_ll, no_splice_read), 1},
FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_DISCARD),
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
FUSE_OPT_KEY("-V", KEY_VERSION),
FUSE_OPT_KEY("--version", KEY_VERSION),
FUSE_OPT_END
{ "debug", offsetof(struct fuse_ll, debug), 1 },
{ "-d", offsetof(struct fuse_ll, debug), 1 },
{ "max_readahead=%u", offsetof(struct fuse_ll, conn.max_readahead), 0 },
{ "max_background=%u", offsetof(struct fuse_ll, conn.max_background), 0 },
{ "congestion_threshold=%u",
offsetof(struct fuse_ll, conn.congestion_threshold), 0 },
{ "no_remote_lock", offsetof(struct fuse_ll, no_remote_posix_lock), 1},
{ "no_remote_lock", offsetof(struct fuse_ll, no_remote_flock), 1},
{ "no_remote_flock", offsetof(struct fuse_ll, no_remote_flock), 1},
{ "no_remote_posix_lock", offsetof(struct fuse_ll, no_remote_posix_lock), 1},
{ "splice_write", offsetof(struct fuse_ll, splice_write), 1},
{ "no_splice_write", offsetof(struct fuse_ll, no_splice_write), 1},
{ "splice_move", offsetof(struct fuse_ll, splice_move), 1},
{ "no_splice_move", offsetof(struct fuse_ll, no_splice_move), 1},
{ "splice_read", offsetof(struct fuse_ll, splice_read), 1},
{ "no_splice_read", offsetof(struct fuse_ll, no_splice_read), 1},
FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_DISCARD),
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
FUSE_OPT_KEY("-V", KEY_VERSION),
FUSE_OPT_KEY("--version", KEY_VERSION),
FUSE_OPT_END
}; };
static static
@ -2701,9 +2701,9 @@ fuse_ll_receive_buf(struct fuse_session *se,
} }
tmpbuf = (struct fuse_buf) { tmpbuf = (struct fuse_buf) {
.size = res,
.flags = FUSE_BUF_IS_FD,
.fd = llp->pipe[0],
.size = res,
.flags = FUSE_BUF_IS_FD,
.fd = llp->pipe[0],
}; };
/* /*
@ -2784,8 +2784,8 @@ fuse_lowlevel_new_common(struct fuse_args *args,
struct fuse_ll *f; struct fuse_ll *f;
struct fuse_session *se; struct fuse_session *se;
struct fuse_session_ops sop = { struct fuse_session_ops sop = {
.process = fuse_ll_process,
.destroy = fuse_ll_destroy,
.process = fuse_ll_process,
.destroy = fuse_ll_destroy,
}; };
if (sizeof(struct fuse_lowlevel_ops) < op_size) if (sizeof(struct fuse_lowlevel_ops) < op_size)

Loading…
Cancel
Save