25 #define FUSE_USE_VERSION 31 28 #include <fuse_lowlevel.h> 35 static int null_getattr(
const char *path,
struct stat *stbuf,
40 if(strcmp(path,
"/") != 0)
43 stbuf->st_mode = S_IFREG | 0644;
45 stbuf->st_uid = getuid();
46 stbuf->st_gid = getgid();
47 stbuf->st_size = (1ULL << 32);
49 stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
54 static int null_truncate(
const char *path, off_t size,
60 if(strcmp(path,
"/") != 0)
70 if(strcmp(path,
"/") != 0)
76 static int null_read(
const char *path,
char *buf,
size_t size,
83 if(strcmp(path,
"/") != 0)
86 if (offset >= (1ULL << 32))
93 static int null_write(
const char *path,
const char *buf,
size_t size,
100 if(strcmp(path,
"/") != 0)
108 .truncate = null_truncate,
114 int main(
int argc,
char *argv[])
117 struct fuse_cmdline_opts opts;
123 if (!opts.mountpoint) {
124 fprintf(stderr,
"missing mountpoint parameter\n");
128 if (stat(opts.mountpoint, &stbuf) == -1) {
129 fprintf(stderr ,
"failed to access mountpoint %s: %s\n",
130 opts.mountpoint, strerror(errno));
133 if (!S_ISREG(stbuf.st_mode)) {
134 fprintf(stderr,
"mountpoint is not a regular file\n");
138 return fuse_main(argc, argv, &null_oper, NULL);
int fuse_parse_cmdline(struct fuse_args *args, struct fuse_cmdline_opts *opts)
#define fuse_main(argc, argv, op, private_data)
#define FUSE_ARGS_INIT(argc, argv)
int(* getattr)(const char *, struct stat *, struct fuse_file_info *fi)