tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Implementation Proposal for Subfile GSoC



In article <B8E45441-1D71-47D4-AF3E-4AC065930C51%gmail.com@localhost> Adam 
wrote:
: I'll be implementing subfile support and wanted to get some feedback  
: on what the community thinks of the additions/design decisions my  
: mentor and I have been thinking of making. Any questions and/or  
: comments are welcome.


: Changes that need to be made to the file system
:            o Add a flag to the file system superblock to show if  
: subfiles are supported on the filesystem
:            o Add two new inode types ( IFSFDIR and IFSFREG )

: An IFSFDIR:
: * is referenced by exactly one base inode, add a back pointer to the  
: inode struct
: * contents are same as normal directory, struct direct.
: * contains a ?.? entry that references the IFSFDIR.
: * contains a ?..? entry that references the base inode
: * entries may only reference IFSFREG there may be no subdirectories or  
: device nodes
: * is instantiated on demand
: * is removed when the base inode is removed
: * does not have independent access control (uid, gid, mode), refer the  
: the base inode

: An IFSFREG:
: * is just like an IFREG
: * could (should?) contain a back pointer to the IFSFDIR
: * can only have a link count of 1
: * can be deleted explicitly (see subfile_remove(), below)
: * is deleted when the base inode is deleted
: * does not have independent access control (uid, gid, mode), refer the  
: the base inode

: When a base inode is deleted, the subfile tree has to be deleted also.  
: Changes to remove() would be needed.

  Will you also enhance fsck to handle subfiles?


: OS Level - System Calls
:      * o int subfile_fdopen (int basefilefd, char * subfilename, int  
: open_flags);
:                  + subfile_fdopen acts much like regular fdopen(2)  
: except it is passed a basefile fd to open then opens the subfile of  
: the basefile.

  fdopen is in section 3 and returns a FILE * given an int file
descriptor.  I think subfile_fopen would be a better name, given that
fstat(2) stats a file by descriptor while stat(2) stats a file by
name.

:         o int subfile_open (char * basefilename, char * subfilename,  
: int open_flags);
:                  + subfile_fdopen is the same as subfile_open except  
: it uses a file descriptor to reference the basefile.

: Both of these open functions would return a normal file descriptor to  
: the subfile upon a successful open, a fd that can be used with normal  
: read, write, close, etc.

:     *     o opendir -modified to open the sub_file folder of a file if  
: the file?s inode contains a sub_file folder reference

  This might confuse programs that rely on opendir to fail for regular
files.  Might not be a real problem, though.

:            o int subfile_stat (char * basefilename, char *  
: subfilename, struct stat * sb);
:            o int subfile_fdstat (int basefilefd, char * subfilename,  
: struct stat * sb);

  subfile_fstat, see above

:            o int subfile_remove (char * basefilename, char *  
: subfilename);
:            o int subfile_fdremove (int basefilefd, char * subfilename);

  subfile_fremove, see above.

                                        yours,
                                        dillo


Home | Main Index | Thread Index | Old Index