25#define FUSE_USE_VERSION 31
36static int null_getattr(
const char *path,
struct stat *stbuf,
41 if(strcmp(path,
"/") != 0)
44 stbuf->st_mode = S_IFREG | 0644;
46 stbuf->st_uid = getuid();
47 stbuf->st_gid = getgid();
48 stbuf->st_size = (1ULL << 32);
50 stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
55static int null_truncate(
const char *path, off_t size,
61 if(strcmp(path,
"/") != 0)
71 if(strcmp(path,
"/") != 0)
77static int null_read(
const char *path,
char *buf,
size_t size,
84 if(strcmp(path,
"/") != 0)
87 if (offset >= (1ULL << 32))
94static int null_write(
const char *path,
const char *buf,
size_t size,
101 if(strcmp(path,
"/") != 0)
109 .truncate = null_truncate,
115int main(
int argc,
char *argv[])
121 if (fuse_parse_cmdline(&args, &opts) != 0)
125 if (!opts.mountpoint) {
126 fprintf(stderr,
"missing mountpoint parameter\n");
130 if (stat(opts.mountpoint, &stbuf) == -1) {
131 fprintf(stderr ,
"failed to access mountpoint %s: %s\n",
132 opts.mountpoint, strerror(errno));
133 free(opts.mountpoint);
136 free(opts.mountpoint);
137 if (!S_ISREG(stbuf.st_mode)) {
138 fprintf(stderr,
"mountpoint is not a regular file\n");
142 return fuse_main(argc, argv, &null_oper, NULL);
#define fuse_main(argc, argv, op, private_data)
void fuse_opt_free_args(struct fuse_args *args)
#define FUSE_ARGS_INIT(argc, argv)
int(* getattr)(const char *, struct stat *, struct fuse_file_info *fi)