Changeset 03362fbd in mainline for kernel/generic/src/ipc/ops/shareout.c
- Timestamp:
- 2013-02-09T23:14:45Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 22dfd38
- Parents:
- b5d2e57 (diff), 005b765 (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. - File:
-
- 1 moved
-
kernel/generic/src/ipc/ops/shareout.c (moved) (moved from uspace/lib/ext2/libext2_block_group.h ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ops/shareout.c
rb5d2e57 r03362fbd 1 1 /* 2 * Copyright (c) 201 1 Martin Sucha2 * Copyright (c) 2012 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libext229 /** @addtogroup genericipc 30 30 * @{ 31 31 */ 32 /** 33 * @file 32 /** @file 34 33 */ 35 34 36 #ifndef LIBEXT2_LIBEXT2_BLOCK_GROUP_H_ 37 #define LIBEXT2_LIBEXT2_BLOCK_GROUP_H_ 35 #include <ipc/sysipc_ops.h> 36 #include <ipc/ipc.h> 37 #include <mm/as.h> 38 #include <synch/spinlock.h> 39 #include <proc/task.h> 40 #include <syscall/copy.h> 41 #include <abi/errno.h> 42 #include <arch.h> 38 43 39 #include <libblock.h> 44 static int request_preprocess(call_t *call, phone_t *phone) 45 { 46 size_t size = as_area_get_size(IPC_GET_ARG1(call->data)); 40 47 41 typedef struct ext2_block_group { 42 uint32_t block_bitmap_block; // Block ID for block bitmap 43 uint32_t inode_bitmap_block; // Block ID for inode bitmap 44 uint32_t inode_table_first_block; // Block ID of first block of inode table 45 uint16_t free_block_count; // Count of free blocks 46 uint16_t free_inode_count; // Count of free inodes 47 uint16_t directory_inode_count; // Number of inodes allocated to directories 48 } ext2_block_group_t; 48 if (!size) 49 return EPERM; 50 IPC_SET_ARG2(call->data, size); 49 51 50 typedef struct ext2_block_group_ref { 51 block_t *block; // Reference to a block containing this block group descr 52 ext2_block_group_t *block_group; 53 } ext2_block_group_ref_t; 52 return EOK; 53 } 54 54 55 #define EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE 32 55 static int answer_preprocess(call_t *answer, ipc_data_t *olddata) 56 { 57 int rc = EOK; 56 58 57 extern uint32_t ext2_block_group_get_block_bitmap_block(ext2_block_group_t *); 58 extern uint32_t ext2_block_group_get_inode_bitmap_block(ext2_block_group_t *); 59 extern uint32_t ext2_block_group_get_inode_table_first_block(ext2_block_group_t *); 60 extern uint16_t ext2_block_group_get_free_block_count(ext2_block_group_t *); 61 extern uint16_t ext2_block_group_get_free_inode_count(ext2_block_group_t *); 62 extern uint16_t ext2_block_group_get_directory_inode_count(ext2_block_group_t *); 59 if (!IPC_GET_RETVAL(answer->data)) { 60 /* Accepted, handle as_area receipt */ 63 61 64 extern void ext2_block_group_set_free_block_count(ext2_block_group_t *, uint16_t); 62 irq_spinlock_lock(&answer->sender->lock, true); 63 as_t *as = answer->sender->as; 64 irq_spinlock_unlock(&answer->sender->lock, true); 65 65 66 #endif 66 uintptr_t dst_base = (uintptr_t) -1; 67 rc = as_area_share(as, IPC_GET_ARG1(*olddata), 68 IPC_GET_ARG2(*olddata), AS, IPC_GET_ARG3(*olddata), 69 &dst_base, IPC_GET_ARG1(answer->data)); 70 71 if (rc == EOK) { 72 rc = copy_to_uspace((void *) IPC_GET_ARG2(answer->data), 73 &dst_base, sizeof(dst_base)); 74 } 75 76 IPC_SET_RETVAL(answer->data, rc); 77 } 78 79 return rc; 80 } 81 82 sysipc_ops_t ipc_m_share_out_ops = { 83 .request_preprocess = request_preprocess, 84 .request_forget = null_request_forget, 85 .request_process = null_request_process, 86 .answer_cleanup = null_answer_cleanup, 87 .answer_preprocess = answer_preprocess, 88 .answer_process = null_answer_process, 89 }; 67 90 68 91 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.
