Introduction to FUSE File system in USEr space - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Introduction to FUSE File system in USEr space

Description:

Introduction to FUSE File system in USEr space – PowerPoint PPT presentation

Number of Views:512
Avg rating:3.0/5.0
Slides: 15
Provided by: tracNc
Category:

less

Transcript and Presenter's Notes

Title: Introduction to FUSE File system in USEr space


1
Introduction to FUSE(File system in USEr space)
2
Agenda
  • Brief to VFS (Virtual File System)
  • FUSE (File system in USEr space)
  • Hello world file system programming tutorial
  • Demo a simple fuse file system example

3
Brief to VFS (Virtual File System) (1/3)
  • Why VFS is needed

cp /mnt/ext2/data /mnt/FAT32/data
User AP
User space
Kernel space
FAT32
Kernel
mount as /mnt/FAT32
User AP should know about every IO functions of
each file systems to feed the need completing
every IO operations. A common interface for user
AP to call IO functions is necessary.
Ext2/3
mount as /mnt/ext2
4
Brief to VFS (Virtual File System) (2/3)
  • How VFS works

cp /mnt/ext2/data /mnt/FAT32/data
User AP
User space
Kernel space
Kernel
VFS
Providing a common interface for every IO
functions.
5
Brief to VFS (Virtual File System) (3/3)
  • Issues developers shall address
  • Hard work for kernel-programming (as drivers)

User AP
User space
Kernel space
Kernel
Kernel
VFS
VFS
Special-purpose File System
6
FUSE (File system in USEr space) (1/4)
  • The role FUSE plays
  • Programming a file system in user-space

User AP
User-level program
User space
Kernel space
FAT32
Kernel
VFS
Ext2/3
FUSE
7
FUSE (File system in USEr space) (2/4)
  • How user-level file system works

cat /mnt/user_level_fs/data
4
User AP
User-level program
User space
Kernel space
FAT32
Kernel
VFS
1.Call open( ) read( )
2.Bypass the IO call to FUSE module
Ext2/3
3.Diver the IO call to upper level
5
4.User-level program open( ) read( ) are
invoked
FUSE
5.Return the result to user AP
mount as /mnt/user_level_fs
8
FUSE (File system in USEr space) (3/4)
  • FUSE-based file system FTPFS
  • Scenario list the files on the remote FTP server

User command ls /mnt/ftpfs
FTPFSuser-levelprogram
User AP
User space
Kernel space
Kernel
Bypass to user-level program
VFS
9
FUSE (File system in USEr space) (4/4)
  • How to install FUSE package
  • How to build and execute FUSE program

tar zxvf fuse-2.7.3.tar.gz cd fuse-2.7.3
./configure make make install
gcc fuse_example.c o fuse_example
-D_FILE_OFFSET_BITS64 lfuse ./fuse_example
/mnt/mount_point
10
Hello world file system programming tutorial
(1/)
  • Main function and function pointers

static struct fuse_operations hello_oper
.getattr hello_getattr, .readdir
hello_readdir, .open hello_open, .read
hello_read, int main(int argc, char
argv) return fuse_main(argc, argv,
hello_oper, NULL)
IO operations left for developers to implement
11
Hello world file system programming tutorial
(2/)
cd /mnt/mount_point
ls

? getattr( ), access( ), and readdir( ) are
called.
hello
.
..

12
Hello world file system programming tutorial
(3/)
static const char hello_path "/hello" static
const char hello_str "Hello World!\n" static
int hello_read(const char path, char buf,
size_t size, off_t offset, struct
fuse_file_info fi) size_t len (void)
fi if(strcmp(path, hello_path) ! 0) return
-ENOENT len strlen(hello_str) if (offset lt
len) if (offset size gt len) size len -
offset memcpy(buf, hello_str offset,
size) else size 0 return size
cd /mnt/mount_point
cat hello

? getattr( ), access( ), and read( ) are called.
Hello World!

13
Demo a simple fuse file system example
14
File system operations interface FUSE specified
Common operations
Low-level operations
Write a Comment
User Comments (0)
About PowerShow.com