VFS

Jeremy Allison jallison at cthulhu.engr.sgi.com
Wed Mar 17 02:51:56 GMT 1999


Tim Potter wrote:

> 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);
> };

Oooo - this looks really good Tim !

I am CC:ing this to John Sygulla at SGI who wants
to work on it here. Can you two co-ordinate to get
the code sent to him (I'm working on oplock hell
at the moment :-( ).

The only change I though might be nice was to remove
the 'struct connection_struct *conn' first arguments
to all the functions, and instead add this to the
init() function as an argument. We should probably
add a 'logon' and 'logoff' function also so the
shared library can associate some internal state
with the current UNIX username/uid_t pair.

That way we can load a different shared library per
share, and pass the share connection structure to
it at init time. The other functions then become
much closer to their POSIX equivalents, making it
easier for 3rd party vendors to use them.

What do you think ?

Jeremy.

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba-technical mailing list