Changeset d18c404 in mainline
- Timestamp:
- 2013-07-25T12:47:58Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d60ce4a
- Parents:
- 20c071d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vfs/vfs.c
r20c071d rd18c404 388 388 } 389 389 390 // TODO: Versioning for read. 391 390 392 ssize_t read(int fildes, void *buf, size_t nbyte) 391 393 { … … 665 667 } 666 668 667 static int _ unlink(const char *path, int lflag)669 static int _vfs_unlink2(int parent, const char *path, int expect, int wflag) 668 670 { 669 671 sysarg_t rc; 670 672 aid_t req; 671 673 674 async_exch_t *exch = vfs_exchange_begin(); 675 676 req = async_send_3(exch, VFS_IN_UNLINK2, parent, expect, wflag, NULL); 677 rc = async_data_write_start(exch, path, str_size(path)); 678 679 vfs_exchange_end(exch); 680 681 sysarg_t rc_orig; 682 async_wait_for(req, &rc_orig); 683 684 if (rc_orig != EOK) { 685 return (int) rc_orig; 686 } 687 return rc; 688 } 689 690 int unlink(const char *path) 691 { 672 692 size_t pa_size; 673 693 char *pa = absolutize(path, &pa_size); 674 if (!pa) 694 if (!pa) { 675 695 return ENOMEM; 676 677 async_exch_t *exch = vfs_exchange_begin(); 678 679 req = async_send_1(exch, VFS_IN_UNLINK, lflag, NULL); 680 rc = async_data_write_start(exch, pa, pa_size); 681 if (rc != EOK) { 682 vfs_exchange_end(exch); 683 free(pa); 684 685 sysarg_t rc_orig; 686 async_wait_for(req, &rc_orig); 687 688 if (rc_orig == EOK) 689 return (int) rc; 690 else 691 return (int) rc_orig; 692 } 693 vfs_exchange_end(exch); 694 free(pa); 695 async_wait_for(req, &rc); 696 return rc; 697 } 698 699 int unlink(const char *path) 700 { 701 return _unlink(path, L_NONE); 696 } 697 698 return _vfs_unlink2(-1, pa, -1, 0); 702 699 } 703 700 704 701 int rmdir(const char *path) 705 702 { 706 return _unlink(path, L_DIRECTORY); 703 size_t pa_size; 704 char *pa = absolutize(path, &pa_size); 705 if (!pa) { 706 return ENOMEM; 707 } 708 709 return _vfs_unlink2(-1, pa, -1, WALK_DIRECTORY); 707 710 } 708 711
Note:
See TracChangeset
for help on using the changeset viewer.