Rev 2927 | Rev 3535 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2927 | Rev 3150 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | #include <as.h> |
45 | #include <as.h> |
46 | #include <libadt/list.h> |
46 | #include <libadt/list.h> |
47 | #include <atomic.h> |
47 | #include <atomic.h> |
48 | #include "vfs.h" |
48 | #include "vfs.h" |
49 | 49 | ||
- | 50 | #define NAME "vfs" |
|
- | 51 | ||
50 | #define dprintf(...) printf(__VA_ARGS__) |
52 | #define dprintf(...) printf(__VA_ARGS__) |
51 | 53 | ||
52 | static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall) |
54 | static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall) |
53 | { |
55 | { |
54 | bool keep_on_going = 1; |
56 | bool keep_on_going = 1; |
55 | 57 | ||
56 | printf("Connection opened from %p\n", icall->in_phone_hash); |
- | |
57 | - | ||
58 | /* |
58 | /* |
59 | * The connection was opened via the IPC_CONNECT_ME_TO call. |
59 | * The connection was opened via the IPC_CONNECT_ME_TO call. |
60 | * This call needs to be answered. |
60 | * This call needs to be answered. |
61 | */ |
61 | */ |
62 | ipc_answer_0(iid, EOK); |
62 | ipc_answer_0(iid, EOK); |
Line 75... | Line 75... | ||
75 | ipc_callid_t callid; |
75 | ipc_callid_t callid; |
76 | ipc_call_t call; |
76 | ipc_call_t call; |
77 | 77 | ||
78 | callid = async_get_call(&call); |
78 | callid = async_get_call(&call); |
79 | 79 | ||
80 | printf("Received call, method=%d\n", IPC_GET_METHOD(call)); |
- | |
81 | - | ||
82 | switch (IPC_GET_METHOD(call)) { |
80 | switch (IPC_GET_METHOD(call)) { |
83 | case IPC_M_PHONE_HUNGUP: |
81 | case IPC_M_PHONE_HUNGUP: |
84 | keep_on_going = false; |
82 | keep_on_going = false; |
85 | break; |
83 | break; |
86 | case VFS_REGISTER: |
84 | case VFS_REGISTER: |
Line 129... | Line 127... | ||
129 | 127 | ||
130 | int main(int argc, char **argv) |
128 | int main(int argc, char **argv) |
131 | { |
129 | { |
132 | ipcarg_t phonead; |
130 | ipcarg_t phonead; |
133 | 131 | ||
134 | printf("VFS: HelenOS VFS server\n"); |
132 | printf(NAME ": HelenOS VFS server\n"); |
135 | 133 | ||
136 | /* |
134 | /* |
137 | * Initialize the list of registered file systems. |
135 | * Initialize the list of registered file systems. |
138 | */ |
136 | */ |
139 | list_initialize(&fs_head); |
137 | list_initialize(&fs_head); |
140 | 138 | ||
141 | /* |
139 | /* |
142 | * Initialize VFS node hash table. |
140 | * Initialize VFS node hash table. |
143 | */ |
141 | */ |
144 | if (!vfs_nodes_init()) { |
142 | if (!vfs_nodes_init()) { |
145 | printf("Failed to initialize the VFS node hash table.\n"); |
143 | printf(NAME ": Failed to initialize VFS node hash table\n"); |
146 | return ENOMEM; |
144 | return ENOMEM; |
147 | } |
145 | } |
148 | 146 | ||
149 | /* |
147 | /* |
150 | * Allocate and initialize the Path Lookup Buffer. |
148 | * Allocate and initialize the Path Lookup Buffer. |
151 | */ |
149 | */ |
152 | list_initialize(&plb_head); |
150 | list_initialize(&plb_head); |
153 | plb = as_get_mappable_page(PLB_SIZE); |
151 | plb = as_get_mappable_page(PLB_SIZE); |
154 | if (!plb) { |
152 | if (!plb) { |
155 | printf("Cannot allocate a mappable piece of address space\n"); |
153 | printf(NAME ": Cannot allocate a mappable piece of address space\n"); |
156 | return ENOMEM; |
154 | return ENOMEM; |
157 | } |
155 | } |
158 | if (as_area_create(plb, PLB_SIZE, AS_AREA_READ | AS_AREA_WRITE | |
156 | if (as_area_create(plb, PLB_SIZE, AS_AREA_READ | AS_AREA_WRITE | |
159 | AS_AREA_CACHEABLE) != plb) { |
157 | AS_AREA_CACHEABLE) != plb) { |
160 | printf("Cannot create address space area.\n"); |
158 | printf(NAME ": Cannot create address space area\n"); |
161 | return ENOMEM; |
159 | return ENOMEM; |
162 | } |
160 | } |
163 | memset(plb, 0, PLB_SIZE); |
161 | memset(plb, 0, PLB_SIZE); |
164 | 162 | ||
165 | /* |
163 | /* |
Line 173... | Line 171... | ||
173 | ipc_connect_to_me(PHONE_NS, SERVICE_VFS, 0, 0, &phonead); |
171 | ipc_connect_to_me(PHONE_NS, SERVICE_VFS, 0, 0, &phonead); |
174 | 172 | ||
175 | /* |
173 | /* |
176 | * Start accepting connections. |
174 | * Start accepting connections. |
177 | */ |
175 | */ |
- | 176 | printf(NAME ": Accepting connections\n"); |
|
178 | async_manager(); |
177 | async_manager(); |
179 | return 0; |
178 | return 0; |
180 | } |
179 | } |
181 | 180 | ||
182 | /** |
181 | /** |