Files and Naming Conventions

Before we get into the details of using FUSE, and of the Big Brother File System, let's see how the files are organized.

The code for the BBFS running example is in subdirectory src

Makefile
As usual, a Makefile is used to direct the compilation of the code. The code is so simple that I just hard-coded a Makefile rather than using automake; it requires pkg-config (and of course FUSE!), but everything else ought to be available in any Linux system used for development.

bbfs.c
The code re-implementing the Linux file operations is in this file. Every function defined in this file starts with bb_, so it's easy to tell my code from system code.

The file also contains a struct fuse_operations  named bb_oper, containing pointers to the functions (we'll discuss this struct in the next section)

The functions that are pointed to by fields in the struct fuse data structure all have names derived from their field names by prepending the standard bb_ prefix. So, for instance, the open() function is bb_open().

log.c and log.h
The logging code, reporting all the operations that are performed, is in log.c. Their names all start with log_, again to help identify the logging code. log.h contains prototypes for the functions that are called from elsewhere (and, of course, the only "elsewhere" in this project is bbfs.c).

params.h
This defines which version of the FUSE API is being used, defines a symbol that give me access to the pread() system call, and defines a struct bb_state that stores filesystem state.

I should also mention that nearly all of the documentation on FUSE itself is in the #include file /usr/include/fuse/fuse.h. This is where prototypes are given for all functions, and comments describe their use. My bbfs.c file started as a copy of that file, with my code inserted.

Next: Compiling and Running BBFS


Last modified: Sat Jan 1 19:45:30 MST 2011