home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / COMMS / P3NFS / INCLUDE / MP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  5.0 KB  |  176 lines

  1. #define PFS_OP_CREATE   0x01
  2. #define PFS_OP_GETATTR  0x02
  3. #define PFS_OP_MKDIR    0x03
  4. #define PFS_OP_READ     0x04
  5. #define PFS_OP_READDIR  0x05
  6. #define PFS_OP_REMOVE   0x06
  7. #define PFS_OP_RENAME   0x07
  8. #define PFS_OP_RMDIR    0x08
  9. #define PFS_OP_SETATTR  0x09
  10. #define PFS_OP_WRITE    0x0a
  11. #define PFS_OP_GETDEVS  0x0b
  12. /* The same as getattr without the stat (for linkcount purposes */
  13. #define PFS_OP_STATDEV  0x0c
  14.  
  15. #define PFS_OP_TTYDATA  0x0d    /* Only with the new nfsc */
  16.  
  17. #define PREFIX    0x80    /* Prefix used with the new nfsc */
  18.  
  19. typedef struct p_inode
  20. {
  21.   int inode;
  22.   char *name;
  23.   struct p_inode *nextnam, *nextnum;
  24. } p_inode;
  25.  
  26. struct device
  27. {
  28.   char *name;
  29.   unsigned char attrib[14];
  30.   int total, free;
  31.   struct device *next;
  32. };
  33.  
  34. /* data cache */
  35. struct dcache
  36. {
  37.   struct dcache *next;
  38.   unsigned char *data;
  39.   unsigned int offset, len;
  40.   int written;
  41. };
  42.  
  43. /* attribute cache */
  44. struct cache
  45. {
  46.   struct cache *next;
  47.   unsigned int inode;
  48.   int actual_size;
  49.   struct dcache *dcache;
  50.   fattr attr;
  51. };
  52.  
  53. struct entrycache
  54. {
  55.   int inode;
  56.   entry *head;
  57.   struct entrycache *next;
  58. };
  59.  
  60. extern int psionfd, debug, gmtoffset, exiting, psion_alive, dowakeup,
  61.            old_nfsc, masterfd, query_cache, background;
  62. extern fattr root_fattr;
  63. extern char *disconnprog, *connprog;
  64. extern struct cache *datacache, *attrcache;
  65.  
  66. #ifdef __svr4__
  67. #define bzero(a,b) memset(a,0,b)
  68. #define bcopy(a,b,c) memcpy(b,a,c)
  69. #define index strchr
  70. #define rindex strrchr
  71. #endif
  72.  
  73. #if !defined(__STDC__)
  74. extern char *index(), *rindex(), *strdup();
  75. #endif
  76.  
  77.  
  78. #define THE_END        (struct entry *)-1
  79. #define PBUFSIZE       8192
  80.  
  81. #define TIMEOUT       -54
  82. #define BLOCKSIZE      1024
  83. #define FID            7 /* File system id */
  84.  
  85. #if defined(sun) && defined(__svr4__)
  86. /* 
  87.  * at least /opt/SUNWspro/bin/cc on Solaris 2.4 likes these:
  88.  */
  89. # define SIGARG (int arg)
  90. #else
  91. # define SIGARG ()
  92. #endif
  93.  
  94. #if defined(sun) && defined(__STDC__) && !defined(__svr4__)
  95. # include "sun_stdlib.h"
  96. # define __P(a) a
  97. #endif
  98.  
  99. #ifndef __P
  100. # define __P(a) ()
  101. #endif
  102.  
  103.  
  104. /* mp_main.c */
  105. #if defined(hpux) || defined(__svr4__)
  106. extern void usleep __P((int usec));
  107. #endif
  108.  
  109. /* mp_serial.c */
  110. int init_serial __P((char *dev, int speed));
  111. int fd_is_still_alive __P((int fd, int wake));
  112.  
  113. /* crc.c */
  114. int docrc16 __P((unsigned char *, int));
  115.  
  116. /* mp_mount.c */
  117. void mount_and_run __P((char *dir, char *dev, void (*proc)(), nfs_fh *root_fh));
  118.  
  119. /* mp_inode.c */
  120. extern p_inode *get_num __P((int));
  121. extern p_inode *get_nam __P((char *));
  122. extern p_inode *re_nam __P((char *, char *));
  123. extern void inode2fh __P((int, char *));
  124.  
  125. extern char *dirname __P((char *));
  126. extern char *filname __P((char *));
  127. extern char *build_path __P((char *, char *));
  128.  
  129. extern int fh2inode __P((char *));
  130. extern int getpinode __P((p_inode *inode));
  131. extern unsigned char *iso2cp __P((unsigned char *));
  132. extern unsigned char *cp2iso __P((unsigned char *));
  133.  
  134. extern struct cache *add_cache __P((struct cache **, unsigned int, fattr *));
  135. extern void          rem_cache __P((struct cache **, unsigned int));
  136. extern void          clean_cache __P((struct cache **));
  137. extern struct cache *search_cache __P((struct cache *, unsigned int));
  138.  
  139. extern struct dcache *add_dcache __P((struct cache *, unsigned int, unsigned int, unsigned char *));
  140. extern void           clean_dcache __P((struct cache *));
  141. extern struct dcache *search_dcache __P((struct cache *, unsigned int, unsigned int));
  142.  
  143. /* mp_xmit.c */
  144. int sendop __P((int cmd, char *fname, char *rest, int restlen));
  145. int getstr __P((unsigned char *str));
  146. int getanswer __P((void));
  147. void shell_feed __P((int));
  148. void init_pty __P((void));
  149. int sendcmd __P((int cmd, char *fname, char *rest, int restlen));
  150. int getcount __P((unsigned char *str, int num));
  151. int senddata __P((char *p, int len));
  152. void long2pstr __P((unsigned int l, unsigned char *s));
  153. void short2pstr __P((unsigned int l, unsigned char *s));
  154. unsigned int pstr2long __P((unsigned char *s));
  155.  
  156. /* mp_pfs_ops.c */
  157. void *nfsproc_null_2 __P((void));
  158. void *nfsproc_root_2 __P((void));
  159. void *nfsproc_writecache_2 __P((void));
  160. nfsstat *nfsproc_link_2 __P((struct linkargs *la));
  161. nfsstat *nfsproc_rmdir_2 __P((struct diropargs *da));
  162. nfsstat *nfsproc_remove_2 __P((struct diropargs *da));
  163. nfsstat *nfsproc_rename_2 __P((struct renameargs *ra));
  164. nfsstat *nfsproc_symlink_2 __P((struct symlinkargs *sa));
  165. struct readres *nfsproc_read_2 __P((struct readargs *ra));
  166. struct attrstat *nfsproc_write_2 __P((struct writeargs *wa));
  167. struct diropres *nfsproc_mkdir_2 __P((struct createargs *ca));
  168. struct diropres *nfsproc_create_2 __P((struct createargs *ca));
  169. struct diropres *nfsproc_lookup_2 __P((struct diropargs *da));
  170. struct attrstat *nfsproc_getattr_2 __P((struct nfs_fh *fh));
  171. struct attrstat *nfsproc_setattr_2 __P((struct sattrargs *sa));
  172. struct statfsres *nfsproc_statfs_2 __P((struct nfs_fh *fh));
  173. struct readdirres *nfsproc_readdir_2 __P((struct readdirargs *ra));
  174. struct readlinkres *nfsproc_readlink_2 __P((struct nfs_fh *fh));
  175.  
  176.