Rev 2734 | Rev 2741 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2734 | Rev 2735 | ||
---|---|---|---|
Line 308... | Line 308... | ||
308 | 308 | ||
309 | int mkdir(const char *path, mode_t mode) |
309 | int mkdir(const char *path, mode_t mode) |
310 | { |
310 | { |
311 | int res; |
311 | int res; |
312 | ipcarg_t rc; |
312 | ipcarg_t rc; |
313 | ipc_call_t answer; |
- | |
314 | aid_t req; |
313 | aid_t req; |
315 | 314 | ||
316 | futex_down(&vfs_phone_futex); |
315 | futex_down(&vfs_phone_futex); |
317 | async_serialize_start(); |
316 | async_serialize_start(); |
318 | if (vfs_phone < 0) { |
317 | if (vfs_phone < 0) { |
Line 321... | Line 320... | ||
321 | async_serialize_end(); |
320 | async_serialize_end(); |
322 | futex_up(&vfs_phone_futex); |
321 | futex_up(&vfs_phone_futex); |
323 | return res; |
322 | return res; |
324 | } |
323 | } |
325 | } |
324 | } |
326 | req = async_send_1(vfs_phone, VFS_MKDIR, mode, &answer); |
325 | req = async_send_1(vfs_phone, VFS_MKDIR, mode, NULL); |
327 | rc = ipc_data_write_start(vfs_phone, path, strlen(path)); |
326 | rc = ipc_data_write_start(vfs_phone, path, strlen(path)); |
328 | if (rc != EOK) { |
327 | if (rc != EOK) { |
329 | async_wait_for(req, NULL); |
328 | async_wait_for(req, NULL); |
330 | async_serialize_end(); |
329 | async_serialize_end(); |
331 | futex_up(&vfs_phone_futex); |
330 | futex_up(&vfs_phone_futex); |
Line 335... | Line 334... | ||
335 | async_serialize_end(); |
334 | async_serialize_end(); |
336 | futex_up(&vfs_phone_futex); |
335 | futex_up(&vfs_phone_futex); |
337 | return EOK; |
336 | return EOK; |
338 | } |
337 | } |
339 | 338 | ||
- | 339 | static int _unlink(const char *path, int lflag) |
|
- | 340 | { |
|
- | 341 | int res; |
|
- | 342 | ipcarg_t rc; |
|
- | 343 | aid_t req; |
|
- | 344 | ||
- | 345 | futex_down(&vfs_phone_futex); |
|
- | 346 | async_serialize_start(); |
|
- | 347 | if (vfs_phone < 0) { |
|
- | 348 | res = vfs_connect(); |
|
- | 349 | if (res < 0) { |
|
- | 350 | async_serialize_end(); |
|
- | 351 | futex_up(&vfs_phone_futex); |
|
- | 352 | return res; |
|
- | 353 | } |
|
- | 354 | } |
|
- | 355 | req = async_send_0(vfs_phone, VFS_UNLINK, NULL); |
|
- | 356 | rc = ipc_data_write_start(vfs_phone, path, strlen(path)); |
|
- | 357 | if (rc != EOK) { |
|
- | 358 | async_wait_for(req, NULL); |
|
- | 359 | async_serialize_end(); |
|
- | 360 | futex_up(&vfs_phone_futex); |
|
- | 361 | return (int) rc; |
|
- | 362 | } |
|
- | 363 | async_wait_for(req, &rc); |
|
- | 364 | async_serialize_end(); |
|
- | 365 | futex_up(&vfs_phone_futex); |
|
- | 366 | return EOK; |
|
- | 367 | } |
|
- | 368 | ||
- | 369 | int unlink(const char *path) |
|
- | 370 | { |
|
- | 371 | return _unlink(path, L_NONE); |
|
- | 372 | } |
|
- | 373 | ||
- | 374 | int rmdir(const char *path) |
|
- | 375 | { |
|
- | 376 | return _unlink(path, L_DIRECTORY); |
|
- | 377 | } |
|
- | 378 | ||
340 | /** @} |
379 | /** @} |
341 | */ |
380 | */ |