Changeset 6ad454f in mainline for uspace/srv/vfs/vfs_ops.c
- Timestamp:
- 2017-12-08T21:03:35Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a8c7a6d
- Parents:
- 9246016
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 06:01:16)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:03:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r9246016 r6ad454f 104 104 /* Assign the old file to newfd. */ 105 105 rc = vfs_fd_assign(oldfile, newfd); 106 *out_fd = newfd; 106 107 } else { 107 108 vfs_file_t *newfile; 108 int newfd = vfs_fd_alloc(&newfile, desc);109 if ( newfd >= 0) {109 rc = vfs_fd_alloc(&newfile, desc, out_fd); 110 if (rc == EOK) { 110 111 newfile->node = oldfile->node; 111 112 newfile->permissions = oldfile->permissions; … … 114 115 vfs_file_put(newfile); 115 116 } 116 rc = newfd;117 117 } 118 118 vfs_file_put(oldfile); 119 119 120 if (rc < 0) { 121 return rc; 122 } 123 124 *out_fd = rc; 125 return EOK; 120 return rc; 126 121 } 127 122 … … 228 223 229 224 int vfs_op_mount(int mpfd, unsigned service_id, unsigned flags, 230 unsigned instance, const char *opts, const char *fs_name, int *out fd)225 unsigned instance, const char *opts, const char *fs_name, int *out_fd) 231 226 { 232 227 int rc; 233 228 vfs_file_t *mp = NULL; 234 229 vfs_file_t *file = NULL; 235 intfd = -1;230 *out_fd = -1; 236 231 237 232 if (!(flags & VFS_MOUNT_CONNECT_ONLY)) { … … 259 254 260 255 if (!(flags & VFS_MOUNT_NO_REF)) { 261 fd = vfs_fd_alloc(&file, false); 262 if (fd < 0) { 263 rc = fd; 256 rc = vfs_fd_alloc(&file, false, out_fd); 257 if (rc != EOK) { 264 258 goto out; 265 259 } … … 300 294 vfs_file_put(file); 301 295 302 if (rc != EOK && fd >= 0) { 303 vfs_fd_free(fd); 304 fd = 0; 305 } 306 307 *outfd = fd; 296 if (rc != EOK && *out_fd >= 0) { 297 vfs_fd_free(*out_fd); 298 *out_fd = -1; 299 } 300 308 301 return rc; 309 302 } … … 833 826 } 834 827 835 int vfs_op_wait_handle(bool high_fd )836 { 837 return vfs_wait_handle_internal(high_fd );828 int vfs_op_wait_handle(bool high_fd, int *out_fd) 829 { 830 return vfs_wait_handle_internal(high_fd, out_fd); 838 831 } 839 832 … … 897 890 898 891 vfs_file_t *file; 899 int fd = vfs_fd_alloc(&file, false);900 if ( fd < 0) {892 rc = vfs_fd_alloc(&file, false, out_fd); 893 if (rc != EOK) { 901 894 vfs_node_put(node); 902 895 vfs_file_put(parent); 903 return fd;896 return rc; 904 897 } 905 898 assert(file != NULL); … … 915 908 fibril_rwlock_read_unlock(&namespace_rwlock); 916 909 917 *out_fd = fd;918 910 return EOK; 919 911 }
Note:
See TracChangeset
for help on using the changeset viewer.