]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/hfs/hfscommon/Catalog/FileIDsServices.c
xnu-792.17.14.tar.gz
[apple/xnu.git] / bsd / hfs / hfscommon / Catalog / FileIDsServices.c
index 2481b7463cc471b823563c548759099a137d6e81..c2dd5de091cffceea34cfcfaf284b53fa878faa1 100644 (file)
@@ -1,16 +1,19 @@
 /*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
  * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
@@ -20,7 +23,7 @@
  * Please see the License for the specific language governing rights and
  * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 
 #include "../../hfs_macos_defs.h"
@@ -38,12 +41,12 @@ struct ExtentsRecBuffer {
 typedef struct ExtentsRecBuffer ExtentsRecBuffer;
 
 
-UInt32 CheckExtents( void *extents, UInt32 blocks, Boolean isHFSPlus );
-OSErr  DeleteExtents( ExtendedVCB *vcb, UInt32 fileNumber, Boolean isHFSPlus );
-OSErr  MoveExtents( ExtendedVCB *vcb, UInt32 srcFileID, UInt32 destFileID, Boolean isHFSPlus );
-void   CopyCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest );
-void   CopyBigCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest );
-void   CopyExtentInfo( ExtentKey *key, ExtentRecord *data, ExtentsRecBuffer *buffer, UInt16 bufferCount );
+static UInt32 CheckExtents( void *extents, UInt32 blocks, Boolean isHFSPlus );
+static OSErr  DeleteExtents( ExtendedVCB *vcb, UInt32 fileNumber, Boolean isHFSPlus );
+static OSErr  MoveExtents( ExtendedVCB *vcb, UInt32 srcFileID, UInt32 destFileID, Boolean isHFSPlus );
+static void  CopyCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest );
+static void  CopyBigCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest );
+static void  CopyExtentInfo( ExtentKey *key, ExtentRecord *data, ExtentsRecBuffer *buffer, UInt16 bufferCount );
 
 
 
@@ -59,18 +62,12 @@ OSErr ExchangeFileIDs( ExtendedVCB *vcb, ConstUTF8Param srcName, ConstUTF8Param
        OSErr           err;
        Boolean         isHFSPlus = ( vcb->vcbSigWord == kHFSPlusSigWord );
 
-       TrashCatalogIterator(vcb, srcID);       //      invalidate any iterators for this parentID
-       TrashCatalogIterator(vcb, destID);      //      invalidate any iterators for this parentID
-
        err = BuildCatalogKeyUTF8(vcb, srcID, srcName, kUndefinedStrLen, &srcKey, NULL);
        ReturnIfError(err);
 
        err = BuildCatalogKeyUTF8(vcb, destID, destName, kUndefinedStrLen, &destKey, NULL);
        ReturnIfError(err);
 
-       err = BTCheckFreeSpace(GetFileControlBlock(vcb->extentsRefNum));
-       ReturnIfError(err);
-       
        if ( isHFSPlus )
        {
                //--    Step 1: Check the catalog nodes for extents
@@ -357,7 +354,7 @@ FlushAndReturn:
 }
 
 
-void   CopyCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest )
+static void  CopyCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest )
 {
        dest->hfsFile.dataLogicalSize   = src->hfsFile.dataLogicalSize;
        dest->hfsFile.dataPhysicalSize = src->hfsFile.dataPhysicalSize;
@@ -368,7 +365,7 @@ void        CopyCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest )
        BlockMoveData( src->hfsFile.rsrcExtents, dest->hfsFile.rsrcExtents, sizeof(HFSExtentRecord) );
 }
 
-void   CopyBigCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest )
+static void  CopyBigCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest )
 {
        BlockMoveData( &src->hfsPlusFile.dataFork, &dest->hfsPlusFile.dataFork, sizeof(HFSPlusForkData) );
        BlockMoveData( &src->hfsPlusFile.resourceFork, &dest->hfsPlusFile.resourceFork, sizeof(HFSPlusForkData) );
@@ -376,7 +373,7 @@ void        CopyBigCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest )
 }
 
 
-OSErr  MoveExtents( ExtendedVCB *vcb, UInt32 srcFileID, UInt32 destFileID, Boolean isHFSPlus )
+static OSErr  MoveExtents( ExtendedVCB *vcb, UInt32 srcFileID, UInt32 destFileID, Boolean isHFSPlus )
 {
        FCB *                           fcb;
        ExtentsRecBuffer        extentsBuffer[kNumExtentsToCache];
@@ -534,7 +531,7 @@ OSErr       MoveExtents( ExtendedVCB *vcb, UInt32 srcFileID, UInt32 destFileID, Boolea
 }
 
 
-void   CopyExtentInfo( ExtentKey *key, ExtentRecord *data, ExtentsRecBuffer *buffer, UInt16 bufferCount )
+static void  CopyExtentInfo( ExtentKey *key, ExtentRecord *data, ExtentsRecBuffer *buffer, UInt16 bufferCount )
 {
        BlockMoveData( key, &(buffer[bufferCount].extentKey), sizeof( ExtentKey ) );
        BlockMoveData( data, &(buffer[bufferCount].extentData), sizeof( ExtentRecord ) );
@@ -542,7 +539,7 @@ void        CopyExtentInfo( ExtentKey *key, ExtentRecord *data, ExtentsRecBuffer *buffe
 
 
 //--   Delete all extents in extent file that have the ID given.
-OSErr  DeleteExtents( ExtendedVCB *vcb, UInt32 fileID, Boolean isHFSPlus )
+static OSErr  DeleteExtents( ExtendedVCB *vcb, UInt32 fileID, Boolean isHFSPlus )
 {
        FCB *                           fcb;
        ExtentKey *                     extentKeyPtr;
@@ -620,7 +617,7 @@ OSErr       DeleteExtents( ExtendedVCB *vcb, UInt32 fileID, Boolean isHFSPlus )
 
 
 //     Check if there are extents represented in the extents overflow file.
-UInt32 CheckExtents( void *extents, UInt32 totalBlocks, Boolean isHFSPlus )
+static UInt32  CheckExtents( void *extents, UInt32 totalBlocks, Boolean isHFSPlus )
 {
        UInt32          extentAllocationBlocks;
        UInt16          i;