2
FUSE: Filesystem in Userspace
3
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
5
This program can be distributed under the terms of the GNU GPL.
8
gcc -Wall `pkg-config fuse --cflags --libs` null.c -o null
2
FUSE: Filesystem in Userspace
3
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
5
This program can be distributed under the terms of the GNU GPL.
8
gcc -Wall `pkg-config fuse --cflags --libs` null.c -o null
11
11
#define FUSE_USE_VERSION 26
19
19
static int null_getattr(const char *path, struct stat *stbuf)
21
if(strcmp(path, "/") != 0)
24
stbuf->st_mode = S_IFREG | 0644;
26
stbuf->st_uid = getuid();
27
stbuf->st_gid = getgid();
28
stbuf->st_size = (1ULL << 32); /* 4G */
30
stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
21
if(strcmp(path, "/") != 0)
24
stbuf->st_mode = S_IFREG | 0644;
26
stbuf->st_uid = getuid();
27
stbuf->st_gid = getgid();
28
stbuf->st_size = (1ULL << 32); /* 4G */
30
stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
35
35
static int null_truncate(const char *path, off_t size)
39
if(strcmp(path, "/") != 0)
39
if(strcmp(path, "/") != 0)
45
45
static int null_open(const char *path, struct fuse_file_info *fi)
49
if(strcmp(path, "/") != 0)
49
if(strcmp(path, "/") != 0)
55
55
static int null_read(const char *path, char *buf, size_t size,
56
off_t offset, struct fuse_file_info *fi)
56
off_t offset, struct fuse_file_info *fi)
62
if(strcmp(path, "/") != 0)
62
if(strcmp(path, "/") != 0)
68
68
static int null_write(const char *path, const char *buf, size_t size,
69
off_t offset, struct fuse_file_info *fi)
69
off_t offset, struct fuse_file_info *fi)
75
if(strcmp(path, "/") != 0)
75
if(strcmp(path, "/") != 0)
81
81
static struct fuse_operations null_oper = {
82
.getattr = null_getattr,
83
.truncate = null_truncate,
82
.getattr = null_getattr,
83
.truncate = null_truncate,
89
89
int main(int argc, char *argv[])
91
return fuse_main(argc, argv, &null_oper, NULL);
91
return fuse_main(argc, argv, &null_oper, NULL);