10 /* To make it compile on NT: extracts from Linux 2.0 *
11 * <statbuf.h> and <sys/stat.h> */
12 #define __S_IFMT 0170000 /* These bits determine file type. */
13 #define __S_IFDIR 0040000 /* Directory. */
14 #define __S_IFREG 0100000 /* Regular file. */
15 #define __S_IWUSR 0000200 /* Writable for user. */
16 #define __S_IWGRP 0000200 /* Writable for group. */
17 #define __S_IWOTH 0000200 /* Writable for others. */
19 #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
20 #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
21 /* These bits are defined in Borland C++ 5 but not in MS Visual C++ */
23 # define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
26 # define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
29 #define S_IWUSR __S_IWUSR
32 #define S_IWGRP __S_IWGRP
35 #define S_IWOTH __S_IWOTH
38 #include <io.h> /* For open(), lseek() etc. */
50 /* CP/M file attributes */
55 /* F5-F8 are banned in CP/M 2 & 3, F7 is used by ZSDOS */
56 #define CPM_ATTR_RO 256 /* Read-only */
57 #define CPM_ATTR_SYS 512 /* System */
58 #define CPM_ATTR_ARCV 1024 /* Archive */
59 #define CPM_ATTR_PWDEL 2048 /* Password required to delete */
60 #define CPM_ATTR_PWWRITE 4096 /* Password required to write */
61 #define CPM_ATTR_PWREAD 8192 /* Password required to read */
63 typedef int cpm_attr_t;
74 struct cpmSuperBlock *sb;
89 char name[2+8+1+3+1]; /* 00foobarxy.zzy\0 */
103 #define CPMFS_P2DOS 1
119 int extents; /* logical extents per physical extent */
120 struct PhysDirectoryEntry *dir;
129 struct cpmInode *root;
144 extern const char cmd[];
145 extern const char *boo;
147 int match(const char *a, const char *pattern);
148 void cpmglob(int opti, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv);
150 int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format);
151 int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i);
152 void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf);
153 int cpmUnlink(const struct cpmInode *dir, const char *fname);
154 int cpmRename(const struct cpmInode *dir, const char *old, const char *newname);
155 int cpmOpendir(struct cpmInode *dir, struct cpmFile *dirp);
156 int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent);
157 void cpmStat(const struct cpmInode *ino, struct cpmStat *buf);
158 int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib);
159 int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib);
160 int cpmChmod(struct cpmInode *ino, mode_t mode);
161 int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode);
162 int cpmRead(struct cpmFile *file, char *buf, int count);
163 int cpmWrite(struct cpmFile *file, const char *buf, int count);
164 int cpmClose(struct cpmFile *file);
165 int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode);
166 int cpmSync(struct cpmSuperBlock *sb);
167 void cpmUmount(struct cpmSuperBlock *sb);