summaryrefslogtreecommitdiff
path: root/ext.h
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2020-01-03 09:22:03 -0800
committerXin Li <delphij@google.com>2020-01-03 09:22:03 -0800
commit21386e05d8aee3cd69124c826bf10da19726e045 (patch)
treefa9e56f15a0f963937328dd47b370179bcc1faa6 /ext.h
parenta4cbc8877ec4eb004eb0a84d20dd53d1e40fa401 (diff)
downloadfsck_msdos-21386e05d8aee3cd69124c826bf10da19726e045.tar.gz
Import revision 41655e1cf1451b788f6437c91ec74bcecd2192b7 from FreeBSD.
Change-Id: Iba2df7def1a28d101a8b6667bda211b9685b35c7
Diffstat (limited to 'ext.h')
-rw-r--r--ext.h47
1 files changed, 28 insertions, 19 deletions
diff --git a/ext.h b/ext.h
index ebc9467..6e9ba7f 100644
--- a/ext.h
+++ b/ext.h
@@ -32,6 +32,8 @@
#include <sys/types.h>
+#include <stdbool.h>
+
#include "dosfs.h"
#define LOSTDIR "LOST.DIR"
@@ -44,6 +46,7 @@ extern int alwaysyes; /* assume "yes" for all questions */
extern int preen; /* we are preening */
extern int rdonly; /* device is opened read only (supersedes above) */
extern int skipclean; /* skip clean file systems if preening */
+extern int allow_mmap; /* allow the use of mmap() */
/*
* function declarations
@@ -72,7 +75,6 @@ int checkfilesys(const char *);
#define FSERROR 8 /* Some unrecovered error remains */
#define FSFATAL 16 /* Some unrecoverable error occurred */
#define FSDIRTY 32 /* File system is dirty */
-#define FSFIXFAT 64 /* Fix file system FAT */
/*
* read a boot block in a machine independent fashion and translate
@@ -85,46 +87,53 @@ int readboot(int, struct bootblock *);
*/
int writefsinfo(int, struct bootblock *);
-/*
- * Read one of the FAT copies and return a pointer to the new
- * allocated array holding our description of it.
- */
-int readfat(int, struct bootblock *, u_int, struct fatEntry **);
+/* Opaque type */
+struct fat_descriptor;
-/*
- * Check two FAT copies for consistency and merge changes into the
- * first if necessary.
- */
-int comparefat(struct bootblock *, struct fatEntry *, struct fatEntry *, u_int);
+void fat_clear_cl_head(struct fat_descriptor *, cl_t);
+bool fat_is_cl_head(struct fat_descriptor *, cl_t);
+
+cl_t fat_get_cl_next(struct fat_descriptor *, cl_t);
+
+int fat_set_cl_next(struct fat_descriptor *, cl_t, cl_t);
+
+cl_t fat_allocate_cluster(struct fat_descriptor *fat);
+
+struct bootblock* fat_get_boot(struct fat_descriptor *);
+int fat_get_fd(struct fat_descriptor *);
+bool fat_is_valid_cl(struct fat_descriptor *, cl_t);
/*
- * Check a FAT
+ * Read the FAT 0 and return a pointer to the newly allocated
+ * descriptor of it.
*/
-int checkfat(struct bootblock *, struct fatEntry *);
+int readfat(int, struct bootblock *, struct fat_descriptor **);
/*
* Write back FAT entries
*/
-int writefat(int, struct bootblock *, struct fatEntry *, int);
+int writefat(struct fat_descriptor *);
/*
* Read a directory
*/
-int resetDosDirSection(struct bootblock *, struct fatEntry *);
+int resetDosDirSection(struct fat_descriptor *);
void finishDosDirSection(void);
-int handleDirTree(int, struct bootblock *, struct fatEntry *);
+int handleDirTree(struct fat_descriptor *);
/*
* Cross-check routines run after everything is completely in memory
*/
+int checkchain(struct fat_descriptor *, cl_t, size_t *);
+
/*
* Check for lost cluster chains
*/
-int checklost(int, struct bootblock *, struct fatEntry *);
+int checklost(struct fat_descriptor *);
/*
* Try to reconnect a lost cluster chain
*/
-int reconnect(int, struct bootblock *, struct fatEntry *, cl_t);
+int reconnect(struct fat_descriptor *, cl_t, size_t);
void finishlf(void);
/*
@@ -138,6 +147,6 @@ const char *rsrvdcltype(cl_t);
/*
* Clear a cluster chain in a FAT
*/
-void clearchain(struct bootblock *, struct fatEntry *, cl_t);
+void clearchain(struct fat_descriptor *, cl_t);
#endif