VFS

Tim Potter Tim.Potter at anu.edu.au
Tue Mar 16 22:50:02 GMT 1999


Quinn Coldiron writes:

> I talked to one of the Samba team members at Linux World Expo in San
> Jose a few weeks ago, but I can't remember the name.  I just remember
> he worked at SGI.

That would be Jeremy.

> Anyway, I am interested in writing a "back end" module for Samba that
> can serve database tables as filesystems and he recommended that I
> jump in on the VFS development to help finish it first, because it
> could be used as the interface to the database code.
> 
> Who do I talk to so I can begin working on this?

That would be me!

The VFS back end is pretty much finished, although not well tested as
the bit of hardware I was writing a back end for is currently broken.
)-:

At the moment, I haven't been able to merge my changes into the trunk
(Samba 2.1) as I believe there are a whole bunch of changes to be
merged from the 2.0 branch.  (Anyone have any news on when this is
happening?) 

I'd really really like to get this checked into CVS before anyone else
works on it, but here's some info to get you started.

The Samba VFS abstracts away all the disk I/O operations in the
standard way, using a whole bunch of function pointers.

struct vfs_ops {

    /* Global operations */

    int (*init)(void);

    /* Disk operations */
    
    int (*connect)(struct connection_struct *conn, char *service, 
		   char *user);
    void (*disconnect)(struct connection_struct *conn, char *service);
    SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, char *path, 
			      SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, 
			      SMB_BIG_UINT *dsize);
    
    /* Directory operations */

    DIR *(*opendir)(struct connection_struct *conn, char *fname);
    struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
    int (*mkdir)(struct connection_struct *conn, char *path, mode_t mode);
    int (*rmdir)(struct connection_struct *conn, char *path);
    
    /* File operations */
    
    int (*open)(struct connection_struct *conn, char *fname, int flags, 
		mode_t mode);
    int (*close)(struct connection_struct *conn, int fd);
    ssize_t (*read)(struct connection_struct *conn, int fd, char *data, 
		    size_t n);
    ssize_t (*write)(struct connection_struct *conn, int fd, char *data, 
		     size_t n);
    SMB_OFF_T (*lseek)(struct connection_struct *conn, int filedes, 
		       SMB_OFF_T offset, int whence);
    int (*rename)(struct connection_struct *conn, char *old, char *new);
    void (*sync)(struct connection_struct *conn, files_struct *fsp);
    int (*stat)(struct connection_struct *conn, char *fname, 
		SMB_STRUCT_STAT *sbuf);
    int (*fstat)(struct connection_struct *conn, int fd, 
		 SMB_STRUCT_STAT *sbuf);
    int (*lstat)(struct connection_struct *conn, char *path, 
		 SMB_STRUCT_STAT *sbuf);
    BOOL (*lock)(struct connection_struct *conn, int fd, int op, 
		 SMB_OFF_T offset, SMB_OFF_T count, int type);
    int (*unlink)(struct connection_struct *conn, char *path);
    int (*chmod)(struct connection_struct *conn, char *path, mode_t mode);
    int (*utime)(struct connection_struct *conn, char *path, 
		 struct utimbuf *times);
};

I've written some C to manage virtual file information based on file
descriptors but it's still a "work in progress".


Tim.

> 
> Quinn
> 

-- 
Tim Potter, System Admin/Programmer, Head Bee Guy
Advanced Computational Systems CRC, RSISE Bldg Australian National University,
Canberra 0200, AUSTRALIA Ph: +61 2 62798813 Fax: +61 2 62798602


More information about the samba-technical mailing list