home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
disk
/
misc
/
filecache
/
filecache.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-27
|
3KB
|
80 lines
/****************************/
/* Include pour FileCache */
/* Sat Feb 6 22:49:54 1993 */
/****************************/
#define FILECACHEPORTNAME "FileCache.Port" /* Port Name of Server */
struct FileCacheMsg
{
struct Message fcm_Msg;
ULONG fcm_Command; /* commands sended to server */
ULONG fcm_Flags; /* flags */
ULONG fcm_Error; /* Error code returned by server */
union
{
struct
{ /* fields for file operations */
STRPTR FileName; /* filename with or without path */
STRPTR *Directory; /* array of directory with FC_MULTIPLEDIR flag */
ULONG DirIndex; /* Index of directory */
ULONG FileBuffer; /* pointer to memory of the file */
ULONG FileLength; /* size of file in memory pointed by FileBuffer */
ULONG Reserved0; /* set to 0 */
} FileCmd;
struct
{ /* fields for cache operation */
ULONG CacheSize; /* Size of cache in bytes */
ULONG MemoryUsed; /* memory used by the cache (in bytes) */
UWORD NbFiles; /* number of file in cache */
UWORD NbLocks; /* nmuber of locks on server */
} CacheCmd;
} ExtCmdInfo;
ULONG fcm_Reserved[2]; /* set to 0 */
};
/* a cheap way to hide the union and struct mess */
#define fcm_FileName ExtCmdInfo.FileCmd.FileName
#define fcm_Directory ExtCmdInfo.FileCmd.Directory
#define fcm_DirIndex ExtCmdInfo.FileCmd.DirIndex
#define fcm_FileBuffer ExtCmdInfo.FileCmd.FileBuffer
#define fcm_FileLength ExtCmdInfo.FileCmd.FileLength
#define fcm_CacheSize ExtCmdInfo.CacheCmd.CacheSize
#define fcm_MemoryUsed ExtCmdInfo.CacheCmd.MemoryUsed
#define fcm_NbFiles ExtCmdInfo.CacheCmd.NbFiles
#define fcm_NbLocks ExtCmdInfo.CacheCmd.NbLocks
/* definitions des commandes fcm_Command */
#define FC_CMD_QUIT 0 /* flush cache and kill FileCache if possible */
#define FC_CMD_GETTOKEN 1 /* locks FileCache server */
#define FC_CMD_DELTOKEN 2 /* unlock FileCache server */
#define FC_CMD_LOAD 3 /* load a file */
#define FC_CMD_FLUSH 4 /* flush the cache */
#define FC_CMD_SETMEM 5 /* modify size of cache */
#define FC_CMD_INFO 6 /* returns infos on cache */
#define FC_CMD_DELETE 7 /* remove a file from cache */
#define FC_CMD_DEBUG 8 /* PRIVATE (don't use) */
#define FC_CMD_LAST FC_CMD_DEBUG
/* definitions for fcm_Flags */
#define FC_NOUPDATE 1 /* don't check file modification */
#define FC_MULTIPLEDIR 2 /* Use the array of directory put in fcm_Directory */
#define FC_USEWRITEFLAG 4 /* if FIBF_WRITE set don't check file changes */
/* definitions des erreurs fcm_Error */
#define FC_ERR_OK 0 /* No errorr */
#define FC_ERR_NOMEMORY 1 /* not enough memory */
#define FC_ERR_NOFILE 2 /* file don't exist */
#define FC_ERR_DIRECTORY 3 /* it's a directory */
#define FC_ERR_READERROR 4 /* can't read this file */
#define FC_ERR_FILETOOBIG 5 /* file bigger than cache */
#define FC_ERR_CANTOPENFILE 6 /* can't open file */
#define FC_ERR_INUSE 7 /* Can't kill server, still locked */
#define FC_ERR_UPDATE 8 /* Error for checking file */
#define FC_ERR_NOTINCACHE 9 /* file not in cache (FC_CMD_DELETE) */
#define FC_ERR_BADCOMMAND 100 /* unknown command */