Rev 2569 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2569 | Rev 2587 | ||
---|---|---|---|
Line 44... | Line 44... | ||
44 | #include <futex.h> |
44 | #include <futex.h> |
45 | #include <libadt/list.h> |
45 | #include <libadt/list.h> |
46 | #include "vfs.h" |
46 | #include "vfs.h" |
47 | 47 | ||
48 | atomic_t rootfs_futex = FUTEX_INITIALIZER; |
48 | atomic_t rootfs_futex = FUTEX_INITIALIZER; |
49 | vfs_node_t rootfs = { 0 }; |
49 | vfs_triplet_t rootfs = { |
- | 50 | .fs_handle = 0, |
|
- | 51 | .dev_handle = 0, |
|
- | 52 | .index = 0, |
|
- | 53 | }; |
|
50 | 54 | ||
51 | static int lookup_root(int fs_handle, int dev_handle, vfs_node_t *root) |
55 | static int lookup_root(int fs_handle, int dev_handle, vfs_triplet_t *root) |
52 | { |
56 | { |
53 | vfs_node_t altroot = { |
57 | vfs_pair_t altroot = { |
54 | .fs_handle = fs_handle, |
58 | .fs_handle = fs_handle, |
55 | .dev_handle = dev_handle, |
59 | .dev_handle = dev_handle, |
56 | /* |
- | |
57 | * At this point, we don't know what is the index of the root |
- | |
58 | * node. Finally, that's what this function is about. |
- | |
59 | */ |
- | |
60 | }; |
60 | }; |
61 | 61 | ||
62 | return vfs_lookup_internal("/", strlen("/"), root, &altroot); |
62 | return vfs_lookup_internal("/", strlen("/"), root, &altroot); |
63 | } |
63 | } |
64 | 64 | ||
Line 136... | Line 136... | ||
136 | 136 | ||
137 | /* |
137 | /* |
138 | * Lookup the root node of the filesystem being mounted. |
138 | * Lookup the root node of the filesystem being mounted. |
139 | */ |
139 | */ |
140 | int rc; |
140 | int rc; |
141 | vfs_node_t mounted_root; |
141 | vfs_triplet_t mounted_root; |
142 | rc = lookup_root(fs_handle, dev_handle, &mounted_root); |
142 | rc = lookup_root(fs_handle, dev_handle, &mounted_root); |
143 | if (rc != EOK) { |
143 | if (rc != EOK) { |
144 | free(buf); |
144 | free(buf); |
145 | ipc_answer_fast(rid, rc, 0, 0); |
145 | ipc_answer_fast(rid, rc, 0, 0); |
146 | return; |
146 | return; |
147 | } |
147 | } |
148 | 148 | ||
149 | /* |
149 | /* |
150 | * Finally, we need to resolve the path to the mountpoint. |
150 | * Finally, we need to resolve the path to the mountpoint. |
151 | */ |
151 | */ |
152 | vfs_node_t mp; |
152 | vfs_triplet_t mp; |
153 | futex_down(&rootfs_futex); |
153 | futex_down(&rootfs_futex); |
154 | if (rootfs.fs_handle) { |
154 | if (rootfs.fs_handle) { |
155 | /* |
155 | /* |
156 | * We already have the root FS. |
156 | * We already have the root FS. |
157 | */ |
157 | */ |