Check-in [40155f7235]
Overview
Comment:Added start of appfs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:40155f723537f6018dfeac76e45a76e4d20ecf1d
User & Date: rkeene on 2014-09-07 06:36:15
Other Links: manifest | tags
Context
2014-09-07
06:42
Updated to use PKG_CONFIG check-in: 777947ec3d user: rkeene tags: trunk
06:36
Added start of appfs check-in: 40155f7235 user: rkeene tags: trunk
06:34
initial empty check-in check-in: 78c60b0c9e user: rkeene tags: trunk
Changes

Added Makefile version [44f1b4fcef].

            1  +CC = gcc
            2  +LIBS = -lfuse
            3  +PREFIX = /usr/local
            4  +prefix = $(PREFIX)
            5  +bindir = $(prefix)/bin
            6  +
            7  +all: appfs
            8  +
            9  +appfs: appfs.o
           10  +	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o appfs appfs.o $(LIBS)
           11  +
           12  +appfs.o: appfs.c
           13  +
           14  +install: appfs
           15  +	cp appfs $(bindir)
           16  +
           17  +clean:
           18  +	rm -f appfs appfs.o
           19  +
           20  +distclean: clean
           21  +
           22  +.PHONY: all clean distclean install

Added appfs.c version [c3eac4ab1b].

            1  +#define FUSE_USE_VERSION 26
            2  +#define _FILE_OFFSET_BITS 64
            3  +
            4  +#include <fuse.h>
            5  +#include <errno.h>
            6  +#include <string.h>
            7  +#include <fcntl.h>
            8  +
            9  +static int appfs_getattr(const char *path, struct stat *stbuf) {
           10  +	int res = 0;
           11  +
           12  +	memset(stbuf, 0, sizeof(struct stat));
           13  +	if (strcmp(path, "/") == 0) {
           14  +		stbuf->st_mode = S_IFDIR | 0755;
           15  +		stbuf->st_nlink = 2;
           16  +	} else {
           17  +		res = -ENOENT;
           18  +	}
           19  +
           20  +	return res;
           21  +}
           22  +
           23  +static int appfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) {
           24  +	if (strcmp(path, "/") != 0) {
           25  +		return(-ENOENT);
           26  +	}
           27  +
           28  +	filler(buf, ".", NULL, 0);
           29  +	filler(buf, "..", NULL, 0);
           30  +
           31  +	return 0;
           32  +}
           33  +
           34  +static int appfs_open(const char *path, struct fuse_file_info *fi) {
           35  +	return(-ENOENT);
           36  +
           37  +	if ((fi->flags & 3) != O_RDONLY)
           38  +		return -EACCES;
           39  +
           40  +	return 0;
           41  +}
           42  +
           43  +static int appfs_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) {
           44  +	return(-ENOENT);
           45  +}
           46  +
           47  +static struct fuse_operations appfs_oper = {
           48  +	.getattr	= appfs_getattr,
           49  +	.readdir	= appfs_readdir,
           50  +	.open		= appfs_open,
           51  +	.read		= appfs_read,
           52  +};
           53  +
           54  +int main(int argc, char **argv) {
           55  +	return(fuse_main(argc, argv, &appfs_oper, NULL));
           56  +}
           57  +