From: Simon 'Linux' Johnston (skj@rb.icl.co.uk)
Date: 07/02/93


From: skj@rb.icl.co.uk (Simon 'Linux' Johnston)
Subject: Re: Linux/(OS/2) Installable file system?
Date: 2 Jul 1993 15:44:08 GMT

Simon 'Linux' Johnston (skj@rb.icl.co.uk) wrote:
: the source if you want (if I can find it) it is however poorly
: documented.

Well alot of people wanted it, and Ive found it. It is attached after
the sig file. each of the 5 files (os220fsd.c / os220fsd.def / makefile /
fsh.h / fsd.h) are seperated by lines of '=' (see top of file). It
really isnt much to get excited about, but enjoy it anyway.

,------------------------------------------------------------------------------.
| Simon K. Johnston - Development Engineer | ICL Retail Systems, |
| ------------------------------------------------------ | 3/4 Willoughby Road,|
| Unix Mail : S.K.Johnston.bra0801@oasis.icl.co.uk | Bracknell, Berks, |
| Telephone : +44 (0)344 476320 Fax: +44 (0)344 476084 | United Kingdom |
| Internal : 7621 6320 OP Mail: S.K.Johnston@BRA0801 | RG12 8TJ |
`------------------------------------------------------------------------------'

=========================================
IFS C code
=========================================

#define INCL_DOSINFOSEG
#define INCL_DOSERRORS
#define INCL_DOSFILEMGR
#define INCL_DOSINFOSEG

#include <os2.h>
#include <fsd.h>
#include <fsh.h>

int acrtused=0; // force no runtime include
/*
 *** FSD mandatory globals to export
 */

extern ULONG FS_ATTRIBUTE;
extern CHAR FS_NAME [];

/*
 *** Globals which fsd's must export
 */

ULONG FS_ATTRIBUTE = FSA_REMOTE | FSA_UNC | FSA_LOCK;
CHAR FS_NAME [] = "TUNC1";

/*** FS_AllocatePageSpace - Adjust the size of the paging file
 *
 * ENTRY psffsi = File System Independent portion of SFT
 * psffsd = File System Dependent portion of SFT
 * lSize = new size ,(in bytes)
 * lWantContig = minimum contiguity requirement (in bytes)
 *
 * EXIT Returns 0 if OK
 *
 * Returns non-zero error code if error
 ***/

int far pascal
FS_AllocatePageSpace (struct sffsi far * psffsi,
                      struct sffsd far * psffsd,
                      ULONG lSize,
                      ULONG lWantContig)

{
    int RetCode = ERROR_NOT_SUPPORTED;

    return RetCode;

    /* to avoid compiler warning */
    psffsi; psffsd; lSize; lWantContig;

} /* FS_AllocatePageSpace */

/* put stand-alone fs_xxx functions in separate code segment */

int far pascal
FS_ATTACH (USHORT flag,
           PCHAR pDev,
           PVOID pvpfsd,
           PVOID pcdfsd,
           PCHAR pParm,
           PUSHORT pLen)
{
        return ERROR_NOT_SUPPORTED;

        flag; pDev; pvpfsd; pcdfsd; pParm; pLen;
}

int far pascal
FS_CHGFILEPTR (struct sffsi far * psffsi,
               struct sffsd far * psffsd,
               LONG offlSeek,
               USHORT type,
               USHORT IOflag)
{

    return ERROR_NOT_SUPPORTED;

    /* to prevent compiler warnings */
    IOflag; psffsi; psffsd; offlSeek; type;
}

int far pascal
FS_CHDIR (flag, pcdfsi, pcdfsd, pDir, iCurDirEnd)
USHORT flag;
struct cdfsi far * pcdfsi;
struct cdfsd far * pcdfsd;
CHAR far * pDir;
USHORT iCurDirEnd;
{

    return ERROR_NOT_SUPPORTED;

    /* no warnings */
    flag; pcdfsi; pcdfsd; pDir; iCurDirEnd;
}

int far pascal
FS_CLOSE (USHORT type,
          USHORT IOflag,
          struct sffsi far *psffsi,
          struct sffsd far *psffsd)
{
    USHORT erc = ERROR_NOT_SUPPORTED;
    return erc;

    /* for the compiler */
    type; IOflag; psffsi; psffsd;
}

int far pascal
FS_COMMIT (USHORT type,
           USHORT IOflag,
           struct sffsi far *psffsi,
           struct sffsd far *psffsd)
{
    return ERROR_NOT_SUPPORTED;

    /* to prevent W3 warnings */
    psffsi; psffsd; type; IOflag;

}

/*
 *** FS_COPY - Not supported (yet) for HPFS (Pinball)
 *
 */

/* put stand-alone fs_xxx functions in separate code segment */

int far pascal
FS_COPY (USHORT Flag,
         struct cdfsi far * pcdfsi,
         struct cdfsd far * pcdfsd,
         PCHAR pSrc,
         USHORT iSrcCurDirEnd,
         PCHAR pDst,
         USHORT iDstCurDirEnd,
         USHORT nameType)
{
        return (ERROR_CANNOT_COPY);

        Flag; pcdfsi; pcdfsd; pSrc; iSrcCurDirEnd;
        pDst; iDstCurDirEnd; nameType;
}

int far pascal
FS_DELETE (pcdfsi, pcdfsd, pFile, iCurDirEnd)
struct cdfsi far * pcdfsi;
struct cdfsd far * pcdfsd;
char far * pFile;
USHORT iCurDirEnd;
{

        return ERROR_NOT_SUPPORTED;

        pcdfsi; pcdfsd; pFile; iCurDirEnd;
}

int far pascal
FS_DOPAGEIO (struct sffsi far * psffsi,
             struct sffsd far * psffsd,
             struct PageCmdHeader far *pList)

{

    return ERROR_NOT_SUPPORTED;

    /* to avoid compiler warning */
    psffsi; psffsd; pList;

} /* FS_DoPageIO */

void far pascal
FS_EXIT (USHORT uid,
         USHORT pid,
         USHORT pdb)
{
        /* to satisfy /W3 */
        uid; pid; pdb;

        /* nothing to do */
}

int far pascal
FS_FILEATTRIBUTE (flag, pcdfsi, pcdfsd, pName, iCurDirEnd, pAttr)
USHORT flag;
struct cdfsi far * pcdfsi;
struct cdfsd far * pcdfsd;
char far * pName;
USHORT iCurDirEnd;
PUSHORT pAttr;
{

    return ERROR_NOT_SUPPORTED;

    flag; pcdfsi; pcdfsd; pName; iCurDirEnd; pAttr;
}

int far pascal
FS_CANCELLOCKREQUEST (struct sffsi far * psffsi,
           struct sffsd far * psffsd,
           struct filelock far * pLockRange)
{
        return ERROR_NOT_SUPPORTED;

        /* for the compiler /W3 */
        psffsi; psffsd; pLockRange;
}

int far pascal
FS_FINDCLOSE (pfsfsi, pfsfsd)
struct fsfsi far * pfsfsi;
struct fsfsd far * pfsfsd;
{

    return ERROR_NOT_SUPPORTED;

    /* to prevent /W3 warnings */
    pfsfsi; pfsfsd;
}

int far pascal
FS_FINDFROMNAME (
    struct fsfsi far * pfsfsi,
    struct fsfsd far * pfsfsd,
    PCHAR pbData, /* ptr to data buffer */
    USHORT cbData, /* size of data buffer */
    PUSHORT pcMatch, /* number of matching entries returned */
    USHORT usLevel, /* level of info returned */
    ULONG ulPos, /* unused by Pinball */
    PCHAR pbName,
    USHORT usFlags)
{

    return ERROR_NOT_SUPPORTED;

    /* suppress warning messages */
    pfsfsi; pfsfsd; pbData; cbData; pcMatch; usLevel; ulPos; pbName; usFlags;
}

int far pascal
FS_FINDFIRST (
    struct cdfsi far * pcdfsi,
    struct cdfsd far * pcdfsd,
    CHAR far * pchName, /* search pattern (including path) */
    USHORT usCurDirEnd,
    USHORT usAttr, /* search attrib (hidden/system/dir) */
    struct fsfsi far * pfsfsi,
    struct fsfsd far * pfsfsd,
    CHAR far * pbData, /* ptr to data buffer */
    USHORT cbData, /* size of data buffer */
    USHORT far * pcMatch, /* # of matching entries returned */
    USHORT usLevel, /* level of info returned */
    USHORT usFlags
)
{

    return ERROR_NOT_SUPPORTED;

    /* for the compiler /W3 */
    pcdfsd; pfsfsi; pchName; usCurDirEnd; usAttr; pfsfsi; pfsfsd;
    pbData; cbData; pcMatch; usLevel; usFlags;
}

int far pascal
FS_FILEINFO (flag, psffsi, psffsd, level, pData, cbData, IOflag)

USHORT flag;
struct sffsi far * psffsi;
struct sffsd far * psffsd;
USHORT level;
char far * pData;
USHORT cbData;
USHORT IOflag;
{

    return ERROR_NOT_SUPPORTED;

    flag; psffsi; psffsd; level; pData; cbData; IOflag;
}

/* put stand-alone fs_xxx functions in separate code segment */

int far pascal
FS_FILEIO (struct sffsi far * psffsi,
           struct sffsd far * psffsd,
           PCHAR pcCmdList,
           USHORT pusCmdLen,
           PUSHORT pusError,
           USHORT IOflag)
{
        return ERROR_NOT_SUPPORTED;

        /* for the compiler /W3 */
        psffsi; psffsd; pcCmdList; pusCmdLen; pusError; IOflag;
}

int far pascal
FS_FLUSHBUF (hVPB, usFlag)
USHORT hVPB;
USHORT usFlag; /* FLUSH_RETAIN cache data or FLUSH_DISCARD it */
{

    return ERROR_NOT_SUPPORTED;

    hVPB; usFlag;
}

int far pascal
FS_FINDNEXT (
    struct fsfsi far * pfsfsi,
    struct fsfsd far * pfsfsd,
    PCHAR pbData, /* ptr to data buffer */
    USHORT cbData, /* size of data buffer */
    PUSHORT pcMatch, /* number of matching entries returned */
    USHORT usLevel,
    USHORT usFlags
    )
{

    return ERROR_NOT_SUPPORTED;

    /* suppress warning messages */
    pfsfsi; pfsfsd; pbData; cbData; pcMatch; usLevel; usFlags;
}

int far pascal
FS_FSCTL (union argdat far * pArgDat,
          USHORT usArgType,
          USHORT usFunc,
          PCHAR pcParm,
          USHORT usLenParm,
          PUSHORT pusLenParmOut, /* len of data returned in pcParm */
          PCHAR pcData,
          USHORT usLenData,
          PUSHORT pusLenDataOut) /* len of data returned in pcData */
{
    USHORT usRet = NO_ERROR;
    return (usRet);

    /* for the compiler /W3 */
    pArgDat; usArgType; pcParm; usLenParm; usFunc; pusLenParmOut;
    pcData; usLenData; pusLenDataOut;
}

int far pascal
FS_FILELOCKS (struct sffsi far * psffsi,
           struct sffsd far * psffsd,
           struct filelock far * pUnLockRange,
           struct filelock far * pLockRange,
           ULONG far * pEventSemHandle,
           ULONG flags,
           ULONG far * pPostCt)
{
        return ERROR_NOT_SUPPORTED;

        /* for the compiler /W3 */
 psffsi; psffsd; pUnLockRange; pLockRange; pEventSemHandle; flags; pPostCt;
}

int far pascal
FS_FSINFO (flag, hVPB, p, cbData, level)
USHORT flag;
USHORT hVPB;
CHAR far * p;
USHORT cbData;
USHORT level;
{

    return ERROR_NOT_SUPPORTED;

    flag; hVPB; p; cbData; level;
}

INT far pascal
FS_INIT (PCHAR pcParm, /* passed in from config.sys line */
         ULONG DevHelp,
         ULONG far *pMiniFSD)
{
    return NO_ERROR;

    pcParm; DevHelp; pMiniFSD;
}

int far pascal
FS_IOCTL (struct sffsi far * psffsi,
          struct sffsd far * psffsd,
          USHORT cat,
          USHORT func,
          PCHAR pParm,
          USHORT lenMaxParm,
          PUSHORT plenInOutParm,
          PCHAR pData,
          USHORT lenMaxData,
          PUSHORT plenInOutData)
{

        return ERROR_NOT_SUPPORTED;

        /* to prevent /W3 warning */
        psffsd; psffsi; cat; func; pParm; lenMaxParm; plenInOutParm;
        pData; lenMaxData; plenInOutData;
}

int far pascal
FS_MKDIR (struct cdfsi far *pcdfsi,
          struct cdfsd far *pcdfsd,
          char far * pName,
          unsigned short iCurDirEnd,
          char far * pEABuf,
          unsigned short flags)
{

    return ERROR_NOT_SUPPORTED;

    /* Remove warning */
    pcdfsd; iCurDirEnd; pEABuf; pcdfsi; pName; flags;

}

INT far pascal
FS_MOUNT (USHORT fsOper, /* operation requested */
          struct vpfsi far *pvpfsi, /* ptr to file sys indep part of VPB */
          struct vpfsd far *pvpfsd, /* ptr to file sys dependent part of VPB */
          SHANDLE hVPB, /* volume handle */
          PCHAR pBoot) /* pointer to sector 0 */
{
    return ERROR_NOT_SUPPORTED;
    fsOper; pvpfsi; pvpfsd; hVPB; pBoot;
}

int far pascal
FS_MOVE (struct cdfsi far *pcdfsi,
         struct cdfsd far *pcdfsd,
         PCHAR pSrc,
         USHORT iSrcCurDirEnd,
         PCHAR pDst,
         USHORT iDstCurDirEnd,
         USHORT flags)
{

        return ERROR_NOT_SUPPORTED;

        /* to prevent /W3 warnings */
        pcdfsd; iSrcCurDirEnd; iDstCurDirEnd; pcdfsi; pSrc; pDst; flags;
}

/*
 *** FS_NMPIPE -
 *
 */

/* put stand-alone fs_xxx functions in separate code segment */

int far pascal
FS_NMPIPE (struct sffsi far * pfsfsi,
           struct sffsd far * pfsfsd,
           USHORT OpType,
           union npoper far * pOpRec,
           PCHAR pData,
           PCHAR pName)
{
        return ERROR_NOT_SUPPORTED;
        pfsfsi; pfsfsd; OpType; pOpRec; pData; pName;
}

int far pascal
FS_NEWSIZE (psffsi, psffsd, len, IOflag)
struct sffsi far * psffsi;
struct sffsd far * psffsd;
ULONG len;
USHORT IOflag;
{

    return ERROR_NOT_SUPPORTED;

    psffsi; psffsd; len; IOflag;

}
/*
 *** fs_notfy.c - FS_FINDNOTIFY routines
 *
 * Copyright Microsoft, 1988.
 */

int far pascal
FS_FINDNOTIFYCLOSE(USHORT handle)
{

    return ERROR_NOT_SUPPORTED;
    handle;
}

int far pascal
FS_FINDNOTIFYFIRST(struct cdfsi far *pcdfsi,
                   struct cdfsd far *pcdfsd,
                   PCHAR pName,
                   USHORT iCurDirEnd,
                   USHORT attr,
                   USHORT far *pHandle,
                   PCHAR pData,
                   USHORT cbData,
                   USHORT far *pcMatch,
                   USHORT level,
                   ULONG timeout)
{

    return ERROR_NOT_SUPPORTED;

    /* to shutup -W3 warnings */
    pcdfsd; iCurDirEnd; pData; cbData; pcdfsi; pName; attr; pHandle ;
    pcMatch; level; timeout;

}

int far pascal
FS_FINDNOTIFYNEXT(USHORT handle,
                  PCHAR pData,
                  USHORT cbData,
                  USHORT far *pcMatch,
                  USHORT level,
                  ULONG timeout)
{
    INT iRet = ERROR_NOT_SUPPORTED;

    return iRet;

    /* to shutup -W3 warnings */
    pData; cbData; level; handle; pcMatch; timeout;

}

int far pascal
FS_OPENCREATE (pcdfsi, pcdfsd, pcName, usCurDirEnd, psffsi, psffsd, ulOpenMode,
              usOpenFlag, pusRetAction, usAttr, pcEABuf, pfGenFlag)
struct cdfsi far * pcdfsi; /* File system indep. directory */
struct cdfsd far * pcdfsd; /* file system dep. directory */
PCHAR pcName; /* canonicalized file name */
USHORT usCurDirEnd; /* index of end of cur dir in pcName */
struct sffsi far * psffsi; /* file sys indep open file */
struct sffsd far * psffsd; /* file sys depend open file */
ULONG ulOpenMode; /* sharing and access mode */
USHORT usOpenFlag; /* action if present or absent */
PUSHORT pusRetAction; /* return for action code */
USHORT usAttr; /* file attributes */
PCHAR pcEABuf; /* Extended Attribute buffer */
PUSHORT pfGenFlag; /* return for Need eas bit */
{
        return ERROR_NOT_SUPPORTED;

        /* to satisfy /W3 */

 pcdfsi; pcdfsd; usCurDirEnd; pcName; psffsi; psffsd; ulOpenMode; usOpenFlag;
 pusRetAction; usAttr; pcEABuf; pfGenFlag;

}

int far pascal
FS_OPENPAGEFILE (PULONG pFlags, /* FirstOpen, Phys/Virt-Addr */
                 PULONG pcMaxReq, /* returned max req list len */
                 PCHAR pName, /* Name of page file */
                 struct sffsi far * psffsi, /* sft - fs independent */
                 struct sffsd far * psffsd, /* sft - fs dependent */
                 USHORT OpenMode, /* for open/create */
                 USHORT OpenFlag, /* for open/create */
                 USHORT Attr, /* for open/create */
                 ULONG Reserved)

{
    return ERROR_NOT_SUPPORTED;

    /* to avoid compiler warning */
Reserved; pFlags; pcMaxReq; pName; psffsi; psffsd; OpenMode; OpenFlag; Attr;

} /* FS_OPENPAGEFILE */

/*
 *** FS_PROCESSNAME - Process the filename to be Pinball Legal
 *
 * This routine allows the FSD to enforce a different
 * naming convention than OS/2.
 *
 * ENTRY pNameBuf = pointer to ASCIIA pathname.
 *
 * EXIT Returns NO_ERROR
 */

int far pascal
FS_PROCESSNAME (PCHAR pNameBuf) /* Path string to be processed */
{
        /*
         * Since Pinball is a true OS/2 file system, we don't need
         * to change anything.
         */
        return (NO_ERROR);

        /* Get rid of unreferenced formal parameter warning */
        pNameBuf;
}

int far pascal
FS_PATHINFO (flag, pcdfsi, pcdfsd, pName, iCurDirEnd, level, pData, cbData)
USHORT flag;
struct cdfsi far * pcdfsi;
struct cdfsd far * pcdfsd;
PCHAR pName;
USHORT iCurDirEnd;
USHORT level;
PCHAR pData;
USHORT cbData;
{
    USHORT erc = ERROR_NOT_SUPPORTED;

    return erc;

    pcdfsi; pcdfsd; iCurDirEnd; flag; pName; level; pData; cbData;
}

int far pascal
FS_READ (psffsi, psffsd, pcData, pusLen, IOflag)
struct sffsi far *psffsi;
struct sffsd far *psffsd;
CHAR far *pcData;
USHORT far *pusLen;
USHORT IOflag;
{
        USHORT usRet = ERROR_NOT_SUPPORTED;

        return (usRet);

        /* to prevent compiler warnings */
        IOflag; psffsi; psffsd; pcData; pusLen;
}

int far pascal
FS_RMDIR (pcdfsi, pcdfsd, pName, iCurDirEnd)
struct cdfsi far * pcdfsi;
struct cdfsd far * pcdfsd;
char far * pName;
unsigned short iCurDirEnd;
{
        USHORT usRet = ERROR_NOT_SUPPORTED;

        return (usRet);

        /* to prevent /W3 warnings */
        pcdfsd; iCurDirEnd; pName; iCurDirEnd;
}

/* put stand-alone fs_xxx functions in separate code segment */

int far pascal
FS_SETSWAP (struct sffsi far * psffsi,
            struct sffsd far * psffsd)
{

    /*
     * Just return no error. Since we always mark pinball segments
     * non-swappable, we don't need to do anything here.
     */
    return (NO_ERROR);

    psffsi; psffsd;
}

int far pascal
FS_SHUTDOWN (usType, ulReserved)
USHORT usType;
ULONG ulReserved;
{
    INT iRet = ERROR_NOT_SUPPORTED;

    return (iRet);

    /* for warning level 3 */
    ulReserved; usType;
}

int far pascal
FS_WRITE (psffsi, psffsd, pcData, pusLen, IOflag)
struct sffsi far * psffsi;
struct sffsd far * psffsd;
CHAR far * pcData;
USHORT far * pusLen;
USHORT IOflag;
{

        return ERROR_NOT_SUPPORTED;

        psffsi; psffsd; pcData; pusLen; IOflag;
}

=========================================
IFS DEF file
=========================================
LIBRARY

DESCRIPTION 'OS/2 File System Shell'

PROTMODE

CODE PRELOAD
DATA SINGLE SHARED PRELOAD

EXPORTS FS_ALLOCATEPAGESPACE
        FS_ATTRIBUTE = _FS_ATTRIBUTE
        FS_NAME = _FS_NAME
        FS_ATTACH
        FS_CHDIR
        FS_CHGFILEPTR
        FS_CLOSE
        FS_COMMIT
        FS_COPY
        FS_DELETE
        FS_EXIT
        FS_FILEATTRIBUTE
        FS_FILEINFO
        FS_FILELOCKS
        FS_FINDCLOSE
        FS_FINDFIRST
        FS_FINDFROMNAME
        FS_FINDNEXT
        FS_FINDNOTIFYCLOSE
        FS_FINDNOTIFYFIRST
        FS_FINDNOTIFYNEXT
        FS_FLUSHBUF
        FS_FSCTL
        FS_FSINFO
        FS_INIT
        FS_IOCTL
        FS_MKDIR
        FS_MOUNT
        FS_MOVE
        FS_NEWSIZE
        FS_NMPIPE
        FS_OPENCREATE
        FS_PATHINFO
        FS_PROCESSNAME
        FS_READ
        FS_RMDIR
        FS_SETSWAP
        FS_SHUTDOWN
        FS_WRITE
        FS_ALLOCATEPAGESPACE
        FS_DOPAGEIO
        FS_OPENPAGEFILE
        FS_CANCELLOCKREQUEST
        FS_FILEIO

=========================================
IFS makefile
=========================================
.c.obj:
        cl -c -Oti -Asfw -Zlp -G2s $*.c

os220fsd.ifs: os220fsd.obj
        link $*,,,os2+fshelper,$*.def/map/nod;
        if exist os220fsd.ifs erase os220fsd.ifs
        rename os220fsd.dll *.ifs

=========================================
IFS header 1
=========================================

#define FSA_REMOTE 1L
#define FSA_UNC 2L
#define FSA_LOCK 4L
#define FSA_CASE 8L
/*------------------------------------------------------------*/
/* Volume Parameters */
/*------------------------------------------------------------*/

/* File System Independent */
typedef struct vpfsi {
   unsigned long vpi_vid; /* 32-bit volume id */
   unsigned long vpi_hDEV; /* handle to device driver */
   unsigned short vpi_bsize; /* sector size in bytes */
   unsigned long vpi_totsec; /* total number of sectors */
   unsigned short vpi_trksec; /* sectors per track */
   unsigned short vpi_nhead; /* number of heads */
   char vpi_text[12]; /* volume name */
} VPFSI, far *PVPFSI;

/* File System Dependent */
typedef struct vpfsd {
   char vpi_work[36]; /* work area */
} VPFSD, far *PVPFSD;

/*------------------------------------------------------------*/
/* Current Directories */
/*------------------------------------------------------------*/

/* File System Independent */
typedef struct cdfsi {
   unsigned short cdi_hvpb; /* VPB handle for device */
   unsigned short cdi_end; /* offset to root of path */
   char cdi_flags; /* fs independent flags */
   char cdi_curdir[CCHMAXPATH]; /* text of current directory */
} CDFSI, far *PCDFSI;

/* File System Dependent */
typedef struct cdfsd {
   char cdd_work[8]; /* work area */
} CDFSD, far *PCDFSD;

/*------------------------------------------------------------*/
/* File Instance */
/*------------------------------------------------------------*/

/* File System Independent */
typedef struct sffsi {
   unsigned long sfi_mode; /* access/sharing mode */
   unsigned short sfi_hvpb; /* volume info. */
   FTIME sfi_ctime; /* file creation time */
   FDATE sfi_cdate; /* file creation date */
   FTIME sfi_atime; /* file access time */
   FDATE sfi_adate; /* file access date */
   FTIME sfi_mtime; /* file modification time */
   FDATE sfi_mdate; /* file modification date */
   unsigned long sfi_size; /* size of file */
   unsigned long sfi_position; /* read/write pointer */

   /* the following may be of use in sharing checks */

   unsigned short sfi_uid; /* user ID of initial opener */
   unsigned short sfi_pid; /* process ID of initial opener */
   unsigned short sfi_pdb; /* PDB (in 3x box) of initial opener */
   unsigned short sfi_selfsfn; /* system file number of file instance */
   unsigned char sfi_tstamp; /* time stamps flag */
   unsigned short sfi_type; /* type of object opened */
} SFFSI, far *PSFFSI;

/* File System Dependent */
typedef struct sffsd {
   char sfd_work[30]; /* work area */
} SFFSD, far *PSFFSD;

/*------------------------------------------------------------*/
/* File Search */
/*------------------------------------------------------------*/

/* File System Independent */
typedef struct fsfsi {
   unsigned short fsi_hvpb; /* volume info */
} FSFSI, far *PFSFSI;

/* File System Dependent */
typedef struct fsfsd {
   char fsd_work[24]; /* work area */
} FSFSD, far *PFSFSD;

=========================================
IFS header 2
=========================================

/*static char *SCCSID = "@(#)fsh.h 1.16 89/04/18";*/
/* fsh.h - FSH_ = fshelper interface declarations */
 
/*
 * FSH_DOVOLIO2 omits flag definition
 *
 * Since we are using C5.1, the function prototypes should be made to
 * conform with true ANSI standards. I have converted FSH_ADDSHARE
 * as an example.
 *
 */
 
#if 1
int far pascal
FSH_ADDSHARE(
    char far *, /* pName */
    unsigned short, /* mode */
    unsigned short, /* hVPB */
    unsigned long far * /* phShare */
);
#else
USHORT far pascal
FSH_ADDSHARE(
    PSZ pName,
    USHORT mode,
    SHANDLE hVPB,
    LHANDLE phShare
);
#endif
 
int far pascal
FSH_BUFSTATE(
    char far *, /* pBuf */
    unsigned short, /* flag */
    unsigned short far * /* pState */
);
 
int far pascal
FSH_CANONICALIZE(
    char far *, /* pPathName */
    unsigned short, /* cbPathBuf */
    char far * /* pPathBuf */
);
 
int far pascal
FSH_CHECKEANAME(
    unsigned short, /* level */
    unsigned long, /* len of name */
    char far * /* pEAName */
);
 
int far pascal
FSH_CRITERROR(
    int, /* cbMessage */
    char far *, /* pMessage */
    int, /* nSubs */
    char far *, /* pSubs */
    unsigned short /* fAllowed */
);
 
/* Flags for fAllowed
 */
#define CE_ALLFAIL 0x0001 /* FAIL allowed */
#define CE_ALLABORT 0x0002 /* ABORT allowed */
#define CE_ALLRETRY 0x0004 /* RETRY allowed */
#define CE_ALLIGNORE 0x0008 /* IGNORE allowed */
#define CE_ALLACK 0x0010 /* ACK allowed */
 
/* Return values from FSH_CRITERR
 */
#define CE_RETIGNORE 0x0000 /* User said IGNORE */
#define CE_RETRETRY 0x0001 /* User said RETRY */
#define CE_RETFAIL 0x0003 /* User said FAIL/ABORT */
#define CE_RETACK 0x0004 /* User said continue */
 
int far pascal
FSH_DEVIOCTL(
    unsigned short, /* FSDRaisedFlag */
    unsigned long, /* hDev */
    unsigned short, /* sfn */
    unsigned short, /* cat */
    unsigned short, /* func */
    char far *, /* pParm */
    unsigned short, /* cbParm */
    char far *, /* pData */
    unsigned short /* cbData */
);
 
int far pascal
FSH_DOVOLIO(
    unsigned short, /* operation */
    unsigned short, /* fAllowed */
    unsigned short, /* hVPB */
    char far *, /* pData */
    unsigned short far *, /* pcSec */
    unsigned long /* iSec */
);
 
/* Flags for operation
 */
#define DVIO_OPREAD 0x0000 /* no bit on => readi */
#define DVIO_OPWRITE 0x0001 /* ON => write else read */
#define DVIO_OPBYPASS 0x0002 /* ON => cache bypass else no bypass */
#define DVIO_OPVERIFY 0x0004 /* ON => verify after write */
#define DVIO_OPHARDERR 0x0008 /* ON => return hard errors directly */
#define DVIO_OPWRTHRU 0x0010 /* ON => write thru */
#define DVIO_OPNCACHE 0x0020 /* ON => don't cache data */
 
/* Flags for fAllowed
 */
#define DVIO_ALLFAIL 0x0001 /* FAIL allowed */
#define DVIO_ALLABORT 0x0002 /* ABORT allowed */
#define DVIO_ALLRETRY 0x0004 /* RETRY allowed */
#define DVIO_ALLIGNORE 0x0008 /* IGNORE allowed */
#define DVIO_ALLACK 0x0010 /* ACK allowed */
 
int far pascal
FSH_DOVOLIO2(
    unsigned long, /* hDev */
    unsigned short, /* sfn */
    unsigned short, /* cat */
    unsigned short, /* func */
    char far *, /* pParm */
    unsigned short, /* cbParm */
    char far *, /* pData */
    unsigned short /* cbData */
);
 
int far pascal
FSH_FINDCHAR(
    unsigned short, /* nChars */
    char far *, /* pChars */
    char far * far * /* ppStr */
);
 
int far pascal
FSH_FINDDUPHVPB(
    unsigned short, /* hVPB */
    unsigned short far * /* pHVPB */
);
 
int far pascal
FSH_FLUSHBUF(
    unsigned short, /* hVPB */
    unsigned short /* fDiscard */
);
 
/* fDiscard values
 */
#define FB_DISCNONE 0x0000 /* Do not discard buffers */
#define FB_DISCCLEAN 0x0001 /* Discard clean buffers */
 
int far pascal
FSH_FORCENOSWAP(
    unsigned short /* sel */
);
 
int far pascal
FSH_GETBUF(
    unsigned long, /* iSec */
    unsigned short, /* fPreRead */
    unsigned short, /* hVPB */
    char far * far * /* ppBuf */
);
 
/* Flags for fPreRead
 */
#define GB_PRNOREAD 0x0001 /* ON => no preread occurs */
 
int far pascal
FSH_GETOVERLAPBUF(
    unsigned short, /* hVPB */
    unsigned long, /* iSec */
    unsigned long, /* iSec */
    unsigned long far *, /* pisecBuf */
    char far * far * /* ppBuf */
);
 
int far pascal
FSH_GETVOLPARM(
    unsigned short, /* hVPB */
    struct vpfsi far * far *, /* ppVPBfsi */
    struct vpfsd far * far * /* ppVPBfsd */
);
 
int far pascal
FSH_INTERR(
    char far *, /* pMsg */
    unsigned short /* cbMsg */
);
 
int far pascal
FSH_ISCURDIRPREFIX(
    char far * /* pName */
);
 
void far pascal
FSH_LOADCHAR(
    char far * far *, /* ppStr */
    unsigned short far * /* pChar */
);
 
void far pascal
FSH_PREVCHAR(
    char far *, /* pBeg */
    char far * far * /* ppStr */
);
 
int far pascal
FSH_PROBEBUF(
    unsigned short, /* operation */
    char far *, /* pData */
    unsigned short /* cbData */
);
 
/* Values for operation
 */
#define PB_OPREAD 0x0000 /* Check for read access */
#define PB_OPWRITE 0x0001 /* Check for write access */
 
int far pascal
FSH_QSYSINFO(
    unsigned short, /* index */
    char far *, /* pData */
    unsigned short /* cbData */
);
 
/* Values for index
 */
#define QSI_SECSIZE 1 /* index to query max sector size */
#define QSI_PROCID 2 /* index to query PID,UserID and Currentpdb */
#define QSI_THREADNO 3 /* index to query abs.thread no */
#define QSI_VERIFY 4 /* index to query per-process verify */
 
int far pascal
FSH_NAMEFROMSFN(
    unsigned short, /* sfn */
    char far *, /* pName */
    unsigned short far * /* pcbName */
);
 
int far pascal
FSH_RELEASEBUF(void);
 
int far pascal
FSH_REMOVESHARE(
    unsigned long /* hShare */
);
 
int far pascal
FSH_SEGALLOC(
    unsigned short, /* flags */
    unsigned long, /* cbSeg */
    unsigned short far * /* pSel */
);
 
/* Fields for flags
 */
#define SA_FLDT 0x0001 /* ON => alloc LDT else GDT */
#define SA_FSWAP 0x0002 /* ON => swappable memory */
 
#define SA_FRINGMASK 0x6000 /* mask for isolating ring */
#define SA_FRING0 0x0000 /* ring 0 */
#define SA_FRING1 0x2000 /* ring 1 */
#define SA_FRING2 0x4000 /* ring 2 */
#define SA_FRING3 0x6000 /* ring 3 */
 
 
int far pascal
FSH_SEGFREE(
    unsigned short /* sel */
);
 
int far pascal
FSH_SEGREALLOC(
    unsigned short, /* sel */
    unsigned long /* cbSeg */
);
 
 
/* Timeout equates for all semaphore operations
 */
#define TO_INFINITE 0xFFFFFFFFL
#define TO_NOWAIT 0x00000000L
 
int far pascal
FSH_SEMCLEAR(
    void far * /* pSem */
);
 
int far pascal
FSH_SEMREQUEST(
    void far *, /* pSem */
    unsigned long /* cmsTimeout */
);
 
int far pascal
FSH_SEMSET(
    void far * /* pSem */
);
 
int far pascal
FSH_SEMSETWAIT(
    void far *, /* pSem */
    unsigned long /* cmsTimeout */
);
 
int far pascal
FSH_SEMWAIT(
    void far *, /* pSem */
    unsigned long /* cmsTimeout */
);
 
int far pascal
FSH_STORECHAR(
    unsigned short, /* chDBCS */
    char far * far * /* ppStr */
);
 
int far pascal
FSH_UPPERCASE(
    char far *, /* pName */
    unsigned short, /* cbPathBuf */
    char far * /* pPathBuf */
);
 
int far pascal
FSH_WILDMATCH(
    char far *, /* pPat */
    char far * /* pStr */
);
 
int far pascal
FSH_YIELD(void);
 
int far pascal
MFSH_DOVOLIO(
    char far *, /* Data */
    unsigned short far *, /* cSec */
    unsigned long /* iSec */
);
 
int far pascal
MFSH_INTERR(
    char far *, /* Msg */
    unsigned short /* cbMsg */
);
 
int far pascal
MFSH_SEGALLOC(
    unsigned short, /* Flag */
    unsigned long, /* cbSeg */
    unsigned short far * /* Sel */
);
 
int far pascal
MFSH_SEGFREE(
    unsigned short /* Sel */
);
 
int far pascal
MFSH_SEGREALLOC(
    unsigned short, /* Sel */
    unsigned long /* cbSeg */
);
 
int far pascal
MFSH_CALLRM(
    unsigned long far * /* Proc */
);
 
int far pascal
MFSH_LOCK(
    unsigned short, /* Sel */
    unsigned long far * /* Handle */
);
 
int far pascal
MFSH_PHYSTOVIRT(
    unsigned long, /* Addr */
    unsigned short, /* Len */
    unsigned short far * /* Sel */
);
 
int far pascal
MFSH_UNLOCK(
    unsigned long /* Handle */
);
 
int far pascal
MFSH_UNPHYSTOVIRT(
    unsigned short /* Sel */
);
 
int far pascal
MFSH_VIRT2PHYS(
    unsigned long, /* VirtAddr */
    unsigned long far * /* PhysAddr */
);