Rev 2731 | Rev 2770 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2731 | Rev 2768 | ||
|---|---|---|---|
| Line 203... | Line 203... | ||
| 203 | ipc_answer_0(rid, EINVAL); |
203 | ipc_answer_0(rid, EINVAL); |
| 204 | return; |
204 | return; |
| 205 | } |
205 | } |
| 206 | 206 | ||
| 207 | futex_down(&fs_head_futex); |
207 | futex_down(&fs_head_futex); |
| - | 208 | fibril_inc_sercount(); |
|
| 208 | 209 | ||
| 209 | /* |
210 | /* |
| 210 | * Check for duplicit registrations. |
211 | * Check for duplicit registrations. |
| 211 | */ |
212 | */ |
| 212 | if (fs_name_to_handle(fs_info->vfs_info.name, false)) { |
213 | if (fs_name_to_handle(fs_info->vfs_info.name, false)) { |
| 213 | /* |
214 | /* |
| 214 | * We already register a fs like this. |
215 | * We already register a fs like this. |
| 215 | */ |
216 | */ |
| 216 | dprintf("FS is already registered.\n"); |
217 | dprintf("FS is already registered.\n"); |
| - | 218 | fibril_dec_sercount(); |
|
| 217 | futex_up(&fs_head_futex); |
219 | futex_up(&fs_head_futex); |
| 218 | free(fs_info); |
220 | free(fs_info); |
| 219 | ipc_answer_0(callid, EEXISTS); |
221 | ipc_answer_0(callid, EEXISTS); |
| 220 | ipc_answer_0(rid, EEXISTS); |
222 | ipc_answer_0(rid, EEXISTS); |
| 221 | return; |
223 | return; |
| Line 224... | Line 226... | ||
| 224 | /* |
226 | /* |
| 225 | * Add fs_info to the list of registered FS's. |
227 | * Add fs_info to the list of registered FS's. |
| 226 | */ |
228 | */ |
| 227 | dprintf("Inserting FS into the list of registered file systems.\n"); |
229 | dprintf("Inserting FS into the list of registered file systems.\n"); |
| 228 | list_append(&fs_info->fs_link, &fs_head); |
230 | list_append(&fs_info->fs_link, &fs_head); |
| 229 | 231 | ||
| 230 | /* |
232 | /* |
| 231 | * Now we want the client to send us the IPC_M_CONNECT_TO_ME call so |
233 | * Now we want the client to send us the IPC_M_CONNECT_TO_ME call so |
| 232 | * that a callback connection is created and we have a phone through |
234 | * that a callback connection is created and we have a phone through |
| 233 | * which to forward VFS requests to it. |
235 | * which to forward VFS requests to it. |
| 234 | */ |
236 | */ |
| 235 | callid = async_get_call(&call); |
237 | callid = async_get_call(&call); |
| 236 | if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) { |
238 | if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) { |
| 237 | dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call)); |
239 | dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call)); |
| 238 | list_remove(&fs_info->fs_link); |
240 | list_remove(&fs_info->fs_link); |
| - | 241 | fibril_dec_sercount(); |
|
| 239 | futex_up(&fs_head_futex); |
242 | futex_up(&fs_head_futex); |
| 240 | free(fs_info); |
243 | free(fs_info); |
| 241 | ipc_answer_0(callid, EINVAL); |
244 | ipc_answer_0(callid, EINVAL); |
| 242 | ipc_answer_0(rid, EINVAL); |
245 | ipc_answer_0(rid, EINVAL); |
| 243 | return; |
246 | return; |
| Line 252... | Line 255... | ||
| 252 | */ |
255 | */ |
| 253 | 256 | ||
| 254 | if (!ipc_share_in_receive(&callid, &size)) { |
257 | if (!ipc_share_in_receive(&callid, &size)) { |
| 255 | dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call)); |
258 | dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call)); |
| 256 | list_remove(&fs_info->fs_link); |
259 | list_remove(&fs_info->fs_link); |
| - | 260 | fibril_dec_sercount(); |
|
| 257 | futex_up(&fs_head_futex); |
261 | futex_up(&fs_head_futex); |
| 258 | ipc_hangup(fs_info->phone); |
262 | ipc_hangup(fs_info->phone); |
| 259 | free(fs_info); |
263 | free(fs_info); |
| 260 | ipc_answer_0(callid, EINVAL); |
264 | ipc_answer_0(callid, EINVAL); |
| 261 | ipc_answer_0(rid, EINVAL); |
265 | ipc_answer_0(rid, EINVAL); |
| Line 266... | Line 270... | ||
| 266 | * We can only send the client address space area PLB_SIZE bytes long. |
270 | * We can only send the client address space area PLB_SIZE bytes long. |
| 267 | */ |
271 | */ |
| 268 | if (size != PLB_SIZE) { |
272 | if (size != PLB_SIZE) { |
| 269 | dprintf("Client suggests wrong size of PFB, size = %d\n", size); |
273 | dprintf("Client suggests wrong size of PFB, size = %d\n", size); |
| 270 | list_remove(&fs_info->fs_link); |
274 | list_remove(&fs_info->fs_link); |
| - | 275 | fibril_dec_sercount(); |
|
| 271 | futex_up(&fs_head_futex); |
276 | futex_up(&fs_head_futex); |
| 272 | ipc_hangup(fs_info->phone); |
277 | ipc_hangup(fs_info->phone); |
| 273 | free(fs_info); |
278 | free(fs_info); |
| 274 | ipc_answer_0(callid, EINVAL); |
279 | ipc_answer_0(callid, EINVAL); |
| 275 | ipc_answer_0(rid, EINVAL); |
280 | ipc_answer_0(rid, EINVAL); |
| Line 290... | Line 295... | ||
| 290 | * system a global file system handle. |
295 | * system a global file system handle. |
| 291 | */ |
296 | */ |
| 292 | fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next); |
297 | fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next); |
| 293 | ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); |
298 | ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); |
| 294 | 299 | ||
| - | 300 | fibril_dec_sercount(); |
|
| 295 | futex_up(&fs_head_futex); |
301 | futex_up(&fs_head_futex); |
| 296 | 302 | ||
| 297 | dprintf("\"%.*s\" filesystem successfully registered, handle=%d.\n", |
303 | dprintf("\"%.*s\" filesystem successfully registered, handle=%d.\n", |
| 298 | FS_NAME_MAXLEN, fs_info->vfs_info.name, fs_info->fs_handle); |
304 | FS_NAME_MAXLEN, fs_info->vfs_info.name, fs_info->fs_handle); |
| 299 | } |
305 | } |