Changeset 5352d72 in mainline for uspace/lib/ext2/libext2_inode.c
- Timestamp:
- 2011-02-16T16:47:18Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a2a1792
- Parents:
- ce13577
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext2/libext2_inode.c
rce13577 r5352d72 38 38 #include <byteorder.h> 39 39 40 /** 41 * Get mode stored in the inode 42 * 43 * @param inode pointer to inode 44 */ 45 inline uint16_t ext2_inode_get_mode(ext2_inode_t *inode) 46 { 47 return uint16_t_le2host(inode->mode); 48 } 49 50 /** 51 * Get uid this inode is belonging to 52 * 53 * @param inode pointer to inode 54 */ 55 inline uint32_t ext2_inode_get_user_id(ext2_inode_t *inode) 56 { 57 // TODO: use additional OS specific bits 58 return uint16_t_le2host(inode->user_id); 59 } 60 61 /** 62 * Get size of file 63 * 64 * @param inode pointer to inode 65 */ 66 inline uint32_t ext2_inode_get_size(ext2_inode_t *inode) 67 { 68 // TODO: Directory ACLS! 69 return uint16_t_le2host(inode->size); 70 } 71 72 /** 73 * Get gid this inode belongs to 74 * 75 * @param inode pointer to inode 76 */ 77 inline uint32_t ext2_inode_get_group_id(ext2_inode_t *inode) 78 { 79 // TODO: use additional OS specific bits 80 return uint16_t_le2host(inode->group_id); 81 } 82 83 /** 84 * Get usage count (i.e. hard link count) 85 * A value of 1 is common, while 0 means that the inode should be freed 86 * 87 * @param inode pointer to inode 88 */ 89 inline uint16_t ext2_inode_get_usage_count(ext2_inode_t *inode) 90 { 91 return uint16_t_le2host(inode->usage_count); 92 } 93 94 /** 95 * Get size of inode in 512 byte blocks 96 * TODO: clarify this 97 * 98 * @param inode pointer to inode 99 */ 100 inline uint32_t ext2_inode_get_reserved_512_blocks(ext2_inode_t *inode) 101 { 102 return uint32_t_le2host(inode->reserved_512_blocks); 103 } 104 105 /** 106 * Get inode flags 107 * 108 * @param inode pointer to inode 109 */ 110 111 inline uint32_t ext2_inode_get_flags(ext2_inode_t *inode) { 112 return uint32_t_le2host(inode->flags); 113 } 114 115 /** 116 * Get direct block ID 117 * 118 * @param inode pointer to inode 119 * @param idx Index to block. Valid values are 0 <= idx < 12 120 */ 121 inline uint32_t ext2_inode_get_direct_block(ext2_inode_t *inode, uint8_t idx) 122 { 123 return uint32_t_le2host(inode->direct_blocks[idx]); 124 } 125 126 /** 127 * Get indirect block ID 128 * 129 * @param inode pointer to inode 130 */ 131 inline uint32_t ext2_inode_get_single_indirect_block(ext2_inode_t *inode) 132 { 133 return uint32_t_le2host(inode->single_indirect_block); 134 } 135 136 /** 137 * Get double indirect block ID 138 * 139 * @param inode pointer to inode 140 */ 141 inline uint32_t ext2_inode_get_double_indirect_block(ext2_inode_t *inode) 142 { 143 return uint32_t_le2host(inode->double_indirect_block); 144 } 145 146 /** 147 * Get triple indirect block ID 148 * 149 * @param inode pointer to inode 150 */ 151 inline uint32_t ext2_inode_get_triple_indirect_block(ext2_inode_t *inode) 152 { 153 return uint32_t_le2host(inode->triple_indirect_block); 154 } 40 155 41 156
Note:
See TracChangeset
for help on using the changeset viewer.