|
|
1.1 root 1: /* dos1.h */
2: /* Common header for "dos" and "dosshrink" commands. */
3:
4: #include <stdio.h>
5: #include "bpb.h"
6: #include "mdir.h"
7:
8: /* Manifest constants. */
9: #define BBSIZE 512 /* Boot block size */
10: #define CLBAD 0xFFF7 /* FAT bad cluster */
11: #define CLEOF 0xFFFF /* FAT end of file marker */
12: #define CLFREE 0x0000 /* FAT free cluster */
13: #define CLMAX 0xFFEF /* Maximum FAT normal cluster */
14: /*
15: * The FAT cache must hold a complete 1.5-byte FAT expanded to 2 bytes/entry,
16: * so it must contain at least 4096 * 2 = 8192 bytes or 16 sectors.
17: */
18: #define FATCSECS (16) /* Sectors in FAT cache */
19: #define FATCNPSEC (BBSIZE/sizeof(short)) /* 2-byte FAT clusters per sector */
20: #define FATCCOUNT (FATCSECS*FATCNPSEC) /* 2-byte FAT cache entries */
21: #define FATMASK 0x0FFF /* Mask for 1.5-byte FAT entry */
22: #define INFILE "/dev/dos" /* Default input file name */
23: #define isdir(mdp) ((mdp)->m_attr&MSUBDIR) /* MS-DOS directory test */
24: #define ishidden(mdp) ((mdp)->m_attr&MHIDDEN) /* MS-DOS directory test */
25: #define is_media_id(n) (((n)&0xF0)==0xF0) /* Media descriptor test */
26:
27: #if DEBUG
28: #define dbprintf(arglist) printf arglist
29: #else
30: #define dbprintf(arglist)
31: #endif
32:
33: /* Externals. */
34: extern void exit();
35: extern long lseek();
36: extern char *malloc();
37:
38: /* Globals in dos1.c. */
39: /* Diskette parameters. */
40: extern BPB d8floppy;
41: extern BPB d9floppy;
42: extern BPB d15floppy;
43: extern BPB d18floppy;
44: extern BPB q9floppy;
45: extern BPB s8floppy;
46: extern BPB s9floppy;
47:
48: /* Other globals. */
49: extern char *argv0;
50: extern unsigned char bootb[BBSIZE];
51: extern BPB *bpb;
52: extern short cflag;
53: extern unsigned char *clbuf;
54: extern unsigned short clsize;
55: extern unsigned short dirbase;
56: extern unsigned short dirsize;
57: extern unsigned short fatbase;
58: extern unsigned short fatbytes;
59: extern unsigned short *fatcache;
60: extern unsigned short fatccount;
61: extern unsigned short fatcfirst;
62: extern short fatcflag;
63: extern unsigned short fatcmax;
64: extern unsigned short fatcmin;
65: extern unsigned short fatsize;
66: extern unsigned short filebase;
67: extern short fsfd;
68: extern unsigned short heads;
69: extern unsigned short maxcluster;
70: extern unsigned short mdirsize;
71: extern unsigned short nspt;
72: extern unsigned short sectors;
73: extern unsigned short ssize;
74: extern char *usagemsg;
75: extern short vflag;
76:
77: /* Functions in dos1.c. */
78: extern unsigned long cltosec();
79: extern void decodefat();
80: extern void diskread();
81: extern void diskseek();
82: extern void diskwrite();
83: extern void fatal();
84: extern void fatcflush();
85: extern void fatcread();
86: extern unsigned short getcluster();
87: extern char *lcname();
88: extern void putcluster();
89: extern void readfat();
90: extern void setglobals();
91: extern void usage();
92: extern void writefat();
93: extern void xpartition();
94:
95: /* end of dos1.h */
96:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.