]> git.wh0rd.org Git - ICEs.git/blob - bfin-rets-insn/initramfs.i.2
initial import
[ICEs.git] / bfin-rets-insn / initramfs.i.2
1 typedef int (*initcall_t) (void);
2 typedef long long __kernel_loff_t;
3 typedef __kernel_loff_t loff_t;
4 static 
5 char *message;
6 static void  error(char *x)
7 {
8         if (!message)
9                 message = x;
10 }
11
12 static 
13 enum state {
14         Start, Collect, GotHeader, SkipIt, GotName, CopyFile, GotSymlink, Reset
15 } state, next_state;
16 static 
17 loff_t this_header, next_header;
18 static 
19 char *collected;
20 static int  do_start(void)
21 {
22 }
23 static int  do_collect(void)
24 {
25 }
26 static int  do_header(void)
27 {
28         if (memcmp(collected, "070707", 6) == 0) {
29                 error("incorrect cpio method used: use -H newc option");
30         }
31 }
32 static int  do_skip(void)
33 {
34 }
35 static int  do_reset(void)
36 {
37 }
38 static int  do_name(void)
39 {
40 }
41 static int  do_copy(void)
42 {
43 }
44 static int  do_symlink(void)
45 {
46 }
47 static 
48 int (*actions[]) (void) =
49 {
50 [Start] = do_start,[Collect] = do_collect,[GotHeader] =
51             do_header,[SkipIt] = do_skip,[GotName] =
52             do_name,[CopyFile] = do_copy,[GotSymlink] =
53             do_symlink,[Reset] = do_reset,};
54 static int
55      write_buffer(char *buf,
56                                                              unsigned len)
57 {
58         while (!actions[state] ()) ;
59 }
60 static char *
61      unpack_to_rootfs(char *buf,
62                                                                  unsigned len,
63                                                                  int check_only)
64 {
65         int written;
66         while (!message && len) {
67                 if (*buf == '0' && !(this_header & 3)) {
68                         written = write_buffer(buf, len);
69                 }
70                 if (state != Reset)
71                         error("junk in gzipped archive");
72         }
73 }
74 extern char __initramfs_start[], __initramfs_end[];
75 static int  populate_rootfs(void)
76 {
77         char *err =
78             unpack_to_rootfs(__initramfs_start,
79                              __initramfs_end - __initramfs_start, 0);
80 }
81 static initcall_t __initcall_populate_rootfsrootfs __attribute__ ((__used__))
82 =
83     populate_rootfs;