FUSE: virtual directories

I'm trying to make a FUSE that organizes files based on extension (.png, .c, ...). I want to display a set of folders in the FUSE root directory, each one representing a file extension. When someone is cd

in this folder, it should display all files with this extension (the user will indicate which directory should be organized during installation). For example, the output should look like this:

mount/$ ls
+c +cpp +png +py
mount/$ cd +c
mount/+c/$ ls
hello.c xyz.c

      

I am using +

to replace the .

extension.

I use the set implementation and scan through the desired directory and its subdirectories to find all file extensions, and then just display the contents of the set in readdir.

int my_readdir(const char* path, void* buffer, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi)
{
   filler(buffer,".",NULL,0);
   filler(buffer,"..",NULL,0);
   if(strcmp("/",path)==0)
   {
     int i;
     for(i=0;i<ext_set.length;i++)
     {
       filler(buffer,ext_set.get(i),NULL,0);
     }
   }
}

      

I get output as shown above, however they are not listed as directories. cd +c

throws +c: Not a directory

(which obviously isn't).

How do I make them virtual directories?

+3
fuse


source to share


No one has answered this question yet

Check out similar questions:

ten
A fused virtual file system in Perl
6
Windows 2008: virtual filesystem (like FUSE)
3
opendir () in FUSE
2
FUSE implementation
1
df-statfs on FUSE filesystem
1
directory lists using FUSE
0
fuse End point of vehicle not connected
0
JBoss Fuse 7.1 Karaf
0
Copy / Move Semantics to FUSE
0
Python print to stderr in generator



All Articles
Loading...
X
Show
Funny
Dev
Pics