Changes in uspace/srv/vfs/vfs_file.c [79ae36dd:6639ae1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_file.c
r79ae36dd r6639ae1 45 45 #include "vfs.h" 46 46 47 #define VFS_DATA ((vfs_client_data_t *) async_ get_client_data())47 #define VFS_DATA ((vfs_client_data_t *) async_client_data_get()) 48 48 #define FILES (VFS_DATA->files) 49 49 … … 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 assert(!file->refcnt);113 114 async_exch_t *exch = vfs_exchange_grab(file->node->fs_handle);115 116 ipc_call_t answer;117 aid_t msg = async_send_2(exch, VFS_OUT_CLOSE, file->node->devmap_handle,118 file->node->index, &answer);119 120 vfs_exchange_release(exch);121 122 sysarg_t rc;123 async_wait_for(msg, &rc);124 125 return IPC_GET_ARG1(answer);126 }127 128 110 /** Increment reference count of VFS file structure. 129 111 * … … 143 125 * decremented. 144 126 */ 145 static int vfs_file_delref(vfs_file_t *file) 146 { 147 int rc = EOK; 148 127 static void vfs_file_delref(vfs_file_t *file) 128 { 149 129 assert(fibril_mutex_is_locked(&VFS_DATA->lock)); 150 130 151 131 if (file->refcnt-- == 1) { 152 132 /* 153 * Lost the last reference to a file, need to close it in the154 * 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. 155 135 */ 156 rc = vfs_file_close_remote(file);157 136 vfs_node_delref(file->node); 158 137 free(file); 159 138 } 160 161 return rc;162 139 } 163 140 … … 224 201 int vfs_fd_free(int fd) 225 202 { 226 int rc;227 228 203 if (!vfs_files_init()) 229 204 return ENOMEM; … … 235 210 } 236 211 237 rc =vfs_file_delref(FILES[fd]);212 vfs_file_delref(FILES[fd]); 238 213 FILES[fd] = NULL; 239 214 fibril_mutex_unlock(&VFS_DATA->lock); 240 215 241 return rc;216 return EOK; 242 217 } 243 218
Note:
See TracChangeset
for help on using the changeset viewer.