Changeset ac23b9d3 in mainline
- Timestamp:
- 2009-05-23T16:28:28Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ad8fc510
- Parents:
- 493853ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_file.c
r493853ec rac23b9d3 79 79 int vfs_fd_alloc(void) 80 80 { 81 int i; 82 81 if (!vfs_files_init()) 82 return ENOMEM; 83 84 unsigned int i; 83 85 for (i = 0; i < MAX_OPEN_FILES; i++) { 84 86 if (!files[i]) { … … 86 88 if (!files[i]) 87 89 return ENOMEM; 90 88 91 memset(files[i], 0, sizeof(vfs_file_t)); 89 92 futex_initialize(&files[i]->lock, 1); 90 93 vfs_file_addref(files[i]); 91 return i;94 return (int) i; 92 95 } 93 96 } 97 94 98 return EMFILE; 95 99 } … … 104 108 int vfs_fd_free(int fd) 105 109 { 110 if (!vfs_files_init()) 111 return ENOMEM; 112 106 113 if ((fd < 0) || (fd >= MAX_OPEN_FILES) || (files[fd] == NULL)) 107 114 return EBADF; 115 108 116 vfs_file_delref(files[fd]); 109 117 files[fd] = NULL; 118 110 119 return EOK; 111 120 } … … 151 160 vfs_file_t *vfs_file_get(int fd) 152 161 { 162 if (!vfs_files_init()) 163 return NULL; 164 153 165 if ((fd >= 0) && (fd < MAX_OPEN_FILES)) 154 166 return files[fd]; 167 155 168 return NULL; 156 169 } … … 158 171 /** 159 172 * @} 160 */ 173 */
Note:
See TracChangeset
for help on using the changeset viewer.