Changeset 42a619b in mainline for uspace/srv
- Timestamp:
- 2011-08-19T08:58:50Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7dcb7981, 903bac0a, c2cf033
- Parents:
- ef7052ec (diff), d894fbd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/srv
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/port/adb_mouse.c
ref7052ec r42a619b 42 42 #include <errno.h> 43 43 #include <loc.h> 44 #include <stdio.h> 44 45 45 46 static mouse_dev_t *mouse_dev; -
uspace/srv/hw/irc/apic/apic.c
ref7052ec r42a619b 45 45 #include <errno.h> 46 46 #include <async.h> 47 #include <stdio.h> 47 48 48 49 #define NAME "apic" -
uspace/srv/loader/main.c
ref7052ec r42a619b 61 61 #include <elf/elf.h> 62 62 #include <elf/elf_load.h> 63 #include <vfs/vfs.h> 63 64 64 65 #ifdef CONFIG_RTLD … … 89 90 90 91 /** Number of preset files */ 91 static int filc = 0; 92 /** Preset files vector */ 93 static fdi_node_t **filv = NULL; 94 /** Buffer holding all preset files */ 95 static fdi_node_t *fil_buf = NULL; 92 static unsigned int filc = 0; 96 93 97 94 static elf_info_t prog_info; … … 239 236 static void ldr_set_files(ipc_callid_t rid, ipc_call_t *request) 240 237 { 241 fdi_node_t *buf; 242 size_t buf_size; 243 int rc = async_data_write_accept((void **) &buf, false, 0, 0, 244 sizeof(fdi_node_t), &buf_size); 245 246 if (rc == EOK) { 247 int count = buf_size / sizeof(fdi_node_t); 248 249 /* 250 * Allocate new filv 251 */ 252 fdi_node_t **_filv = (fdi_node_t **) calloc(count + 1, sizeof(fdi_node_t *)); 253 if (_filv == NULL) { 254 free(buf); 255 async_answer_0(rid, ENOMEM); 256 return; 238 size_t count = IPC_GET_ARG1(*request); 239 240 async_exch_t *vfs_exch = vfs_exchange_begin(); 241 242 for (filc = 0; filc < count; filc++) { 243 ipc_callid_t callid; 244 int fd; 245 246 if (!async_state_change_receive(&callid, NULL, NULL, NULL)) { 247 async_answer_0(callid, EINVAL); 248 break; 257 249 } 258 259 /* 260 * Fill the new filv with argument pointers 261 */ 262 int i; 263 for (i = 0; i < count; i++) 264 _filv[i] = &buf[i]; 265 266 _filv[count] = NULL; 267 268 /* 269 * Copy temporary data to global variables 270 */ 271 if (fil_buf != NULL) 272 free(fil_buf); 273 274 if (filv != NULL) 275 free(filv); 276 277 filc = count; 278 fil_buf = buf; 279 filv = _filv; 280 } 281 250 async_state_change_finalize(callid, vfs_exch); 251 fd = fd_wait(); 252 assert(fd == (int) filc); 253 } 254 255 vfs_exchange_end(vfs_exch); 256 282 257 async_answer_0(rid, EOK); 283 258 } … … 308 283 309 284 pcb.filc = filc; 310 pcb.filv = filv;311 285 312 286 if (prog_info.interp == NULL) { -
uspace/srv/loc/loc.h
ref7052ec r42a619b 36 36 #define LOC_H_ 37 37 38 #include <ipc/loc.h> 38 39 #include <async.h> 39 40 #include <fibril_synch.h> -
uspace/srv/vfs/vfs.c
ref7052ec r42a619b 37 37 38 38 #include <ipc/services.h> 39 #include <abi/ipc/event.h> 40 #include <event.h> 39 41 #include <ns.h> 40 42 #include <async.h> … … 45 47 #include <as.h> 46 48 #include <atomic.h> 49 #include <vfs/vfs.h> 47 50 #include "vfs.h" 48 51 … … 80 83 vfs_open(callid, &call); 81 84 break; 82 case VFS_IN_OPEN_NODE:83 vfs_open_node(callid, &call);84 break;85 85 case VFS_IN_CLOSE: 86 86 vfs_close(callid, &call); … … 118 118 case VFS_IN_DUP: 119 119 vfs_dup(callid, &call); 120 break; 121 case VFS_IN_WAIT_HANDLE: 122 vfs_wait_handle(callid, &call); 123 break; 120 124 default: 121 125 async_answer_0(callid, ENOTSUP); … … 128 132 * connection fibril terminates. 129 133 */ 134 } 135 136 enum { 137 VFS_TASK_STATE_CHANGE 138 }; 139 140 static void notification_received(ipc_callid_t callid, ipc_call_t *call) 141 { 142 switch (IPC_GET_IMETHOD(*call)) { 143 case VFS_TASK_STATE_CHANGE: 144 if (IPC_GET_ARG1(*call) == VFS_PASS_HANDLE) 145 vfs_pass_handle(IPC_GET_ARG4(*call), 146 IPC_GET_ARG5(*call), (int) IPC_GET_ARG2(*call)); 147 break; 148 default: 149 break; 150 } 130 151 } 131 152 … … 170 191 171 192 /* 193 * Set notification handler and subscribe to notifications. 194 */ 195 async_set_interrupt_received(notification_received); 196 event_task_subscribe(EVENT_TASK_STATE_CHANGE, VFS_TASK_STATE_CHANGE); 197 198 /* 172 199 * Register at the naming service. 173 200 */ -
uspace/srv/vfs/vfs.h
ref7052ec r42a619b 175 175 extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *, 176 176 vfs_pair_t *, ...); 177 extern int vfs_open_node_internal(vfs_lookup_res_t *);178 177 179 178 extern bool vfs_nodes_init(void); … … 189 188 extern void vfs_client_data_destroy(void *); 190 189 190 extern void vfs_pass_handle(sysarg_t, sysarg_t, int); 191 extern int vfs_wait_handle_internal(void); 192 191 193 extern vfs_file_t *vfs_file_get(int); 192 194 extern void vfs_file_put(vfs_file_t *); … … 197 199 extern void vfs_node_addref(vfs_node_t *); 198 200 extern void vfs_node_delref(vfs_node_t *); 201 extern int vfs_open_node_remote(vfs_node_t *); 199 202 200 203 extern void vfs_register(ipc_callid_t, ipc_call_t *); … … 202 205 extern void vfs_unmount(ipc_callid_t, ipc_call_t *); 203 206 extern void vfs_open(ipc_callid_t, ipc_call_t *); 204 extern void vfs_open_node(ipc_callid_t, ipc_call_t *);205 207 extern void vfs_sync(ipc_callid_t, ipc_call_t *); 206 208 extern void vfs_dup(ipc_callid_t, ipc_call_t *); … … 215 217 extern void vfs_unlink(ipc_callid_t, ipc_call_t *); 216 218 extern void vfs_rename(ipc_callid_t, ipc_call_t *); 219 extern void vfs_wait_handle(ipc_callid_t, ipc_call_t *); 217 220 218 221 #endif -
uspace/srv/vfs/vfs_file.c
ref7052ec r42a619b 43 43 #include <fibril.h> 44 44 #include <fibril_synch.h> 45 #include <adt/list.h> 45 46 #include "vfs.h" 46 47 … … 50 51 typedef struct { 51 52 fibril_mutex_t lock; 53 fibril_condvar_t cv; 54 list_t passed_handles; 52 55 vfs_file_t **files; 53 56 } vfs_client_data_t; 54 57 58 typedef struct { 59 link_t link; 60 int handle; 61 } vfs_boxed_handle_t; 62 63 static int _vfs_fd_free(vfs_client_data_t *, int); 64 55 65 /** Initialize the table of open files. */ 56 static bool vfs_files_init(v oid)57 { 58 fibril_mutex_lock(& VFS_DATA->lock);59 if (! FILES) {60 FILES= malloc(MAX_OPEN_FILES * sizeof(vfs_file_t *));61 if (! FILES) {62 fibril_mutex_unlock(& VFS_DATA->lock);66 static bool vfs_files_init(vfs_client_data_t *vfs_data) 67 { 68 fibril_mutex_lock(&vfs_data->lock); 69 if (!vfs_data->files) { 70 vfs_data->files = malloc(MAX_OPEN_FILES * sizeof(vfs_file_t *)); 71 if (!vfs_data->files) { 72 fibril_mutex_unlock(&vfs_data->lock); 63 73 return false; 64 74 } 65 memset( FILES, 0, MAX_OPEN_FILES * sizeof(vfs_file_t *));66 } 67 fibril_mutex_unlock(& VFS_DATA->lock);75 memset(vfs_data->files, 0, MAX_OPEN_FILES * sizeof(vfs_file_t *)); 76 } 77 fibril_mutex_unlock(&vfs_data->lock); 68 78 return true; 69 79 } 70 80 71 81 /** Cleanup the table of open files. */ 72 static void vfs_files_done(v oid)82 static void vfs_files_done(vfs_client_data_t *vfs_data) 73 83 { 74 84 int i; 75 85 76 if (! FILES)86 if (!vfs_data->files) 77 87 return; 78 88 79 89 for (i = 0; i < MAX_OPEN_FILES; i++) { 80 if (FILES[i]) { 81 (void) vfs_fd_free(i); 82 } 83 } 84 85 free(FILES); 90 if (vfs_data->files[i]) 91 (void) _vfs_fd_free(vfs_data, i); 92 } 93 94 free(vfs_data->files); 95 96 while (!list_empty(&vfs_data->passed_handles)) { 97 link_t *lnk; 98 vfs_boxed_handle_t *bh; 99 100 lnk = list_first(&vfs_data->passed_handles); 101 list_remove(lnk); 102 103 bh = list_get_instance(lnk, vfs_boxed_handle_t, link); 104 free(bh); 105 } 86 106 } 87 107 … … 93 113 if (vfs_data) { 94 114 fibril_mutex_initialize(&vfs_data->lock); 115 fibril_condvar_initialize(&vfs_data->cv); 116 list_initialize(&vfs_data->passed_handles); 95 117 vfs_data->files = NULL; 96 118 } … … 103 125 vfs_client_data_t *vfs_data = (vfs_client_data_t *) data; 104 126 105 vfs_files_done( );127 vfs_files_done(vfs_data); 106 128 free(vfs_data); 107 129 } … … 131 153 * incremented. 132 154 */ 133 static void vfs_file_addref(vfs_ file_t *file)134 { 135 assert(fibril_mutex_is_locked(& VFS_DATA->lock));155 static void vfs_file_addref(vfs_client_data_t *vfs_data, vfs_file_t *file) 156 { 157 assert(fibril_mutex_is_locked(&vfs_data->lock)); 136 158 137 159 file->refcnt++; … … 143 165 * decremented. 144 166 */ 145 static int vfs_file_delref(vfs_ file_t *file)167 static int vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file) 146 168 { 147 169 int rc = EOK; 148 170 149 assert(fibril_mutex_is_locked(& VFS_DATA->lock));171 assert(fibril_mutex_is_locked(&vfs_data->lock)); 150 172 151 173 if (file->refcnt-- == 1) { … … 162 184 } 163 185 164 165 /** Allocate a file descriptor. 166 * 167 * @param desc If true, look for an available file descriptor 168 * in a descending order. 169 * 170 * @return First available file descriptor or a negative error 171 * code. 172 */ 173 int vfs_fd_alloc(bool desc) 174 { 175 if (!vfs_files_init()) 186 static int _vfs_fd_alloc(vfs_client_data_t *vfs_data, bool desc) 187 { 188 if (!vfs_files_init(vfs_data)) 176 189 return ENOMEM; 177 190 … … 182 195 i = 0; 183 196 184 fibril_mutex_lock(& VFS_DATA->lock);197 fibril_mutex_lock(&vfs_data->lock); 185 198 while (true) { 186 if (! FILES[i]) {187 FILES[i] = (vfs_file_t *) malloc(sizeof(vfs_file_t));188 if (! FILES[i]) {189 fibril_mutex_unlock(& VFS_DATA->lock);199 if (!vfs_data->files[i]) { 200 vfs_data->files[i] = (vfs_file_t *) malloc(sizeof(vfs_file_t)); 201 if (!vfs_data->files[i]) { 202 fibril_mutex_unlock(&vfs_data->lock); 190 203 return ENOMEM; 191 204 } 192 205 193 memset( FILES[i], 0, sizeof(vfs_file_t));194 fibril_mutex_initialize(& FILES[i]->lock);195 vfs_file_addref( FILES[i]);196 fibril_mutex_unlock(& VFS_DATA->lock);206 memset(vfs_data->files[i], 0, sizeof(vfs_file_t)); 207 fibril_mutex_initialize(&vfs_data->files[i]->lock); 208 vfs_file_addref(vfs_data, vfs_data->files[i]); 209 fibril_mutex_unlock(&vfs_data->lock); 197 210 return (int) i; 198 211 } … … 210 223 } 211 224 } 212 fibril_mutex_unlock(& VFS_DATA->lock);225 fibril_mutex_unlock(&vfs_data->lock); 213 226 214 227 return EMFILE; 228 } 229 230 /** Allocate a file descriptor. 231 * 232 * @param desc If true, look for an available file descriptor 233 * in a descending order. 234 * 235 * @return First available file descriptor or a negative error 236 * code. 237 */ 238 int vfs_fd_alloc(bool desc) 239 { 240 return _vfs_fd_alloc(VFS_DATA, desc); 241 } 242 243 static int _vfs_fd_free(vfs_client_data_t *vfs_data, int fd) 244 { 245 int rc; 246 247 if (!vfs_files_init(vfs_data)) 248 return ENOMEM; 249 250 fibril_mutex_lock(&vfs_data->lock); 251 if ((fd < 0) || (fd >= MAX_OPEN_FILES) || !vfs_data->files[fd]) { 252 fibril_mutex_unlock(&vfs_data->lock); 253 return EBADF; 254 } 255 256 rc = vfs_file_delref(vfs_data, vfs_data->files[fd]); 257 vfs_data->files[fd] = NULL; 258 fibril_mutex_unlock(&vfs_data->lock); 259 260 return rc; 215 261 } 216 262 … … 224 270 int vfs_fd_free(int fd) 225 271 { 226 int rc; 227 228 if (!vfs_files_init()) 229 return ENOMEM; 230 231 fibril_mutex_lock(&VFS_DATA->lock); 232 if ((fd < 0) || (fd >= MAX_OPEN_FILES) || (FILES[fd] == NULL)) { 233 fibril_mutex_unlock(&VFS_DATA->lock); 234 return EBADF; 235 } 236 237 rc = vfs_file_delref(FILES[fd]); 238 FILES[fd] = NULL; 239 fibril_mutex_unlock(&VFS_DATA->lock); 240 241 return rc; 272 return _vfs_fd_free(VFS_DATA, fd); 242 273 } 243 274 … … 253 284 int vfs_fd_assign(vfs_file_t *file, int fd) 254 285 { 255 if (!vfs_files_init( ))286 if (!vfs_files_init(VFS_DATA)) 256 287 return ENOMEM; 257 288 … … 263 294 264 295 FILES[fd] = file; 265 vfs_file_addref( FILES[fd]);296 vfs_file_addref(VFS_DATA, FILES[fd]); 266 297 fibril_mutex_unlock(&VFS_DATA->lock); 267 298 … … 269 300 } 270 301 271 /** Find VFS file structure for a given file descriptor. 272 * 273 * @param fd File descriptor. 274 * 275 * @return VFS file structure corresponding to fd. 276 */ 277 vfs_file_t *vfs_file_get(int fd) 278 { 279 if (!vfs_files_init()) 302 static vfs_file_t *_vfs_file_get(vfs_client_data_t *vfs_data, int fd) 303 { 304 if (!vfs_files_init(vfs_data)) 280 305 return NULL; 281 306 282 fibril_mutex_lock(& VFS_DATA->lock);307 fibril_mutex_lock(&vfs_data->lock); 283 308 if ((fd >= 0) && (fd < MAX_OPEN_FILES)) { 284 vfs_file_t *file = FILES[fd];309 vfs_file_t *file = vfs_data->files[fd]; 285 310 if (file != NULL) { 286 vfs_file_addref( file);287 fibril_mutex_unlock(& VFS_DATA->lock);311 vfs_file_addref(vfs_data, file); 312 fibril_mutex_unlock(&vfs_data->lock); 288 313 return file; 289 314 } 290 315 } 291 fibril_mutex_unlock(& VFS_DATA->lock);316 fibril_mutex_unlock(&vfs_data->lock); 292 317 293 318 return NULL; 294 319 } 295 320 321 /** Find VFS file structure for a given file descriptor. 322 * 323 * @param fd File descriptor. 324 * 325 * @return VFS file structure corresponding to fd. 326 */ 327 vfs_file_t *vfs_file_get(int fd) 328 { 329 return _vfs_file_get(VFS_DATA, fd); 330 } 331 332 static void _vfs_file_put(vfs_client_data_t *vfs_data, vfs_file_t *file) 333 { 334 fibril_mutex_lock(&vfs_data->lock); 335 vfs_file_delref(vfs_data, file); 336 fibril_mutex_unlock(&vfs_data->lock); 337 } 338 296 339 /** Stop using a file structure. 297 340 * … … 300 343 void vfs_file_put(vfs_file_t *file) 301 344 { 302 fibril_mutex_lock(&VFS_DATA->lock); 303 vfs_file_delref(file); 304 fibril_mutex_unlock(&VFS_DATA->lock); 345 _vfs_file_put(VFS_DATA, file); 346 } 347 348 void vfs_pass_handle(sysarg_t donor_hash, sysarg_t acceptor_hash, int donor_fd) 349 { 350 vfs_client_data_t *donor_data = NULL; 351 vfs_client_data_t *acceptor_data = NULL; 352 vfs_file_t *donor_file = NULL; 353 vfs_file_t *acceptor_file = NULL; 354 vfs_boxed_handle_t *bh; 355 int acceptor_fd; 356 357 acceptor_data = async_get_client_data_by_hash(acceptor_hash); 358 if (!acceptor_data) 359 return; 360 361 bh = malloc(sizeof(vfs_boxed_handle_t)); 362 assert(bh); 363 364 link_initialize(&bh->link); 365 bh->handle = -1; 366 367 donor_data = async_get_client_data_by_hash(donor_hash); 368 if (!donor_data) 369 goto out; 370 371 donor_file = _vfs_file_get(donor_data, donor_fd); 372 if (!donor_file) 373 goto out; 374 375 acceptor_fd = _vfs_fd_alloc(acceptor_data, false); 376 if (acceptor_fd < 0) 377 goto out; 378 379 bh->handle = acceptor_fd; 380 381 /* 382 * Add a new reference to the underlying VFS node. 383 */ 384 vfs_node_addref(donor_file->node); 385 (void) vfs_open_node_remote(donor_file->node); 386 387 acceptor_file = _vfs_file_get(acceptor_data, acceptor_fd); 388 assert(acceptor_file); 389 390 /* 391 * Inherit attributes from the donor. 392 */ 393 acceptor_file->node = donor_file->node; 394 acceptor_file->append = donor_file->append; 395 acceptor_file->pos = donor_file->pos; 396 397 out: 398 fibril_mutex_lock(&acceptor_data->lock); 399 list_append(&bh->link, &acceptor_data->passed_handles); 400 fibril_condvar_broadcast(&acceptor_data->cv); 401 fibril_mutex_unlock(&acceptor_data->lock); 402 403 if (donor_data) 404 async_put_client_data_by_hash(donor_hash); 405 if (acceptor_data) 406 async_put_client_data_by_hash(acceptor_hash); 407 if (donor_file) 408 _vfs_file_put(donor_data, donor_file); 409 if (acceptor_file) 410 _vfs_file_put(acceptor_data, acceptor_file); 411 412 } 413 414 int vfs_wait_handle_internal(void) 415 { 416 vfs_client_data_t *vfs_data = VFS_DATA; 417 int fd; 418 419 fibril_mutex_lock(&vfs_data->lock); 420 while (list_empty(&vfs_data->passed_handles)) 421 fibril_condvar_wait(&vfs_data->cv, &vfs_data->lock); 422 link_t *lnk = list_first(&vfs_data->passed_handles); 423 list_remove(lnk); 424 fibril_mutex_unlock(&vfs_data->lock); 425 426 vfs_boxed_handle_t *bh = list_get_instance(lnk, vfs_boxed_handle_t, link); 427 fd = bh->handle; 428 free(bh); 429 430 return fd; 305 431 } 306 432 -
uspace/srv/vfs/vfs_lookup.c
ref7052ec r42a619b 201 201 } 202 202 203 /** Perform a node open operation.204 *205 * @return EOK on success or an error code from errno.h.206 *207 */208 int vfs_open_node_internal(vfs_lookup_res_t *result)209 {210 async_exch_t *exch = vfs_exchange_grab(result->triplet.fs_handle);211 212 ipc_call_t answer;213 aid_t req = async_send_2(exch, VFS_OUT_OPEN_NODE,214 (sysarg_t) result->triplet.service_id,215 (sysarg_t) result->triplet.index, &answer);216 217 sysarg_t rc;218 async_wait_for(req, &rc);219 vfs_exchange_release(exch);220 221 if (rc == EOK) {222 result->size =223 MERGE_LOUP32(IPC_GET_ARG1(answer), IPC_GET_ARG2(answer));224 result->lnkcnt = (unsigned int) IPC_GET_ARG3(answer);225 if (IPC_GET_ARG4(answer) & L_FILE)226 result->type = VFS_NODE_FILE;227 else if (IPC_GET_ARG4(answer) & L_DIRECTORY)228 result->type = VFS_NODE_DIRECTORY;229 else230 result->type = VFS_NODE_UNKNOWN;231 }232 233 return rc;234 }235 236 203 /** 237 204 * @} -
uspace/srv/vfs/vfs_node.c
ref7052ec r42a619b 293 293 } 294 294 295 296 /** Perform a remote node open operation. 297 * 298 * @return EOK on success or an error code from errno.h. 299 * 300 */ 301 int vfs_open_node_remote(vfs_node_t *node) 302 { 303 async_exch_t *exch = vfs_exchange_grab(node->fs_handle); 304 305 ipc_call_t answer; 306 aid_t req = async_send_2(exch, VFS_OUT_OPEN_NODE, 307 (sysarg_t) node->service_id, (sysarg_t) node->index, &answer); 308 309 vfs_exchange_release(exch); 310 311 sysarg_t rc; 312 async_wait_for(req, &rc); 313 314 return rc; 315 } 316 295 317 /** 296 318 * @} -
uspace/srv/vfs/vfs_ops.c
ref7052ec r42a619b 618 618 } 619 619 620 void vfs_open_node(ipc_callid_t rid, ipc_call_t *request)621 {622 // FIXME: check for sanity of the supplied fs, dev and index623 624 /*625 * The interface is open_node(fs, dev, index, oflag).626 */627 vfs_lookup_res_t lr;628 629 lr.triplet.fs_handle = IPC_GET_ARG1(*request);630 lr.triplet.service_id = IPC_GET_ARG2(*request);631 lr.triplet.index = IPC_GET_ARG3(*request);632 int oflag = IPC_GET_ARG4(*request);633 634 fibril_rwlock_read_lock(&namespace_rwlock);635 636 int rc = vfs_open_node_internal(&lr);637 if (rc != EOK) {638 fibril_rwlock_read_unlock(&namespace_rwlock);639 async_answer_0(rid, rc);640 return;641 }642 643 vfs_node_t *node = vfs_node_get(&lr);644 fibril_rwlock_read_unlock(&namespace_rwlock);645 646 /* Truncate the file if requested and if necessary. */647 if (oflag & O_TRUNC) {648 fibril_rwlock_write_lock(&node->contents_rwlock);649 if (node->size) {650 rc = vfs_truncate_internal(node->fs_handle,651 node->service_id, node->index, 0);652 if (rc) {653 fibril_rwlock_write_unlock(&node->contents_rwlock);654 vfs_node_put(node);655 async_answer_0(rid, rc);656 return;657 }658 node->size = 0;659 }660 fibril_rwlock_write_unlock(&node->contents_rwlock);661 }662 663 /*664 * Get ourselves a file descriptor and the corresponding vfs_file_t665 * structure.666 */667 int fd = vfs_fd_alloc((oflag & O_DESC) != 0);668 if (fd < 0) {669 vfs_node_put(node);670 async_answer_0(rid, fd);671 return;672 }673 vfs_file_t *file = vfs_file_get(fd);674 file->node = node;675 if (oflag & O_APPEND)676 file->append = true;677 678 /*679 * The following increase in reference count is for the fact that the680 * file is being opened and that a file structure is pointing to it.681 * It is necessary so that the file will not disappear when682 * vfs_node_put() is called. The reference will be dropped by the683 * respective VFS_IN_CLOSE.684 */685 vfs_node_addref(node);686 vfs_node_put(node);687 vfs_file_put(file);688 689 /* Success! Return the new file descriptor to the client. */690 async_answer_1(rid, EOK, fd);691 }692 693 620 void vfs_sync(ipc_callid_t rid, ipc_call_t *request) 694 621 { … … 1349 1276 } 1350 1277 1278 void vfs_wait_handle(ipc_callid_t rid, ipc_call_t *request) 1279 { 1280 int fd = vfs_wait_handle_internal(); 1281 async_answer_1(rid, EOK, fd); 1282 } 1283 1351 1284 /** 1352 1285 * @}
Note:
See TracChangeset
for help on using the changeset viewer.