5 //  Created by csuter on 7/11/14. 
   6 //  Copyright (c) 2014 Apple. All rights reserved. 
  10 #define HFS_EXTENTS_H_ 
  15 #include "hfs_format.h" 
  17 #if !HFS_EXTENTS_TEST && !HFS_ALLOC_TEST 
  18 #include "hfs_cnode.h" 
  20 #include "hfscommon/headers/BTreesInternal.h" 
  23 typedef struct hfs_ext_iter 
{ 
  24         struct vnode               
*vp
;                 // If NULL, this is an xattr extent 
  25         BTreeIterator                   bt_iter
; 
  26         uint8_t                                 ndx
;            // Index in group 
  29         uint32_t                                group_block_count
; 
  30         HFSPlusExtentRecord             group
; 
  33 errno_t 
hfs_ext_find(vnode_t vp
, off_t offset
, hfs_ext_iter_t 
*iter
); 
  35 errno_t 
hfs_ext_replace(hfsmount_t 
*hfsmp
, vnode_t vp
, 
  37                                                 const HFSPlusExtentDescriptor 
*repl
, 
  39                                                 HFSPlusExtentRecord catalog_extents
); 
  41 bool hfs_ext_iter_is_catalog_extents(hfs_ext_iter_t 
*iter
); 
  43 static inline void hfs_ext_copy_rec(const HFSPlusExtentRecord src
, 
  44                                                                         HFSPlusExtentRecord dst
) 
  46         memcpy(dst
, src
, sizeof(HFSPlusExtentRecord
)); 
  49 static inline uint32_t hfs_ext_end(const HFSPlusExtentDescriptor 
*ext
) 
  51         return ext
->startBlock 
+ ext
->blockCount
; 
  54 #endif // HFS_EXTENTS_H_