annotate pirollback/checknames.c @ 330:30cbf540e045

frbl/reconst/serial.c: 0x126 static function reconstructed
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 07 Mar 2020 00:54:28 +0000
parents 78ac405716db
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <sys/types.h>
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdio.h>
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 #include <stdlib.h>
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 #include "types.h"
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 #include "struct.h"
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include "pathname.h"
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 extern struct inode_info inode[];
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 extern int last_inode;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 static void
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 check_inode(ino)
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 struct inode_info *in;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 u8 *cp;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 int cnt;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 in = inode + ino;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 switch (in->type) {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 case 0xE1:
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 case 0xF1:
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 case 0xF2:
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 break;
46
78ac405716db pirollback: journal parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 44
diff changeset
24 case 0x00:
78ac405716db pirollback: journal parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 44
diff changeset
25 case 0xF4:
78ac405716db pirollback: journal parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 44
diff changeset
26 return;
44
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 default:
46
78ac405716db pirollback: journal parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 44
diff changeset
28 fprintf(stderr, "inode #%x: unexpected type %02X\n", ino,
78ac405716db pirollback: journal parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 44
diff changeset
29 in->type);
78ac405716db pirollback: journal parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 44
diff changeset
30 exit(1);
44
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 }
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 for (cp = in->dataptr, cnt = 0; ; cp++, cnt++) {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 if (cnt >= in->len) {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 fprintf(stderr,
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 "inode #%x: name expected at %x: length overrun\n",
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 ino, in->offset);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 exit(1);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 }
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 if (!*cp)
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 break;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 if (cnt >= MAX_FN_COMPONENT) {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 fprintf(stderr,
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 "inode #%x: name exceeds program limit of %d chars\n",
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 ino, MAX_FN_COMPONENT);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 exit(1);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 }
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 if (*cp < '!' || *cp > '~') {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 fprintf(stderr,
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 "inode #%x: name expected at %x: bad character\n",
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 ino, in->offset);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 exit(1);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 }
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 }
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 if (!cnt) {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 fprintf(stderr, "inode #%x: name expected at %x: null string\n",
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 ino, in->offset);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 exit(1);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 }
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 in->byte_after_name = cp + 1;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 }
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 check_object_names()
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 {
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 int ino;
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 for (ino = 1; ino <= last_inode; ino++)
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 check_inode(ino);
074237879eca pirollback: name check implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 }