#include <assert.h>#include <ctype.h>#include <errno.h>#include <limits.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <time.h>#include <sys/times.h>#include <unistd.h>Include dependency graph for dosread.c:

Go to the source code of this file.
Data Structures | |
| struct | dir_entry |
Defines | |
| #define | MAX_CLUSTER_SIZE 4096 |
| #define | MAX_ROOT_ENTRIES 512 |
| #define | FAT_START 512L |
| #define | ROOTADDR (FAT_START + 2L * fat_size) |
| #define | clus_add(cl_no) |
| #define | NOT_USED 0x00 |
| #define | ERASED 0xE5 |
| #define | DIR 0x2E |
| #define | DIR_SIZE (sizeof (struct dir_entry)) |
| #define | SUB_DIR 0x10 |
| #define | NIL_DIR ((DIRECTORY *) 0) |
| #define | LAST_CLUSTER12 0xFFF |
| #define | LAST_CLUSTER 0xFFFF |
| #define | FREE 0x000 |
| #define | BAD 0xFF0 |
| #define | BAD16 0xFFF0 |
| #define | TRUE 1 |
| #define | FALSE 0 |
| #define | NIL_PTR ((char *) 0) |
| #define | DOS_TIME 315532800L |
| #define | READ 0 |
| #define | WRITE 1 |
| #define | FIND 3 |
| #define | LABEL 4 |
| #define | ENTRY 5 |
| #define | find_entry(d, e, p) directory(d, e, FIND, p) |
| #define | list_dir(d, e, f) (void) directory(d, e, f, NIL_PTR) |
| #define | label() directory(root, root_entries, LABEL, NIL_PTR) |
| #define | new_entry(d, e) directory(d, e, ENTRY, NIL_PTR) |
| #define | is_dir(d) ((d)->d_attribute & SUB_DIR) |
| #define | STD_OUT 1 |
| #define | DRIVE_NR (sizeof (drive) - 2) |
| #define | COOKED_SIZE 8192 |
| #define | SEC_MIN 60L |
| #define | SEC_HOUR (60L * SEC_MIN) |
| #define | SEC_DAY (24L * SEC_HOUR) |
| #define | SEC_YEAR (365L * SEC_DAY) |
| #define | SEC_LYEAR (366L * SEC_DAY) |
| #define | HOUR 0xF800 |
| #define | MIN 0x07E0 |
| #define | YEAR 0xFE00 |
| #define | MONTH 0x01E0 |
| #define | DAY 0x01F |
Typedefs | |
| typedef dir_entry | DIRECTORY |
| typedef int | BOOL |
Functions | |
| _PROTOTYPE (void usage,(char *prog_name)) | |
| _PROTOTYPE (unsigned c2u2,(unsigned char *ucarray)) | |
| _PROTOTYPE (unsigned long c4u4,(unsigned char *ucarray)) | |
| _PROTOTYPE (void determine,(void)) | |
| _PROTOTYPE (int main,(int argc, char *argv[])) | |
| _PROTOTYPE (DIRECTORY *directory,(DIRECTORY *dir, int entries, BOOL function, char *pathname)) | |
| _PROTOTYPE (void extract,(DIRECTORY *entry)) | |
| _PROTOTYPE (void make_file,(DIRECTORY *dir_ptr, int entries, char *name)) | |
| _PROTOTYPE (char *make_name,(DIRECTORY *dir_ptr, int dir_fl)) | |
| _PROTOTYPE (int fill,(char *buffer, size_t size)) | |
| _PROTOTYPE (void xmodes,(int mode)) | |
| _PROTOTYPE (void show,(DIRECTORY *dir_ptr, char *name)) | |
| _PROTOTYPE (DIRECTORY *read_cluster,(unsigned int cluster)) | |
| _PROTOTYPE (unsigned short free_cluster,(BOOL leave_fl)) | |
| _PROTOTYPE (void link_fat,(unsigned int cl_1, unsigned int cl_2)) | |
| _PROTOTYPE (unsigned short next_cluster,(unsigned int cl_no)) | |
| _PROTOTYPE (char *slash,(char *str)) | |
| _PROTOTYPE (void add_path,(char *file, BOOL slash_fl)) | |
| _PROTOTYPE (void disk_io,(BOOL op, unsigned long seek, void *address, unsigned bytes)) | |
| _PROTOTYPE (void read_fat,(unsigned int cl_no)) | |
| _PROTOTYPE (BOOL free_range,(unsigned short *first, unsigned short *last)) | |
| _PROTOTYPE (long lmin,(long a, long b)) | |
| void | usage (char *prog_name) |
| unsigned | c2u2 (unsigned char *ucarray) |
| unsigned long | c4u4 (unsigned char *ucarray) |
| void | determine () |
| int | main (int argc, argv) |
| DIRECTORY * | directory (DIRECTORY *dir, int entries, int function, char *pathname) |
| void | extract (DIRECTORY *entry) |
| long | lmin (long a, long b) |
| void | make_file (DIRECTORY *dir_ptr, int entries, char *name) |
| void | fill_date (DIRECTORY *entry) |
| char * | make_name (DIRECTORY *dir_ptr, short dir_fl) |
| int | fill (char *buffer, size_t size) |
| void | xmodes (int mode) |
| void | show (DIRECTORY *dir_ptr, char *name) |
| void | free_blocks () |
| DIRECTORY * | read_cluster (unsigned int cluster) |
| BOOL | free_range (unsigned short *first, unsigned short *last) |
| unsigned short | free_cluster (BOOL leave_fl) |
| void | read_fat (unsigned int cl_no) |
| void | flush_fat () |
| void | link_fat (unsigned int cl_1, unsigned int cl_2) |
| unsigned short | next_cluster (unsigned int cl_no) |
| char * | slash (char *str) |
| void | add_path (char *file, BOOL slash_fl) |
| void | disk_io (BOOL op, unsigned long seek, void *address, unsigned bytes) |
Variables | |
| char * | cmnd |
| static int | disk |
| static DIRECTORY | root [MAX_ROOT_ENTRIES] |
| static DIRECTORY | save_entry |
| static char | drive [] = "/dev/dosX" |
| static char | null [MAX_CLUSTER_SIZE] |
| static char * | device = drive |
| static char | path [128] |
| static long | data_start |
| static long | mark |
| static unsigned short | total_clusters |
| static unsigned short | cluster_size |
| static unsigned short | root_entries |
| static unsigned short | sub_entries |
| static unsigned long | fat_size |
| static BOOL | Rflag |
| static BOOL | Lflag |
| static BOOL | Aflag |
| static BOOL | dos_read |
| static BOOL | dos_write |
| static BOOL | dos_dir |
| static BOOL | fat_16 = 0 |
| static BOOL | big_endian |
| static unsigned char * | raw_fat |
| static unsigned short * | cooked_fat |
| static unsigned short | fat_low = USHRT_MAX |
| static unsigned short | fat_high = 0 |
| static BOOL | fat_dirty = FALSE |
| static unsigned int | cache_size |
| unsigned short | mon_len [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} |
| char * | month [] |
| static unsigned short | cl_index = 2 |
| char | dosread_c_rcs_id [] |
|
|
|
|
|
Definition at line 61 of file dosread.c. Referenced by extract(), free_blocks(), and read_fat(). |
|
|
Value: ((long) (((long) cl_no - 2L) \ * (long) cluster_size \ + data_start \ )) Definition at line 33 of file dosread.c. Referenced by directory(), extract(), make_file(), and read_cluster(). |
|
|
Definition at line 106 of file dosread.c. Referenced by read_fat(). |
|
|
Definition at line 795 of file dosread.c. Referenced by show(). |
|
|
|
|
|
Definition at line 53 of file dosread.c. Referenced by directory(). |
|
|
Definition at line 69 of file dosread.c. Referenced by fill_date(). |
|
|
|
|
|
Definition at line 76 of file dosread.c. Referenced by directory(). |
|
|
Definition at line 51 of file dosread.c. Referenced by directory(). |
|
|
|
|
|
Definition at line 31 of file dosread.c. Referenced by determine(), flush_fat(), and read_fat(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 791 of file dosread.c. Referenced by show(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 58 of file dosread.c. Referenced by read_fat(), and show(). |
|
|
Definition at line 57 of file dosread.c. Referenced by read_fat(). |
|
|
Definition at line 78 of file dosread.c. Referenced by recurse_dir(). |
|
|
Definition at line 29 of file dosread.c. Referenced by determine(), extract(), and make_file(). |
|
|
|
|
|
|
|
|
Definition at line 794 of file dosread.c. Referenced by show(). |
|
|
Definition at line 80 of file dosread.c. Referenced by make_file(). |
|
|
Definition at line 55 of file dosread.c. Referenced by directory(). |
|
|
|
|
|
Definition at line 50 of file dosread.c. Referenced by directory(). |
|
|
|
|
|
Definition at line 32 of file dosread.c. Referenced by directory(). |
|
|
Definition at line 690 of file dosread.c. Referenced by days2time(), and main(). |
|
|
|
|
|
Definition at line 692 of file dosread.c. Referenced by fill_date(). |
|
|
|
|
|
Definition at line 691 of file dosread.c. Referenced by fill_date(). |
|
|
Definition at line 84 of file dosread.c. Referenced by bad_write(), flush_buffer(), main(), open_outfile(), and panic(). |
|
|
Definition at line 54 of file dosread.c. Referenced by xmodes(). |
|
|
|
|
|
Definition at line 72 of file dosread.c. Referenced by _write_pm(), do_close(), flush_fat(), make_file(), pipe_check(), put_inode(), put_super(), release(), scratch_file(), set(), test03(), test04(), test06(), test10(), test11(), test7d(), test7e(), test7f(), test7g(), test7h(), test7i(), test7j(), write(), write_standards(), and yank(). |
|
|
Definition at line 793 of file dosread.c. Referenced by show(). |
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 1074 of file dosread.c. References NIL_PTR, path, ptr, and strcpy(). Referenced by add_file(). |
|
|
Definition at line 157 of file dosread.c. Referenced by determine(). |
|
|
Definition at line 163 of file dosread.c. References long(). Referenced by determine(). |
|
|
Definition at line 171 of file dosread.c. References big_endian, boot, c2u2(), c4u4(), cluster_size, cmnd, data_start, disk, disk_io(), dos_write, exit(), fat_16, fat_size, FAT_START, fprintf(), hard(), heads, L, MAX_CLUSTER_SIZE, OK, READ, root_entries, stderr, sub_entries, and total_clusters. |
|
||||||||||||||||||||
|
Definition at line 441 of file dosread.c. References clus_add, dir_entry::d_name, DIR_SIZE, ENTRY, ERASED, file_name, FIND, i, if(), j, mark, mem, next_cluster(), NIL_DIR, NOT_USED, read_cluster(), root_entries, ROOTADDR, and type. Referenced by compare(), and dump_dir(). |
|
||||||||||||||||||||
|
Definition at line 1094 of file dosread.c. References cmnd, disk, errno, exit(), fflush(), fprintf(), L, lseek, r, read, READ, SEEK_SET, stderr, stdout, strerror(), and write. Referenced by determine(), extract(), flush_fat(), make_file(), read_cluster(), and read_fat(). |
|
|
Definition at line 567 of file dosread.c. References Aflag, BAD16, clus_add, cluster_size, cmnd, dir_entry::d_cluster, disk_io(), errno, exit(), ferror, fflush(), fprintf(), fwrite(), i, if(), long(), MAX_CLUSTER_SIZE, next_cluster(), putchar, READ, stderr, stdout, and strerror(). |
|
||||||||||||
|
Definition at line 763 of file dosread.c. References Aflag, begin, BOOL, c, EOF, FALSE, getchar, and TRUE. Referenced by command(), inflate_table(), inflate_table9(), and make_file(). |
|
|
Definition at line 696 of file dosread.c. References day, DOS_TIME, i, month, SEC_LYEAR, SEC_YEAR, seconds, time, and tmp. |
|
|
Definition at line 1002 of file dosread.c. References big_endian, cache_size, cooked_fat, cp, disk_io(), fat_16, fat_low, fat_size, FAT_START, i, and WRITE. Referenced by link_fat(), and next_cluster(). |
|
|
Definition at line 840 of file dosread.c. References BAD16, FREE, next_cluster(), and total_clusters. |
|
|
Definition at line 905 of file dosread.c. References cmnd, exit(), fprintf(), FREE, next_cluster(), stderr, and total_clusters. |
|
||||||||||||
|
Definition at line 882 of file dosread.c. References FALSE, FREE, next_cluster(), total_clusters, and TRUE. |
|
||||||||||||
|
Definition at line 1040 of file dosread.c. References cooked_fat, fat_dirty, fat_high, fat_low, flush_fat(), read_fat(), and TRUE. |
|
||||||||||||
|
Definition at line 617 of file dosread.c. Referenced by make_file(). |
|
||||||||||||
|
Definition at line 295 of file dosread.c. References cmnd, dev_nr, dos_dir, dos_read, dos_write, exit(), fprintf(), Lflag, Rflag, slash(), stderr, strcmp, TRUE, and usage. |
|
||||||||||||||||
|
Definition at line 625 of file dosread.c. References chunk, clus_add, cluster_size, disk_io(), done, entry, fill(), i, L, lmin(), MAX_CLUSTER_SIZE, memset(), new_entry, ptr, r, size, and WRITE. |
|
||||||||||||
|
|
|
|
Definition at line 1053 of file dosread.c. References cooked_fat, fat_dirty, fat_high, fat_low, flush_fat(), and read_fat(). Referenced by directory(), extract(), free_blocks(), free_cluster(), free_range(), and show(). |
|
|
Definition at line 859 of file dosread.c. References clus_add, cluster_size, cmnd, disk_io(), exit(), fprintf(), malloc(), NULL, READ, and stderr. Referenced by directory(). |
|
|
Definition at line 921 of file dosread.c. References BAD, BAD16, cache_size, cmnd, cooked_fat, COOKED_SIZE, cp, disk_io(), exit(), fat_16, fat_high, fat_low, fat_size, FAT_START, fprintf(), i, LAST_CLUSTER, LAST_CLUSTER12, malloc(), NULL, raw_fat, READ, stderr, and total_clusters. Referenced by link_fat(), and next_cluster(). |
|
||||||||||||
|
Definition at line 810 of file dosread.c. References cluster_size, dir_entry::d_date, DAY, HOUR, i, is_dir, LAST_CLUSTER, Lflag, MIN, MONTH, next, next_cluster(), printf, strlen(), xmodes(), and YEAR. |
|
|
Definition at line 1063 of file dosread.c. References result. Referenced by cidr_aton(), enterDirectory(), main(), mkpath(), netspec(), parse_cidr(), path_add(), read_file(), and recover(). |
|
|
|
|
|
Definition at line 802 of file dosread.c. References printf, and SUB_DIR. Referenced by show(). |
|
|
|
|
|
Definition at line 101 of file dosread.c. Referenced by determine(), and flush_fat(). |
|
|
|
|
|
|
|
|
Definition at line 97 of file dosread.c. Referenced by calc_fat_size(), determine(), extract(), make_file(), read_cluster(), and show(). |
|
|
Definition at line 86 of file dosread.c. Referenced by determine(), disk_io(), extract(), free_cluster(), main(), read_cluster(), read_fat(), and usage(). |
|
|
Definition at line 112 of file dosread.c. Referenced by flush_fat(), link_fat(), next_cluster(), and read_fat(). |
|
|
Definition at line 95 of file dosread.c. Referenced by determine(). |
|
|
|
|
|
Definition at line 88 of file dosread.c. Referenced by determine(), disk_io(), do_autopart(), extpartition(), and partition(). |
|
|
|
|
|
Definition at line 100 of file dosread.c. Referenced by main(). |
|
|
Definition at line 100 of file dosread.c. Referenced by determine(), dos_to_dos(), main(), and unix_to_dos(). |
|
|
Initial value:
"$Id: dosread.c,v 1.2 2005/07/13 10:02:14 beng Exp $"
|
|
|
Definition at line 92 of file dosread.c. Referenced by ack_irqs(), common_dos_loop(), enterDirectory(), finish_drive_clause(), get_drive(), init_params(), init_params_pci(), main(), mcat(), mformat(), minfo(), mlabel(), mmove(), mpartition(), mtoolstest(), name2dev(), syntax(), and w_init(). |
|
|
Definition at line 100 of file dosread.c. Referenced by determine(), flush_fat(), and read_fat(). |
|
|
Definition at line 117 of file dosread.c. Referenced by link_fat(), and next_cluster(). |
|
|
Definition at line 116 of file dosread.c. Referenced by link_fat(), next_cluster(), and read_fat(). |
|
|
Definition at line 115 of file dosread.c. Referenced by flush_fat(), link_fat(), next_cluster(), and read_fat(). |
|
|
Definition at line 98 of file dosread.c. Referenced by determine(), flush_fat(), and read_fat(). |
|
|
Definition at line 100 of file dosread.c. Referenced by cpio_options(), ftree_start(), main(), pax_options(), show(), and tar_options(). |
|
|
|
|
|
|
|
|
Initial value: {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}
|
|
|
|
|
|
Definition at line 94 of file dosread.c. Referenced by add_path(), addpath(), apply_differences(), cdcmd(), cleandir(), compare(), decode_message(), delete(), delpath(), do_change(), do_chown(), DOcd(), doDELE(), dodot(), DOlcd(), DOlist(), DOlmkdir(), DOlrmdir(), doMKD(), DOmkdir(), DOnlst(), doRMD(), DOrmdir(), doRNTO(), enter(), execute(), execvp(), find_command(), get_drive(), getattributes(), gettynames(), islink(), linked(), listdir(), listfiles(), lock(), lockpath(), main(), mtoolstest(), path_name(), print1(), printentry(), rdlink(), readstate(), recvfile(), rexecve(), sendfile(), slave(), traverse(), and ttyname(). |
|
|
Definition at line 109 of file dosread.c. Referenced by read_fat(). |
|
|
Definition at line 100 of file dosread.c. Referenced by main(). |
|
|
Definition at line 90 of file dosread.c. Referenced by dovhost(), fts_open(), inflate_table(), inflate_table9(), main(), makepathtables(), snocString(), traversetree(), and writedata(). |
|
|
Definition at line 97 of file dosread.c. Referenced by determine(), and directory(). |
|
|
|
|
|
Definition at line 97 of file dosread.c. Referenced by determine(). |
|
|
Definition at line 97 of file dosread.c. Referenced by determine(), free_blocks(), free_cluster(), free_range(), and read_fat(). |
1.4.6