11 /* To make it compile on NT: extracts from Linux 2.0 *
12 * <statbuf.h> and <sys/stat.h> */
13 #define __S_IFMT 0170000 /* These bits determine file type. */
14 #define __S_IFDIR 0040000 /* Directory. */
15 #define __S_IFREG 0100000 /* Regular file. */
16 #define __S_IWUSR 0000200 /* Writable for user. */
17 #define __S_IWGRP 0000200 /* Writable for group. */
18 #define __S_IWOTH 0000200 /* Writable for others. */
20 #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
21 #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
22 /* These bits are defined in Borland C++ 5 but not in MS Visual C++ */
24 # define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
27 # define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
30 #define S_IWUSR __S_IWUSR
33 #define S_IWGRP __S_IWGRP
36 #define S_IWOTH __S_IWOTH
39 #include <io.h> /* For open(), lseek() etc. */
51 /* CP/M file attributes */
56 /* F5-F8 are banned in CP/M 2 & 3, F7 is used by ZSDOS */
57 #define CPM_ATTR_RO 256 /* Read-only */
58 #define CPM_ATTR_SYS 512 /* System */
59 #define CPM_ATTR_ARCV 1024 /* Archive */
60 #define CPM_ATTR_PWDEL 2048 /* Password required to delete */
61 #define CPM_ATTR_PWWRITE 4096 /* Password required to write */
62 #define CPM_ATTR_PWREAD 8192 /* Password required to read */
64 typedef int cpm_attr_t;
75 struct cpmSuperBlock *sb;
90 char name[2+8+1+3+1]; /* 00foobarxy.zzy\0 */
103 #define CPMFS_HI_USER (0x1<<0) /* has user numbers up to 31 */
104 #define CPMFS_CPM3_DATES (0x1<<1) /* has CP/M+ style time stamps */
105 #define CPMFS_CPM3_OTHER (0x1<<2) /* has passwords and disc label */
106 #define CPMFS_DS_DATES (0x1<<3) /* has datestamper timestamps */
107 #define CPMFS_EXACT_SIZE (0x1<<4) /* has reverse exact file size */
110 #define CPMFS_P2DOS (CPMFS_CPM3_DATES|CPMFS_HI_USER)
111 #define CPMFS_DR3 (CPMFS_CPM3_DATES|CPMFS_CPM3_OTHER|CPMFS_HI_USER)
112 #define CPMFS_ISX (CPMFS_EXACT_SIZE)
113 #define CPMFS_ZSYS (CPMFS_HI_USER)
126 struct dsEntry create;
127 struct dsEntry access;
128 struct dsEntry modify;
146 int extents; /* logical extents per physical extent */
147 struct PhysDirectoryEntry *dir;
156 struct cpmInode *root;
160 char libdskGeometry[256];
175 extern const char cmd[];
176 extern const char *boo;
178 int match(const char *a, const char *pattern);
179 void cpmglob(int opti, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv);
181 int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format);
182 int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i);
183 void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf);
184 int cpmUnlink(const struct cpmInode *dir, const char *fname);
185 int cpmRename(const struct cpmInode *dir, const char *old, const char *newname);
186 int cpmOpendir(struct cpmInode *dir, struct cpmFile *dirp);
187 int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent);
188 void cpmStat(const struct cpmInode *ino, struct cpmStat *buf);
189 int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib);
190 int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib);
191 int cpmChmod(struct cpmInode *ino, mode_t mode);
192 int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode);
193 int cpmRead(struct cpmFile *file, char *buf, int count);
194 int cpmWrite(struct cpmFile *file, const char *buf, int count);
195 int cpmClose(struct cpmFile *file);
196 int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode);
197 void cpmUtime(struct cpmInode *ino, struct utimbuf *times);
198 int cpmSync(struct cpmSuperBlock *sb);
199 void cpmUmount(struct cpmSuperBlock *sb);
200 int cpmCheckDs(struct cpmSuperBlock *sb);