]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/hfs/hfs_endian.c
xnu-2782.1.97.tar.gz
[apple/xnu.git] / bsd / hfs / hfs_endian.c
index 6f840045d875e94d4961121864b17c8b9cbd5e3a..50fb1ddd9a509d3d76d7ad5e4439149225a7ab0f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * The direction parameter must be kSwapBTNodeBigToHost or kSwapBTNodeHostToBig.
  * The kSwapBTNodeHeaderRecordOnly "direction" is not valid for these routines.
  */
-static int hfs_swap_HFSPlusBTInternalNode (BlockDescriptor *src, HFSCatalogNodeID fileID, enum HFSBTSwapDirection direction);
-static int hfs_swap_HFSBTInternalNode (BlockDescriptor *src, HFSCatalogNodeID fileID, enum HFSBTSwapDirection direction);
+int hfs_swap_HFSPlusBTInternalNode (BlockDescriptor *src, HFSCatalogNodeID fileID, enum HFSBTSwapDirection direction);
+void hfs_swap_HFSPlusForkData (HFSPlusForkData *src);
+
+#if CONFIG_HFS_STD
+int hfs_swap_HFSBTInternalNode (BlockDescriptor *src, HFSCatalogNodeID fileID, enum HFSBTSwapDirection direction);
+#endif
 
 /*
  * hfs_swap_HFSPlusForkData
  */
-static void
+void
 hfs_swap_HFSPlusForkData (
     HFSPlusForkData *src
 )
@@ -160,7 +164,7 @@ hfs_swap_BTNode (
                /*
                 * Check srcDesc->height.  Don't swap it because it's only one byte.
                 */
-               if (srcDesc->height > btcb->treeDepth) {
+               if (srcDesc->height > kMaxTreeDepth) {
                        printf("hfs_swap_BTNode: invalid node height (%d)\n", srcDesc->height);
                        error = fsBTInvalidHeaderErr;
                        goto fail;
@@ -228,9 +232,12 @@ hfs_swap_BTNode (
 
         if (VTOVCB(vp)->vcbSigWord == kHFSPlusSigWord) {
             error = hfs_swap_HFSPlusBTInternalNode (src, VTOC(vp)->c_fileid, direction);
-        } else {
+        } 
+#if CONFIG_HFS_STD
+               else {
             error = hfs_swap_HFSBTInternalNode (src, VTOC(vp)->c_fileid, direction);
         }
+#endif
         
         if (error) goto fail;
         
@@ -314,7 +321,7 @@ hfs_swap_BTNode (
                /* 
                 * Check srcDesc->height.  Don't swap it because it's only one byte.
                 */
-               if (srcDesc->height > btcb->treeDepth) {
+               if (srcDesc->height > kMaxTreeDepth) {
                        panic("hfs_UNswap_BTNode: invalid node height (%d)\n", srcDesc->height);
                        error = fsBTInvalidHeaderErr;
                        goto fail;
@@ -383,13 +390,13 @@ fail:
                 */
                printf("hfs: node=%lld fileID=%u volume=%s device=%s\n", src->blockNum, VTOC(vp)->c_fileid,
                        VTOVCB(vp)->vcbVN, vfs_statfs(vnode_mount(vp))->f_mntfromname);
-               hfs_mark_volume_inconsistent(VTOVCB(vp));
+               hfs_mark_inconsistent(VTOVCB(vp), HFS_INCONSISTENCY_DETECTED);
        }
        
     return (error);
 }
 
-static int
+int
 hfs_swap_HFSPlusBTInternalNode (
     BlockDescriptor *src,
     HFSCatalogNodeID fileID,
@@ -925,7 +932,8 @@ hfs_swap_HFSPlusBTInternalNode (
     return (0);
 }
 
-static int
+#if CONFIG_HFS_STD
+int
 hfs_swap_HFSBTInternalNode (
     BlockDescriptor *src,
     HFSCatalogNodeID fileID,
@@ -1215,3 +1223,5 @@ hfs_swap_HFSBTInternalNode (
 
     return (0);
 }
+#endif
+