Changes in uspace/srv/vfs/vfs_file.c [25bef0ff:6639ae1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_file.c
r25bef0ff r6639ae1 79 79 for (i = 0; i < MAX_OPEN_FILES; i++) { 80 80 if (FILES[i]) { 81 (void) vfs_close_internal(FILES[i]); 81 82 (void) vfs_fd_free(i); 82 83 } … … 107 108 } 108 109 109 /** Close the file in the endpoint FS server. */110 static int vfs_file_close_remote(vfs_file_t *file)111 {112 ipc_call_t answer;113 aid_t msg;114 sysarg_t rc;115 int phone;116 117 assert(!file->refcnt);118 119 phone = vfs_grab_phone(file->node->fs_handle);120 msg = async_send_2(phone, VFS_OUT_CLOSE, file->node->devmap_handle,121 file->node->index, &answer);122 async_wait_for(msg, &rc);123 vfs_release_phone(file->node->fs_handle, phone);124 125 return IPC_GET_ARG1(answer);126 }127 128 129 110 /** Increment reference count of VFS file structure. 130 111 * … … 144 125 * decremented. 145 126 */ 146 static int vfs_file_delref(vfs_file_t *file) 147 { 148 int rc = EOK; 149 127 static void vfs_file_delref(vfs_file_t *file) 128 { 150 129 assert(fibril_mutex_is_locked(&VFS_DATA->lock)); 151 130 152 131 if (file->refcnt-- == 1) { 153 132 /* 154 * Lost the last reference to a file, need to close it in the155 * endpoint FS and drop our referenceto the underlying VFS node.133 * Lost the last reference to a file, need to drop our reference 134 * to the underlying VFS node. 156 135 */ 157 rc = vfs_file_close_remote(file);158 136 vfs_node_delref(file->node); 159 137 free(file); 160 138 } 161 162 return rc;163 139 } 164 140 … … 225 201 int vfs_fd_free(int fd) 226 202 { 227 int rc;228 229 203 if (!vfs_files_init()) 230 204 return ENOMEM; … … 236 210 } 237 211 238 rc =vfs_file_delref(FILES[fd]);212 vfs_file_delref(FILES[fd]); 239 213 FILES[fd] = NULL; 240 214 fibril_mutex_unlock(&VFS_DATA->lock); 241 215 242 return rc;216 return EOK; 243 217 } 244 218
Note:
See TracChangeset
for help on using the changeset viewer.