annotate cos/kernel/initrd.c @ 36:91f91ff07ea8

Removed test variables
author windel
date Mon, 16 Jan 2012 20:47:05 +0100
parents 3a6a9b929db0
children 35cc54e078dd
rev   line source
32
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
1 /*
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
2 * Initial ramdisk filesystem driver.
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
3 * */
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
4
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
5 #include "kernel.h"
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
6
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
7 fs_node_t *initrd_root = 0;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
8
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
9 typedef struct
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
10 {
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
11 uint32_t magic;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
12 uint32_t numfiles;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
13 } initrd_header_t;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
14
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
15 fs_node_t* initialize_initrd(uint64_t location)
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
16 {
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
17 // We need a valid malloc here!
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
18 initrd_root = (fs_node_t*)kmalloc(sizeof(fs_node_t));
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
19
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
20 initrd_header_t *header = (initrd_header_t*)location;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
21 initrd_root->length = header->numfiles;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
22
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
23 return initrd_root;
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
24 }
3a6a9b929db0 Added initial ramdisk and some virtual file system functions
windel
parents:
diff changeset
25