Changes in uspace/srv/vfs/vfs_file.c [b7fd2a0:40feeac] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_file.c
rb7fd2a0 r40feeac 64 64 } vfs_boxed_handle_t; 65 65 66 static errno_t _vfs_fd_free(vfs_client_data_t *, int);66 static int _vfs_fd_free(vfs_client_data_t *, int); 67 67 68 68 /** Initialize the table of open files. */ … … 133 133 134 134 /** Close the file in the endpoint FS server. */ 135 static errno_t vfs_file_close_remote(vfs_file_t *file)135 static int vfs_file_close_remote(vfs_file_t *file) 136 136 { 137 137 assert(!file->refcnt); … … 145 145 vfs_exchange_release(exch); 146 146 147 errno_t rc;147 sysarg_t rc; 148 148 async_wait_for(msg, &rc); 149 149 150 return IPC_GET_ RETVAL(answer);150 return IPC_GET_ARG1(answer); 151 151 } 152 152 … … 168 168 * decremented. 169 169 */ 170 static errno_t vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file)171 { 172 errno_t rc = EOK;170 static int vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file) 171 { 172 int rc = EOK; 173 173 174 174 assert(fibril_mutex_is_locked(&vfs_data->lock)); … … 192 192 } 193 193 194 static errno_t _vfs_fd_alloc(vfs_client_data_t *vfs_data, vfs_file_t **file, bool desc, int *out_fd)194 static int _vfs_fd_alloc(vfs_client_data_t *vfs_data, vfs_file_t **file, bool desc) 195 195 { 196 196 if (!vfs_files_init(vfs_data)) … … 223 223 224 224 fibril_mutex_unlock(&vfs_data->lock); 225 *out_fd = (int) i; 226 return EOK; 225 return (int) i; 227 226 } 228 227 … … 250 249 * in a descending order. 251 250 * 252 * @param[out] out_fd First available file descriptor 253 * 254 * @return Error code. 255 */ 256 errno_t vfs_fd_alloc(vfs_file_t **file, bool desc, int *out_fd) 257 { 258 return _vfs_fd_alloc(VFS_DATA, file, desc, out_fd); 259 } 260 261 static errno_t _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd) 251 * @return First available file descriptor or a negative error 252 * code. 253 */ 254 int vfs_fd_alloc(vfs_file_t **file, bool desc) 255 { 256 return _vfs_fd_alloc(VFS_DATA, file, desc); 257 } 258 259 static int _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd) 262 260 { 263 261 if ((fd < 0) || (fd >= MAX_OPEN_FILES) || !vfs_data->files[fd]) { … … 265 263 } 266 264 267 errno_t rc = vfs_file_delref(vfs_data, vfs_data->files[fd]);265 int rc = vfs_file_delref(vfs_data, vfs_data->files[fd]); 268 266 vfs_data->files[fd] = NULL; 269 267 return rc; 270 268 } 271 269 272 static errno_t _vfs_fd_free(vfs_client_data_t *vfs_data, int fd)273 { 274 errno_t rc;270 static int _vfs_fd_free(vfs_client_data_t *vfs_data, int fd) 271 { 272 int rc; 275 273 276 274 if (!vfs_files_init(vfs_data)) … … 291 289 * descriptor. 292 290 */ 293 errno_t vfs_fd_free(int fd)291 int vfs_fd_free(int fd) 294 292 { 295 293 return _vfs_fd_free(VFS_DATA, fd); … … 305 303 * 306 304 */ 307 errno_t vfs_fd_assign(vfs_file_t *file, int fd)305 int vfs_fd_assign(vfs_file_t *file, int fd) 308 306 { 309 307 if (!vfs_files_init(VFS_DATA)) … … 429 427 } 430 428 431 errno_t vfs_wait_handle_internal(bool high_fd, int *out_fd)429 int vfs_wait_handle_internal(bool high_fd) 432 430 { 433 431 vfs_client_data_t *vfs_data = VFS_DATA; … … 443 441 444 442 vfs_file_t *file; 445 errno_t rc = _vfs_fd_alloc(vfs_data, &file, high_fd, out_fd);446 if ( rc != EOK) {443 int fd = _vfs_fd_alloc(vfs_data, &file, high_fd); 444 if (fd < 0) { 447 445 vfs_node_delref(bh->node); 448 446 free(bh); 449 return rc;447 return fd; 450 448 } 451 449 … … 454 452 vfs_file_put(file); 455 453 free(bh); 456 return EOK;454 return fd; 457 455 } 458 456
Note:
See TracChangeset
for help on using the changeset viewer.