1 Index: kexec-boot-loader/main.c
2 ===================================================================
3 --- kexec-boot-loader.orig/main.c 2006-06-26 21:41:34.000000000 -0600
4 +++ kexec-boot-loader/main.c 2006-06-26 21:48:21.000000000 -0600
15 return do_mount(0, "/proc", "proc");
18 +#define iseol(_c) ((_c == '\n') || (_c == 0))
19 +#define isspace(_c) ((_c == ' ') || (_c == '\t'))
21 +/* Make a series of devices based on a file (the same format as makedevs) */
23 +int makedevs(const char *filename) {
29 + FILE *stream = fopen(filename, "r");
34 + while(!feof(stream)) {
35 + char *str = fgets(buffer, sizeof(buffer) - 1, stream);
40 + for(i = 0; i < 10; i++) {
42 + for( ; !isspace(*str) && !iseol(*str); str++);
49 + for( ;isspace(*str) && !iseol(*str); str++);
55 + /* The first 4 columns need to be there */
60 + /* Note - everything is created as 0 0, regardless of what is specified */
62 + if (*argv[1] == 'd' ) {
63 + mode_t mode = atoi(argv[2]);
64 + if (mkdir(argv[0], mode))
65 + print("Couldn't make directory %s\n", argv[0]);
67 + else if (*argv[1] == 'c' || *argv[1] == 'b') {
69 + mode_t mode = atoi(argv[2]);
71 + int major = atoi(argv[5]);
72 + int minor = atoi(argv[6]);
74 + if (*argv[2] == 'b')
79 + if (mknod(argv[0], mode, major << 8 | minor))
80 + print("Couldn't make nod %s(%d,%d)\n", argv[0], major, minor);
93 print("Kexec boot loader\n\n");
96 + makedevs("/device.txt");
98 create_mountpath(mntpoint);