Rev 4377 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4377 | Rev 4692 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | #include <stdlib.h> |
45 | #include <stdlib.h> |
46 | #include <string.h> |
46 | #include <string.h> |
47 | #include <stdio.h> |
47 | #include <stdio.h> |
48 | #include <assert.h> |
48 | #include <assert.h> |
49 | #include <sys/types.h> |
49 | #include <sys/types.h> |
50 | #include <libadt/hash_table.h> |
50 | #include <adt/hash_table.h> |
51 | #include <as.h> |
51 | #include <as.h> |
52 | #include <libfs.h> |
52 | #include <libfs.h> |
53 | 53 | ||
54 | #define min(a, b) ((a) < (b) ? (a) : (b)) |
54 | #define min(a, b) ((a) < (b) ? (a) : (b)) |
55 | #define max(a, b) ((a) > (b) ? (a) : (b)) |
55 | #define max(a, b) ((a) > (b) ? (a) : (b)) |
Line 248... | Line 248... | ||
248 | nodep->bp = malloc(sizeof(fs_node_t)); |
248 | nodep->bp = malloc(sizeof(fs_node_t)); |
249 | if (!nodep->bp) { |
249 | if (!nodep->bp) { |
250 | free(nodep); |
250 | free(nodep); |
251 | return NULL; |
251 | return NULL; |
252 | } |
252 | } |
- | 253 | fs_node_initialize(nodep->bp); |
|
253 | nodep->bp->data = nodep; /* link the FS and TMPFS nodes */ |
254 | nodep->bp->data = nodep; /* link the FS and TMPFS nodes */ |
254 | if (!tmpfs_root_get(dev_handle)) |
255 | if (!tmpfs_root_get(dev_handle)) |
255 | nodep->index = TMPFS_SOME_ROOT; |
256 | nodep->index = TMPFS_SOME_ROOT; |
256 | else |
257 | else |
257 | nodep->index = tmpfs_next_index++; |
258 | nodep->index = tmpfs_next_index++; |
Line 406... | Line 407... | ||
406 | } |
407 | } |
407 | } |
408 | } |
408 | 409 | ||
409 | void tmpfs_mount(ipc_callid_t rid, ipc_call_t *request) |
410 | void tmpfs_mount(ipc_callid_t rid, ipc_call_t *request) |
410 | { |
411 | { |
411 | dev_handle_t mp_dev_handle = (dev_handle_t) IPC_GET_ARG1(*request); |
- | |
412 | fs_index_t mp_index = (fs_index_t) IPC_GET_ARG2(*request); |
- | |
413 | fs_handle_t mr_fs_handle = (fs_handle_t) IPC_GET_ARG3(*request); |
412 | libfs_mount(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request); |
414 | dev_handle_t mr_dev_handle = (dev_handle_t) IPC_GET_ARG4(*request); |
- | |
415 | - | ||
416 | ipc_answer_0(rid, ENOTSUP); |
- | |
417 | } |
413 | } |
418 | 414 | ||
419 | void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request) |
415 | void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request) |
420 | { |
416 | { |
421 | libfs_lookup(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request); |
417 | libfs_lookup(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request); |
Line 598... | Line 594... | ||
598 | nodep->size = size; |
594 | nodep->size = size; |
599 | nodep->data = newdata; |
595 | nodep->data = newdata; |
600 | ipc_answer_0(rid, EOK); |
596 | ipc_answer_0(rid, EOK); |
601 | } |
597 | } |
602 | 598 | ||
- | 599 | void tmpfs_close(ipc_callid_t rid, ipc_call_t *request) |
|
- | 600 | { |
|
- | 601 | ipc_answer_0(rid, EOK); |
|
- | 602 | } |
|
- | 603 | ||
603 | void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request) |
604 | void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request) |
604 | { |
605 | { |
605 | dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); |
606 | dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); |
606 | fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); |
607 | fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); |
607 | int rc; |
608 | int rc; |
Line 620... | Line 621... | ||
620 | nh_link); |
621 | nh_link); |
621 | rc = tmpfs_destroy_node(FS_NODE(nodep)); |
622 | rc = tmpfs_destroy_node(FS_NODE(nodep)); |
622 | ipc_answer_0(rid, rc); |
623 | ipc_answer_0(rid, rc); |
623 | } |
624 | } |
624 | 625 | ||
- | 626 | void tmpfs_open_node(ipc_callid_t rid, ipc_call_t *request) |
|
- | 627 | { |
|
- | 628 | libfs_open_node(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request); |
|
- | 629 | } |
|
- | 630 | ||
- | 631 | void tmpfs_stat(ipc_callid_t rid, ipc_call_t *request) |
|
- | 632 | { |
|
- | 633 | libfs_stat(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request); |
|
- | 634 | } |
|
- | 635 | ||
- | 636 | void tmpfs_sync(ipc_callid_t rid, ipc_call_t *request) |
|
- | 637 | { |
|
- | 638 | /* Dummy implementation */ |
|
- | 639 | ipc_answer_0(rid, EOK); |
|
- | 640 | } |
|
- | 641 | ||
625 | /** |
642 | /** |
626 | * @} |
643 | * @} |
627 | */ |
644 | */ |