X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=cpmfs.h;h=3d73559528363a0a84dee976a9b570e9d11e1c3b;hb=refs%2Fheads%2Fupstream;hp=06126c865797c85bf99a28884ef301bb25c43ced;hpb=b1e873c5b2f6376bb39ff0fda1464cbbacbae5f7;p=debian%2Fcpmtools diff --git a/cpmfs.h b/cpmfs.h index 06126c8..3d73559 100644 --- a/cpmfs.h +++ b/cpmfs.h @@ -1,49 +1,8 @@ #ifndef CPMFS_H #define CPMFS_H -#include -#include -#include - -#ifdef _WIN32 - #include - #include - /* To make it compile on NT: extracts from Linux 2.0 * - * and */ - #define __S_IFMT 0170000 /* These bits determine file type. */ - #define __S_IFDIR 0040000 /* Directory. */ - #define __S_IFREG 0100000 /* Regular file. */ - #define __S_IWUSR 0000200 /* Writable for user. */ - #define __S_IWGRP 0000200 /* Writable for group. */ - #define __S_IWOTH 0000200 /* Writable for others. */ - - #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) - #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) - /* These bits are defined in Borland C++ 5 but not in MS Visual C++ */ - #ifndef S_ISDIR - # define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) - #endif - #ifndef S_ISREG - # define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) - #endif - #ifndef S_IWUSR - #define S_IWUSR __S_IWUSR - #endif - #ifndef S_IWGRP - #define S_IWGRP __S_IWGRP - #endif - #ifndef S_IWOTH - #define S_IWOTH __S_IWOTH - #endif - - #include /* For open(), lseek() etc. */ - #ifndef HAVE_MODE_T - typedef int mode_t; - #endif -#endif - #ifdef __cplusplus - extern "C" { +extern "C" { #endif #include "device.h" @@ -100,13 +59,17 @@ struct cpmStat time_t ctime; }; +/* Note: CPMFS_HI_USER should be split for systems with user numbers + * up to 31 and CP/M 3, which uses them, but for password entries and + * not for files. + */ #define CPMFS_HI_USER (0x1<<0) /* has user numbers up to 31 */ #define CPMFS_CPM3_DATES (0x1<<1) /* has CP/M+ style time stamps */ #define CPMFS_CPM3_OTHER (0x1<<2) /* has passwords and disc label */ #define CPMFS_DS_DATES (0x1<<3) /* has datestamper timestamps */ #define CPMFS_EXACT_SIZE (0x1<<4) /* has reverse exact file size */ -#define CPMFS_DR22 0 +#define CPMFS_DR22 (CPMFS_HI_USER) #define CPMFS_P2DOS (CPMFS_CPM3_DATES|CPMFS_HI_USER) #define CPMFS_DR3 (CPMFS_CPM3_DATES|CPMFS_CPM3_OTHER|CPMFS_HI_USER) #define CPMFS_ISX (CPMFS_EXACT_SIZE) @@ -132,22 +95,27 @@ struct dsDate struct cpmSuperBlock { struct Device dev; + int uppercase; int secLength; int tracks; int sectrk; int blksiz; int maxdir; + int dirblks; int skew; + int bootsec; int boottrk; off_t offset; int type; int size; int extents; /* logical extents per physical extent */ + int *skewtab; + char libdskGeometry[256]; + struct PhysDirectoryEntry *dir; int alvSize; int *alv; - int *skewtab; int cnotatime; char *label; size_t labelLength; @@ -157,7 +125,6 @@ struct cpmSuperBlock int dirtyDirectory; struct dsDate *ds; int dirtyDs; - char libdskGeometry[256]; }; struct cpmStatFS @@ -172,13 +139,14 @@ struct cpmStatFS long f_namelen; }; -extern const char cmd[]; -extern const char *boo; +extern char const cmd[]; +extern char const *boo; -int match(const char *a, const char *pattern); +int match(char const *a, char const *pattern); void cpmglob(int opti, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv); +void cpmglobfree(char **dirent, int entries); -int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format); +int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format, int uppercase); int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i); void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf); int cpmUnlink(const struct cpmInode *dir, const char *fname); @@ -190,17 +158,17 @@ int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib); int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib); int cpmChmod(struct cpmInode *ino, mode_t mode); int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode); -int cpmRead(struct cpmFile *file, char *buf, int count); -int cpmWrite(struct cpmFile *file, const char *buf, int count); +ssize_t cpmRead(struct cpmFile *file, char *buf, size_t count); +ssize_t cpmWrite(struct cpmFile *file, const char *buf, size_t count); int cpmClose(struct cpmFile *file); int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode); void cpmUtime(struct cpmInode *ino, struct utimbuf *times); int cpmSync(struct cpmSuperBlock *sb); -void cpmUmount(struct cpmSuperBlock *sb); +int cpmUmount(struct cpmSuperBlock *sb); int cpmCheckDs(struct cpmSuperBlock *sb); #ifdef __cplusplus - } +} #endif #endif