FreeCalypso > hg > freecalypso-tools
comparison target-utils/libtiffs/findfile.c @ 60:87cb03b35f77
target-utils: long-overdue s/mpffs/tiffs/ and s/MPFFS/TIFFS/ rename
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 26 Oct 2016 15:52:14 +0000 |
parents | e7502631a0f9 |
children |
comparison
equal
deleted
inserted
replaced
59:819335e06fd1 | 60:87cb03b35f77 |
---|---|
5 #include "macros.h" | 5 #include "macros.h" |
6 | 6 |
7 static u8 * | 7 static u8 * |
8 find_endofchunk(ino) | 8 find_endofchunk(ino) |
9 { | 9 { |
10 struct inode *irec = mpffs_active_index + ino; | 10 struct inode *irec = tiffs_active_index + ino; |
11 u8 *p; | 11 u8 *p; |
12 int i; | 12 int i; |
13 | 13 |
14 p = inode_to_dataptr(irec) + irec->len; | 14 p = inode_to_dataptr(irec) + irec->len; |
15 for (i = 0; i < 16; i++) { | 15 for (i = 0; i < 16; i++) { |
21 } | 21 } |
22 printf("Error: inode #%x has no valid termination\n", ino); | 22 printf("Error: inode #%x has no valid termination\n", ino); |
23 return(p); /* XXX */ | 23 return(p); /* XXX */ |
24 } | 24 } |
25 | 25 |
26 mpffs_find_file(pathname, startret, sizeret, continue_ret) | 26 tiffs_find_file(pathname, startret, sizeret, continue_ret) |
27 char *pathname; | 27 char *pathname; |
28 u8 **startret; | 28 u8 **startret; |
29 size_t *sizeret; | 29 size_t *sizeret; |
30 int *continue_ret; | 30 int *continue_ret; |
31 { | 31 { |
32 int ino, cont; | 32 int ino, cont; |
33 struct inode *irec; | 33 struct inode *irec; |
34 u8 *start, *end; | 34 u8 *start, *end; |
35 int size; | 35 int size; |
36 | 36 |
37 ino = mpffs_pathname_to_inode(pathname); | 37 ino = tiffs_pathname_to_inode(pathname); |
38 if (ino <= 0) | 38 if (ino <= 0) |
39 return(-1); | 39 return(-1); |
40 irec = mpffs_active_index + ino; | 40 irec = tiffs_active_index + ino; |
41 if (irec->type != OBJTYPE_FILE) { | 41 if (irec->type != OBJTYPE_FILE) { |
42 printf("Error: %s is not a regular file\n", pathname); | 42 printf("Error: %s is not a regular file\n", pathname); |
43 return(-1); | 43 return(-1); |
44 } | 44 } |
45 start = inode_to_dataptr(irec); | 45 start = inode_to_dataptr(irec); |
58 if (continue_ret) | 58 if (continue_ret) |
59 *continue_ret = cont; | 59 *continue_ret = cont; |
60 return(0); | 60 return(0); |
61 } | 61 } |
62 | 62 |
63 mpffs_get_segment(ino, startret, sizeret, continue_ret) | 63 tiffs_get_segment(ino, startret, sizeret, continue_ret) |
64 int ino; | 64 int ino; |
65 u8 **startret; | 65 u8 **startret; |
66 size_t *sizeret; | 66 size_t *sizeret; |
67 int *continue_ret; | 67 int *continue_ret; |
68 { | 68 { |
70 struct inode *irec; | 70 struct inode *irec; |
71 u8 *start, *end; | 71 u8 *start, *end; |
72 int size; | 72 int size; |
73 | 73 |
74 for (;;) { | 74 for (;;) { |
75 irec = mpffs_active_index + ino; | 75 irec = tiffs_active_index + ino; |
76 if (irec->type) | 76 if (irec->type) |
77 break; | 77 break; |
78 if (irec->sibling == 0xFFFF) { | 78 if (irec->sibling == 0xFFFF) { |
79 printf("Error: segment inode #%d: deleted and no sibling\n", | 79 printf("Error: segment inode #%d: deleted and no sibling\n", |
80 ino); | 80 ino); |