Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision cde999aca79219e8751af76502001a86d411d176)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision a0a9cc249adce31c755defdb6b74a991ebbf55ea)
@@ -86,5 +86,5 @@
  * and consume system resources.
  *
- * Functions that return int return an error code on error and do not
+ * Functions that return errno_t return an error code on error and do not
  * set errno. Depending on function, success is signalled by returning either
  * EOK or a non-negative file handle.
@@ -97,5 +97,5 @@
  * 	if (file < 0)
  * 		return file;
- * 	int rc = vfs_open(file, MODE_READ);
+ * 	errno_t rc = vfs_open(file, MODE_READ);
  * 	if (rc != EOK) {
  * 		(void) vfs_put(file);
@@ -128,5 +128,5 @@
 static int root_fd = -1;
 
-static int get_parent_and_child(const char *path, int *parent, char **child)
+static errno_t get_parent_and_child(const char *path, int *parent, char **child)
 {
 	size_t size;
@@ -146,5 +146,5 @@
 	} else {
 		*slash = '\0';
-		int rc = vfs_lookup(apath, WALK_DIRECTORY, parent);
+		errno_t rc = vfs_lookup(apath, WALK_DIRECTORY, parent);
 		if (rc != EOK) {
 			free(apath);
@@ -238,5 +238,5 @@
  * @return              New file handle on success or an error code
  */
-int vfs_clone(int file_from, int file_to, bool high, int *handle)
+errno_t vfs_clone(int file_from, int file_to, bool high, int *handle)
 {
 	assert(handle != NULL);
@@ -244,5 +244,5 @@
 	async_exch_t *vfs_exch = vfs_exchange_begin();
 	sysarg_t ret;
-	int rc = async_req_3_1(vfs_exch, VFS_IN_CLONE, (sysarg_t) file_from,
+	errno_t rc = async_req_3_1(vfs_exch, VFS_IN_CLONE, (sysarg_t) file_from,
 	    (sysarg_t) file_to, (sysarg_t) high, &ret);
 	vfs_exchange_end(vfs_exch);
@@ -261,5 +261,5 @@
  * @return              EOK on success or a non-error code
  */
-int vfs_cwd_get(char *buf, size_t size)
+errno_t vfs_cwd_get(char *buf, size_t size)
 {
 	fibril_mutex_lock(&cwd_mutex);
@@ -282,5 +282,5 @@
  * @return      EOK on success or an error code
  */
-int vfs_cwd_set(const char *path)
+errno_t vfs_cwd_set(const char *path)
 {
 	size_t abs_size;
@@ -290,5 +290,5 @@
 	
 	int fd;
-	int rc = vfs_lookup(abs, WALK_DIRECTORY, &fd);
+	errno_t rc = vfs_lookup(abs, WALK_DIRECTORY, &fd);
 	if (rc != EOK) {
 		free(abs);
@@ -353,6 +353,6 @@
 {
 	struct stat stat;
-	int rc = vfs_stat(file, &stat);
-	if (rc != 0)
+	errno_t rc = vfs_stat(file, &stat);
+	if (rc != EOK)
 		return NULL;
 	
@@ -372,8 +372,8 @@
  * @return                      EOK on success or an error code
  */
-int vfs_fsprobe(const char *fs_name, service_id_t serv,
+errno_t vfs_fsprobe(const char *fs_name, service_id_t serv,
     vfs_fs_probe_info_t *info)
 {
-	int rc;
+	errno_t rc;
 	
 	ipc_call_t answer;
@@ -406,5 +406,5 @@
  * @return                      EOK on success or an error code
  */
-int vfs_fstypes(vfs_fstypes_t *fstypes)
+errno_t vfs_fstypes(vfs_fstypes_t *fstypes)
 {
 	sysarg_t size;
@@ -414,5 +414,5 @@
 
 	async_exch_t *exch = vfs_exchange_begin();
-	int rc = async_req_0_1(exch, VFS_IN_FSTYPES, &size);
+	errno_t rc = async_req_0_1(exch, VFS_IN_FSTYPES, &size);
 
 	if (rc != EOK) {
@@ -501,9 +501,9 @@
  * @return              EOK on success or an error code
  */
-int vfs_link(int parent, const char *child, vfs_file_kind_t kind, int *linkedfd)
+errno_t vfs_link(int parent, const char *child, vfs_file_kind_t kind, int *linkedfd)
 {
 	int flags = (kind == KIND_DIRECTORY) ? WALK_DIRECTORY : WALK_REGULAR;
 	int file = -1;
-	int rc = vfs_walk(parent, child, WALK_MUST_CREATE | flags, &file);
+	errno_t rc = vfs_walk(parent, child, WALK_MUST_CREATE | flags, &file);
 	if (rc != EOK)
 		return rc;
@@ -531,9 +531,9 @@
  * @return              EOK on success or an error code
  */
-int vfs_link_path(const char *path, vfs_file_kind_t kind, int *linkedfd)
+errno_t vfs_link_path(const char *path, vfs_file_kind_t kind, int *linkedfd)
 {
 	char *child;
 	int parent;
-	int rc = get_parent_and_child(path, &parent, &child);
+	errno_t rc = get_parent_and_child(path, &parent, &child);
 	if (rc != EOK)
 		return rc;
@@ -554,5 +554,5 @@
  * @return      EOK on success or an error code.
  */
-int vfs_lookup(const char *path, int flags, int *handle)
+errno_t vfs_lookup(const char *path, int flags, int *handle)
 {
 	size_t size;
@@ -570,5 +570,5 @@
 	*handle = -1;
 
-	int rc = vfs_walk(root, p, flags, handle);
+	errno_t rc = vfs_walk(root, p, flags, handle);
 	vfs_put(root);
 	free(p);
@@ -587,8 +587,8 @@
  * @return      EOK on success or an error code
  */
-int vfs_lookup_open(const char *path, int flags, int mode, int *handle)
+errno_t vfs_lookup_open(const char *path, int flags, int mode, int *handle)
 {
 	int file;
-	int rc = vfs_lookup(path, flags, &file);
+	errno_t rc = vfs_lookup(path, flags, &file);
 	if (rc != EOK)
 		return rc;
@@ -616,8 +616,8 @@
  * @return                      EOK on success or an error code
  */
-int vfs_mount(int mp, const char *fs_name, service_id_t serv, const char *opts,
+errno_t vfs_mount(int mp, const char *fs_name, service_id_t serv, const char *opts,
     unsigned int flags, unsigned int instance, int *mountedfd)
 {
-	int rc, rc1;
+	errno_t rc, rc1;
 	
 	if (!mountedfd)
@@ -660,5 +660,5 @@
  * @return                      EOK on success or an error code
  */
-int vfs_mount_path(const char *mp, const char *fs_name, const char *fqsn,
+errno_t vfs_mount_path(const char *mp, const char *fs_name, const char *fqsn,
     const char *opts, unsigned int flags, unsigned int instance)
 {
@@ -685,5 +685,5 @@
 	
 	service_id_t service_id;
-	int res = loc_service_get_id(fqsn, &service_id, flags);
+	errno_t res = loc_service_get_id(fqsn, &service_id, flags);
 	if (res != EOK) {
 		if (null_id != -1)
@@ -704,5 +704,5 @@
 	fibril_mutex_lock(&root_mutex);
 	
-	int rc;
+	errno_t rc;
 	
 	if (str_cmp(mpa, "/") == 0) {
@@ -743,5 +743,5 @@
 		loc_null_destroy(null_id);
 	
-	return (int) rc;
+	return (errno_t) rc;
 }
 
@@ -754,8 +754,8 @@
  * @return      EOK on success or an error code
  */
-int vfs_open(int file, int mode)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	int rc = async_req_2_0(exch, VFS_IN_OPEN, file, mode);
+errno_t vfs_open(int file, int mode)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	errno_t rc = async_req_2_0(exch, VFS_IN_OPEN, file, mode);
 	vfs_exchange_end(exch);
 	
@@ -771,5 +771,5 @@
  * @return              EOK on success or an error code
  */
-int vfs_pass_handle(async_exch_t *vfs_exch, int file, async_exch_t *exch)
+errno_t vfs_pass_handle(async_exch_t *vfs_exch, int file, async_exch_t *exch)
 {
 	return async_state_change_start(exch, VFS_PASS_HANDLE, (sysarg_t) file,
@@ -783,8 +783,8 @@
  * @return      EOK on success or an error code
  */
-int vfs_put(int file)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	int rc = async_req_1_0(exch, VFS_IN_PUT, file);
+errno_t vfs_put(int file)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	errno_t rc = async_req_1_0(exch, VFS_IN_PUT, file);
 	vfs_exchange_end(exch);
 	
@@ -800,5 +800,5 @@
  * @return       EOK on success or an error code
  */
-int vfs_receive_handle(bool high, int *handle)
+errno_t vfs_receive_handle(bool high, int *handle)
 {
 	ipc_callid_t callid;
@@ -813,5 +813,5 @@
 
 	sysarg_t ret;
-	int rc = async_req_1_1(vfs_exch, VFS_IN_WAIT_HANDLE, high, &ret);
+	errno_t rc = async_req_1_1(vfs_exch, VFS_IN_WAIT_HANDLE, high, &ret);
 
 	async_exchange_end(vfs_exch);
@@ -839,10 +839,10 @@
  * @return              On failure, an error code
  */
-int vfs_read(int file, aoff64_t *pos, void *buf, size_t nbyte, size_t *nread)
+errno_t vfs_read(int file, aoff64_t *pos, void *buf, size_t nbyte, size_t *nread)
 {
 	ssize_t cnt = 0;
 	size_t nr = 0;
 	uint8_t *bp = (uint8_t *) buf;
-	int rc;
+	errno_t rc;
 	
 	do {
@@ -879,8 +879,8 @@
  * @return              EOK on success or an error code
  */
-int vfs_read_short(int file, aoff64_t pos, void *buf, size_t nbyte,
+errno_t vfs_read_short(int file, aoff64_t pos, void *buf, size_t nbyte,
     ssize_t *nread)
 {
-	int rc;
+	errno_t rc;
 	ipc_call_t answer;
 	aid_t req;
@@ -921,8 +921,8 @@
  * @return      EOK on success or an error code
  */
-int vfs_rename_path(const char *old, const char *new)
-{
-	int rc;
-	int rc_orig;
+errno_t vfs_rename_path(const char *old, const char *new)
+{
+	errno_t rc;
+	errno_t rc_orig;
 	aid_t req;
 	
@@ -988,8 +988,8 @@
  * @return              EOK on success or an error code
  */
-int vfs_resize(int file, aoff64_t length)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	int rc = async_req_3_0(exch, VFS_IN_RESIZE, file, LOWER32(length),
+errno_t vfs_resize(int file, aoff64_t length)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	errno_t rc = async_req_3_0(exch, VFS_IN_RESIZE, file, LOWER32(length),
 	    UPPER32(length));
 	vfs_exchange_end(exch);
@@ -1009,5 +1009,5 @@
 		fd = -1;
 	} else {
-		int rc = vfs_clone(root_fd, -1, true, &fd);
+		errno_t rc = vfs_clone(root_fd, -1, true, &fd);
 		if (rc != EOK) {
 			fd = -1;
@@ -1028,8 +1028,8 @@
  * @return  Error code
  */
-int vfs_root_set(int nroot)
+errno_t vfs_root_set(int nroot)
 {
 	int new_root;
-	int rc = vfs_clone(nroot, -1, true, &new_root);
+	errno_t rc = vfs_clone(nroot, -1, true, &new_root);
 	if (rc != EOK) {
 		return rc;
@@ -1052,7 +1052,7 @@
  * @return              EOK on success or an error code
  */
-int vfs_stat(int file, struct stat *stat)
-{
-	int rc;
+errno_t vfs_stat(int file, struct stat *stat)
+{
+	errno_t rc;
 	aid_t req;
 	
@@ -1064,5 +1064,5 @@
 		vfs_exchange_end(exch);
 		
-		int rc_orig;
+		errno_t rc_orig;
 		async_wait_for(req, &rc_orig);
 		
@@ -1086,8 +1086,8 @@
  * @return              EOK on success or an error code
  */
-int vfs_stat_path(const char *path, struct stat *stat)
+errno_t vfs_stat_path(const char *path, struct stat *stat)
 {
 	int file;
-	int rc = vfs_lookup(path, 0, &file);
+	errno_t rc = vfs_lookup(path, 0, &file);
 	if (rc != EOK)
 		return rc;
@@ -1107,7 +1107,7 @@
  * @return              EOK on success or an error code
  */
-int vfs_statfs(int file, struct statfs *st)
-{
-	int rc, ret;
+errno_t vfs_statfs(int file, struct statfs *st)
+{
+	errno_t rc, ret;
 	aid_t req;
 
@@ -1132,8 +1132,8 @@
  * @return              EOK on success or an error code
  */
-int vfs_statfs_path(const char *path, struct statfs *st)
+errno_t vfs_statfs_path(const char *path, struct statfs *st)
 {
 	int file;
-	int rc = vfs_lookup(path, 0, &file);
+	errno_t rc = vfs_lookup(path, 0, &file);
 	if (rc != EOK)
 		return rc;
@@ -1152,8 +1152,8 @@
  * @return      EOK on success or an error code
  */
-int vfs_sync(int file)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	int rc = async_req_1_0(exch, VFS_IN_SYNC, file);
+errno_t vfs_sync(int file)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	errno_t rc = async_req_1_0(exch, VFS_IN_SYNC, file);
 	vfs_exchange_end(exch);
 	
@@ -1174,7 +1174,7 @@
  * @return              EOK on success or an error code
  */
-int vfs_unlink(int parent, const char *child, int expect)
-{
-	int rc;
+errno_t vfs_unlink(int parent, const char *child, int expect)
+{
+	errno_t rc;
 	aid_t req;
 	
@@ -1186,9 +1186,9 @@
 	vfs_exchange_end(exch);
 	
-	int rc_orig;
+	errno_t rc_orig;
 	async_wait_for(req, &rc_orig);
 	
 	if (rc_orig != EOK)
-		return (int) rc_orig;
+		return (errno_t) rc_orig;
 	return rc;
 }
@@ -1203,8 +1203,8 @@
  * @return              EOK on success or an error code
  */
-int vfs_unlink_path(const char *path)
+errno_t vfs_unlink_path(const char *path)
 {
 	int expect;
-	int rc = vfs_lookup(path, 0, &expect);
+	errno_t rc = vfs_lookup(path, 0, &expect);
 	if (rc != EOK)
 		return rc;
@@ -1232,8 +1232,8 @@
  * @return      EOK on success or an error code
  */
-int vfs_unmount(int mp)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	int rc = async_req_1_0(exch, VFS_IN_UNMOUNT, mp);
+errno_t vfs_unmount(int mp)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	errno_t rc = async_req_1_0(exch, VFS_IN_UNMOUNT, mp);
 	vfs_exchange_end(exch);
 	return rc;
@@ -1246,8 +1246,8 @@
  * @return      EOK on success or an error code
  */
-int vfs_unmount_path(const char *mpp)
+errno_t vfs_unmount_path(const char *mpp)
 {
 	int mp;
-	int rc = vfs_lookup(mpp, WALK_MOUNT_POINT | WALK_DIRECTORY, &mp);
+	errno_t rc = vfs_lookup(mpp, WALK_MOUNT_POINT | WALK_DIRECTORY, &mp);
 	if (rc != EOK)
 		return rc;
@@ -1267,5 +1267,5 @@
  * @return              Error code.
  */
-int vfs_walk(int parent, const char *path, int flags, int *handle)
+errno_t vfs_walk(int parent, const char *path, int flags, int *handle)
 {
 	async_exch_t *exch = vfs_exchange_begin();
@@ -1273,15 +1273,15 @@
 	ipc_call_t answer;
 	aid_t req = async_send_2(exch, VFS_IN_WALK, parent, flags, &answer);
-	int rc = async_data_write_start(exch, path, str_size(path));
+	errno_t rc = async_data_write_start(exch, path, str_size(path));
 	vfs_exchange_end(exch);
 		
-	int rc_orig;
+	errno_t rc_orig;
 	async_wait_for(req, &rc_orig);
 
 	if (rc_orig != EOK)
-		return (int) rc_orig;
+		return (errno_t) rc_orig;
 		
 	if (rc != EOK)
-		return (int) rc;
+		return (errno_t) rc;
 	
 	*handle = (int) IPC_GET_ARG1(answer);
@@ -1304,5 +1304,5 @@
  * @return              On failure, an error code
  */
-int vfs_write(int file, aoff64_t *pos, const void *buf, size_t nbyte,
+errno_t vfs_write(int file, aoff64_t *pos, const void *buf, size_t nbyte,
     size_t *nwritten)
 {
@@ -1310,5 +1310,5 @@
 	ssize_t nwr = 0;
 	const uint8_t *bp = (uint8_t *) buf;
-	int rc;
+	errno_t rc;
 
 	do {
@@ -1343,8 +1343,8 @@
  * @return              EOK on success or an error code
  */
-int vfs_write_short(int file, aoff64_t pos, const void *buf, size_t nbyte,
+errno_t vfs_write_short(int file, aoff64_t pos, const void *buf, size_t nbyte,
     ssize_t *nwritten)
 {
-	int rc;
+	errno_t rc;
 	ipc_call_t answer;
 	aid_t req;
