Changeset 296ef5d6 in mainline
- Timestamp:
- 2012-04-27T15:27:55Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e40ece98
- Parents:
- 291af81
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_inode.c
r291af81 r296ef5d6 41 41 #include "libext4.h" 42 42 43 /** Compute number of bits for block count. 44 * 45 * @param block_size filesystem block_size 46 * @return number of bits 47 */ 43 48 static uint32_t ext4_inode_block_bits_count(uint32_t block_size) 44 49 { … … 54 59 } 55 60 61 /** Get mode of the i-node. 62 * 63 * @param sb superblock 64 * @param inode i-node to load mode from 65 * @return mode of the i-node 66 */ 56 67 uint32_t ext4_inode_get_mode(ext4_superblock_t *sb, ext4_inode_t *inode) 57 68 { … … 63 74 } 64 75 76 /** Set mode of the i-node. 77 * 78 * @param sb superblock 79 * @param inode i-node to set mode to 80 * @param mode mode to set to i-node 81 */ 65 82 void ext4_inode_set_mode(ext4_superblock_t *sb, ext4_inode_t *inode, uint32_t mode) 66 83 { … … 72 89 } 73 90 91 /** Get ID of the i-node owner (user id). 92 * 93 * @param inode i-node to load uid from 94 * @return user ID of the i-node owner 95 */ 74 96 uint32_t ext4_inode_get_uid(ext4_inode_t *inode) 75 97 { … … 77 99 } 78 100 101 /** Set ID of the i-node owner. 102 * 103 * @param inode i-node to set uid to 104 * @param uid ID of the i-node owner 105 */ 79 106 void ext4_inode_set_uid(ext4_inode_t *inode, uint32_t uid) 80 107 { … … 82 109 } 83 110 111 /** Get real i-node size. 112 * 113 * @param sb superblock 114 * @param inode i-node to load size from 115 * @return real size of i-node 116 */ 84 117 uint64_t ext4_inode_get_size(ext4_superblock_t *sb, ext4_inode_t *inode) 85 118 { … … 93 126 } 94 127 95 void ext4_inode_set_size(ext4_inode_t *inode, uint64_t value) { 96 inode->size_lo = host2uint32_t_le((value << 32) >> 32); 97 inode->size_hi = host2uint32_t_le(value >> 32); 128 /** Set real i-node size. 129 * 130 * @param inode inode to set size to 131 * @param size size of the i-node 132 */ 133 void ext4_inode_set_size(ext4_inode_t *inode, uint64_t size) { 134 inode->size_lo = host2uint32_t_le((size << 32) >> 32); 135 inode->size_hi = host2uint32_t_le(size >> 32); 98 136 } 99 137 … … 103 141 } 104 142 143 /** TODO comment 144 * 145 */ 105 146 void ext4_inode_set_access_time(ext4_inode_t *inode, uint32_t time) 106 147 { … … 108 149 } 109 150 151 /** TODO comment 152 * 153 */ 110 154 uint32_t ext4_inode_get_change_inode_time(ext4_inode_t *inode) 111 155 { … … 113 157 } 114 158 159 /** TODO comment 160 * 161 */ 115 162 void ext4_inode_set_change_inode_time(ext4_inode_t *inode, uint32_t time) 116 163 { … … 118 165 } 119 166 167 /** TODO comment 168 * 169 */ 120 170 uint32_t ext4_inode_get_modification_time(ext4_inode_t *inode) 121 171 { … … 123 173 } 124 174 175 /** TODO comment 176 * 177 */ 125 178 void ext4_inode_set_modification_time(ext4_inode_t *inode, uint32_t time) 126 179 { … … 128 181 } 129 182 183 /** TODO comment 184 * 185 */ 130 186 uint32_t ext4_inode_get_deletion_time(ext4_inode_t *inode) 131 187 { … … 133 189 } 134 190 191 /** TODO comment 192 * 193 */ 135 194 void ext4_inode_set_deletion_time(ext4_inode_t *inode, uint32_t time) 136 195 { … … 138 197 } 139 198 199 /** Get ID of the i-node owner's group. 200 * 201 * @param inode i-node to load gid from 202 * @return group ID of the i-node owner 203 */ 140 204 uint32_t ext4_inode_get_gid(ext4_inode_t *inode) 141 205 { … … 143 207 } 144 208 209 /** Set ID ot the i-node owner's group. 210 * 211 * @param inode i-node to set gid to 212 * @param gid group ID of the i-node owner 213 */ 145 214 void ext4_inode_set_gid(ext4_inode_t *inode, uint32_t gid) 146 215 { … … 148 217 } 149 218 219 /** Get number of links to i-node. 220 * 221 * @param inode i-node to load number of links from 222 * @return number of links to i-node 223 */ 150 224 uint16_t ext4_inode_get_links_count(ext4_inode_t *inode) 151 225 { … … 153 227 } 154 228 229 /** Set number of links to i-node. 230 * 231 * @param inode i-node to set number of links to 232 * @param count number of links to i-node 233 */ 155 234 void ext4_inode_set_links_count(ext4_inode_t *inode, uint16_t count) 156 235 { … … 158 237 } 159 238 239 /** TODO comment 240 * 241 */ 160 242 uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode) 161 243 { 162 244 if (ext4_superblock_has_feature_read_only(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) { 163 245 164 / * 48-bit field */246 // 48-bit field 165 247 uint64_t count = ((uint64_t)uint16_t_le2host(inode->osd2.linux2.blocks_high)) << 32 | 166 248 uint32_t_le2host(inode->blocks_count_lo); … … 179 261 } 180 262 263 264 /** TODO comment 265 * 266 */ 181 267 int ext4_inode_set_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode, 182 268 uint64_t count) … … 216 302 } 217 303 304 /** Get flags (features) of i-node. 305 * 306 * @param inode i-node to get flags from 307 * @return flags (bitmap) 308 */ 218 309 uint32_t ext4_inode_get_flags(ext4_inode_t *inode) { 219 310 return uint32_t_le2host(inode->flags); 220 311 } 221 312 313 /** Set flags (features) of i-node. 314 * 315 * @param inode i-node to set flags to 316 * @param flags flags to set to i-node 317 */ 222 318 void ext4_inode_set_flags(ext4_inode_t *inode, uint32_t flags) { 223 319 inode->flags = host2uint32_t_le(flags); 224 320 } 225 321 322 /** TODO comment 323 * 324 */ 226 325 uint32_t ext4_inode_get_generation(ext4_inode_t *inode) 227 326 { … … 229 328 } 230 329 330 /** TODO comment 331 * 332 */ 231 333 void ext4_inode_set_generation(ext4_inode_t *inode, uint32_t generation) 232 334 { … … 234 336 } 235 337 338 /** TODO comment 339 * 340 */ 236 341 uint64_t ext4_inode_get_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb) 237 342 { … … 244 349 } 245 350 351 /** TODO comment 352 * 353 */ 246 354 void ext4_inode_set_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb, 247 355 uint64_t file_acl) … … 256 364 /***********************************************************************/ 257 365 366 /** Get block address of specified direct block. 367 * 368 * @param inode i-node to load block from 369 * @param idx index of logical block 370 * @return physical block address 371 */ 258 372 uint32_t ext4_inode_get_direct_block(ext4_inode_t *inode, uint32_t idx) 259 373 { … … 262 376 } 263 377 378 /** Set block address of specified direct block. 379 * 380 * @param inode i-node to set block address to 381 * @param idx index of logical block 382 * @param fblock physical block address 383 */ 264 384 void ext4_inode_set_direct_block(ext4_inode_t *inode, uint32_t idx, uint32_t fblock) 265 385 { … … 268 388 } 269 389 390 /** Get block address of specified indirect block. 391 * 392 * @param inode i-node to get block address from 393 * @param idx index of indirect block 394 * @return physical block address 395 */ 270 396 uint32_t ext4_inode_get_indirect_block(ext4_inode_t *inode, uint32_t idx) 271 397 { … … 273 399 } 274 400 401 /** Set block address of specified indirect block. 402 * 403 * @param inode i-node to set block address to 404 * @param idx index of indirect block 405 * @param fblock physical block address 406 */ 275 407 void ext4_inode_set_indirect_block(ext4_inode_t *inode, uint32_t idx, uint32_t fblock) 276 408 { … … 278 410 } 279 411 412 /** Check if i-node has specified type. 413 * 414 * @param sb superblock 415 * @param inode i-node to check type of 416 * @param type type to check 417 * @return result of check operation 418 */ 280 419 bool ext4_inode_is_type(ext4_superblock_t *sb, ext4_inode_t *inode, uint32_t type) 281 420 { … … 284 423 } 285 424 286 425 /** Get extent header from the root of the extent tree. 426 * 427 * @param inode i-node to get extent header from 428 * @return pointer to extent header of the root node 429 */ 287 430 ext4_extent_header_t * ext4_inode_get_extent_header(ext4_inode_t *inode) 288 431 { … … 290 433 } 291 434 292 // Flags operations 435 /** Check if i-node has specified flag. 436 * 437 * @param inode i-node to check flags of 438 * @param flag flag to check 439 * @return result of check operation 440 */ 293 441 bool ext4_inode_has_flag(ext4_inode_t *inode, uint32_t flag) 294 442 { … … 299 447 } 300 448 449 /** Remove specified flag from i-node. 450 * 451 * @param inode i-node to clear flag on 452 * @param clear_flag flag to be cleared 453 */ 301 454 void ext4_inode_clear_flag(ext4_inode_t *inode, uint32_t clear_flag) 302 455 { … … 306 459 } 307 460 461 /** Set specified flag to i-node. 462 * 463 * @param inode i-node to set flag on 464 * @param set_flag falt to be set 465 */ 308 466 void ext4_inode_set_flag(ext4_inode_t *inode, uint32_t set_flag) 309 467 { … … 313 471 } 314 472 473 /** Check if i-node can be truncated. 474 * 475 * @param sb superblock 476 * @param inode i-node to check 477 * @return result of the check operation 478 */ 315 479 bool ext4_inode_can_truncate(ext4_superblock_t *sb, ext4_inode_t *inode) 316 480 {
Note:
See TracChangeset
for help on using the changeset viewer.