libfuse
passthrough_ll.c
Go to the documentation of this file.
1 /*
2  FUSE: Filesystem in Userspace
3  Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
4 
5  This program can be distributed under the terms of the GNU GPL.
6  See the file COPYING.
7 */
8 
37 #define _GNU_SOURCE
38 #define FUSE_USE_VERSION 31
39 
40 #include "config.h"
41 
42 #include <fuse_lowlevel.h>
43 #include <unistd.h>
44 #include <stdlib.h>
45 #include <stdio.h>
46 #include <stddef.h>
47 #include <stdbool.h>
48 #include <string.h>
49 #include <limits.h>
50 #include <dirent.h>
51 #include <assert.h>
52 #include <errno.h>
53 #include <err.h>
54 #include <inttypes.h>
55 #include <pthread.h>
56 #include <sys/file.h>
57 #include <sys/xattr.h>
58 
59 /* We are re-using pointers to our `struct lo_inode` and `struct
60  lo_dirp` elements as inodes. This means that we must be able to
61  store uintptr_t values in a fuse_ino_t variable. The following
62  incantation checks this condition at compile time. */
63 #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus
64 _Static_assert(sizeof(fuse_ino_t) >= sizeof(uintptr_t),
65  "fuse_ino_t too small to hold uintptr_t values!");
66 #else
67 struct _uintptr_to_must_hold_fuse_ino_t_dummy_struct \
68  { unsigned _uintptr_to_must_hold_fuse_ino_t:
69  ((sizeof(fuse_ino_t) >= sizeof(uintptr_t)) ? 1 : -1); };
70 #endif
71 
72 struct lo_inode {
73  struct lo_inode *next; /* protected by lo->mutex */
74  struct lo_inode *prev; /* protected by lo->mutex */
75  int fd;
76  bool is_symlink;
77  ino_t ino;
78  dev_t dev;
79  uint64_t refcount; /* protected by lo->mutex */
80 };
81 
82 enum {
83  CACHE_NEVER,
84 an class="keyword">struct html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t parent, fuse_ino452"> 452  lass="lineyword">struct fuse_cmdline_opts opts;
fuse_ino452"> 452  1.8.1   75  int fd;
76  bool is_symlink;< class="lineno"> 76  bool  1.8.1   75  int fd;
8a name="l00076">attr_timeout = lo->timeout;
e->fuse_ino_t ino, struct struct fuse_lowlevel_ops lo_oper = {
.