How To Add A Driver

From SRB

The following gives a brief description of the steps required to add a new
type of file system to the SRB. An examples of adding a new file system
"xyzFs" is also given.

1) Write the 16 POSIX I/O functions given in exfSw.h for the "xyzFs" file 
system.  The unixFileDvr.c gives examples of the 16 functions for the UNIX 
file system.

2) Add an entry to the end of the exfsw[] table in exfSw.h for the "xyzFs" 
which are basically the name of the 16 functions written in step 1). e.g.,

    , { xyzCreate, xyzOpen, xyzClose,
      xyzUnlink, xyzRead, xyzWrite, xyzSeek,
      xyzSync, xyzStat, xyzFstat, xyzMkdir, xyzChmod,
      xyzRmdir, xyzOpendir, xyzClosedir, xyzReaddir,
      dummy_rt, dummy_rt, dummy_rt, dummy_rt, dummy_rt }

3) Add a line which defines the file type index in the srb.h file. e.g.,
currently we have:

#define UNIX_FT         0       /* The local Unix file type */
#define UNITREE_FT      1       /* The Unix file type */
#define HPSS_FT         2       /* The HPSS file type */
#define FTP_FT          3       /* The FTP file type */
#define HTTP_FT         4       /* The HTTP file type */
#define NULL_FT         5       /* The NULL file type */
#define DPSS_FT         6       /* The DPSS file type */
#define NTFS_FT         7       /* The Windows NTFS file type */
#define ADS_FT          8       /* The ADS (UK) file type */
#define CMSTORE_FT      9       /* The CM file type */
#define DCACHE_FT       10      /* The fnal/DESY dCache file type */
#define GRIDFTP_FT      11      /* grid ftp file system */

We should add:

#define XYZ_FT          12       /* The XYZ file type */

4) Add a line in the srbObjTypeEntry[] table in clMisc.h. e.g.,
    {"xyzFs",                FILE_TYPE,      XYZ_FT,        DO_CHKDIR},

(This use to be in srbMisc.h but is now in clMisc.h (starting with 3.4.0).)
The srbObjTypeMap struct is defined in srbMiscExtern.h. This table
associates a logical resource type "xyzFs" with its properties.

5) Register the resource type "xyzFs file system" with MCAT using the 
"Add New Token" option of the Java admin GUI. The resource type 
"xyzFs file system" is now visible to the federation under this MCAT.

6) We can now create new resources using this resource type 
("xyzFs file system" will now be displayed in the Resource Type Scrolling List 
in the  Create New Resource menu) using the java admin GUI.

7) If authentication is required for the SRB servers to access data stored
in "xyzFs" such as in the case of the HPSS system, a set of authentication
routines for the "xyzFs" is required. These routines should be invoked
during the SRB server startup. For example, the authentication routine for 
the HPSS system is SetLoginContext() and it is added to the initSrbServer() 
in srbServerMisc.c.