]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/hfs/hfscommon/headers/FileMgrInternal.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / bsd / hfs / hfscommon / headers / FileMgrInternal.h
index 519cd4965e84411c7e48e1e31b5e1034cc12ad85..5189b9226f0ca65fa4f742dfa9faa38aae69e633 100644 (file)
@@ -1,23 +1,31 @@
 /*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * 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.  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 
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * Please see the License for the specific language governing rights and 
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
  */
 /*
        File:           FilesInternal.h
@@ -115,6 +123,7 @@ enum {
        kEFReserveMask  = 0x04,   /* keep block reserve */
        kEFDeferMask    = 0x08,   /* defer file block allocations */
        kEFNoClumpMask  = 0x10,   /* don't round up to clump size */
+       kEFMetadataMask  = 0x20,  /* metadata allocation */
 
        kTFTrunExtBit                           = 0,                                                    /*      truncate to the extent containing new PEOF*/
        kTFTrunExtMask                          = 1
@@ -150,25 +159,6 @@ union ExtentRecord {
        HFSPlusExtentRecord                     hfsPlus;
 };
 typedef union ExtentRecord                             ExtentRecord;
-/* Universal catalog key */
-
-union CatalogKey {
-       HFSCatalogKey                                   hfs;
-       HFSPlusCatalogKey                               hfsPlus;
-};
-typedef union CatalogKey                               CatalogKey;
-/* Universal catalog data record */
-
-union CatalogRecord {
-       SInt16                                                  recordType;
-       HFSCatalogFolder                                hfsFolder;
-       HFSCatalogFile                                  hfsFile;
-       HFSCatalogThread                                hfsThread;
-       HFSPlusCatalogFolder                    hfsPlusFolder;
-       HFSPlusCatalogFile                              hfsPlusFile;
-       HFSPlusCatalogThread                    hfsPlusThread;
-};
-typedef union CatalogRecord                            CatalogRecord;
 
 
 enum {
@@ -204,10 +194,6 @@ EXTERN_API_C( Boolean )
 IsVCBDirty                                             (ExtendedVCB *vcb);
 
 
-#define VCB_LOCK_INIT(vcb)             simple_lock_init(&vcb->vcbSimpleLock)
-#define VCB_LOCK(vcb)                  simple_lock(&vcb->vcbSimpleLock)
-#define VCB_UNLOCK(vcb)                        simple_unlock(&vcb->vcbSimpleLock)
-
 #define        MarkVCBDirty(vcb)               { ((vcb)->vcbFlags |= 0xFF00); }
 #define        MarkVCBClean(vcb)               { ((vcb)->vcbFlags &= 0x00FF); }
 #define        IsVCBDirty(vcb)                 ((Boolean) ((vcb->vcbFlags & 0xFF00) != 0))
@@ -218,12 +204,7 @@ EXTERN_API_C( void )
 ReturnIfError                                  (OSErr                                  result);
 
 #define        ReturnIfError(result)                                   if ( (result) != noErr ) return (result); else ;
-/*     Test for passed condition and return if true*/
-EXTERN_API_C( void )
-ReturnErrorIf                                  (Boolean                                condition,
-                                                                OSErr                                  result);
 
-#define        ReturnErrorIf(condition, error)                 if ( (condition) )      return( (error) );
 /*     Exit function on error*/
 EXTERN_API_C( void )
 ExitOnError                                            (OSErr                                  result);
@@ -243,21 +224,6 @@ ExchangeFileIDs                                    (ExtendedVCB *                  volume,
                                                                 UInt32                                 srcHint,
                                                                 UInt32                                 destHint );
 
-EXTERN_API_C( SInt32 )
-CompareCatalogKeys                             (HFSCatalogKey *                searchKey,
-                                                                HFSCatalogKey *                trialKey);
-
-EXTERN_API_C( SInt32 )
-CompareExtendedCatalogKeys             (HFSPlusCatalogKey *    searchKey,
-                                                                HFSPlusCatalogKey *    trialKey);
-
-EXTERN_API_C( OSErr )
-InitCatalogCache                               (void);
-
-EXTERN_API_C( void )
-InvalidateCatalogCache                 (ExtendedVCB *                  volume);
-
-
 
 /* BTree Manager Routines*/
 
@@ -286,9 +252,10 @@ ReplaceBTreeRecord                         (FileReference                          refNum,
 EXTERN_API_C( OSErr )
 BlockAllocate                                  (ExtendedVCB *                  vcb,
                                                                 UInt32                                 startingBlock,
-                                                                SInt64                                 bytesRequested,
-                                                                SInt64                                 bytesMaximum,
+                                                                UInt32                                 minBlocks,
+                                                                UInt32                                 maxBlocks,
                                                                 Boolean                                forceContiguous,
+                                                                Boolean                                useMetaZone,
                                                                 UInt32 *                               startBlock,
                                                                 UInt32 *                               actualBlocks);
 
@@ -297,9 +264,14 @@ BlockDeallocate                                    (ExtendedVCB *                  vcb,
                                                                 UInt32                                 firstBlock,
                                                                 UInt32                                 numBlocks);
 
+EXTERN_API_C( OSErr )
+BlockMarkAllocated(ExtendedVCB *vcb, UInt32 startingBlock, UInt32 numBlocks);
+
+EXTERN_API_C( OSErr )
+BlockMarkFree( ExtendedVCB *vcb, UInt32 startingBlock, UInt32 numBlocks);
+
 EXTERN_API_C( UInt32 )
-FileBytesToBlocks                              (SInt64                                 numerator,
-                                                                UInt32                                 denominator);
+MetaZoneFreeBlocks(ExtendedVCB *vcb);
 
 /*     File Extent Mapping routines*/
 EXTERN_API_C( OSErr )
@@ -332,9 +304,14 @@ MapFileBlockC                                      (ExtendedVCB *                  vcb,
                                                                 FCB *                                  fcb,
                                                                 size_t                                 numberOfBytes,
                                                                 off_t                                  offset,
-                                                                daddr_t *                              startBlock,
+                                                                daddr64_t *                            startBlock,
                                                                 size_t *                               availableBytes);
 
+OSErr HeadTruncateFile(ExtendedVCB  *vcb, FCB  *fcb, UInt32  headblks);
+
+EXTERN_API_C( int )
+AddFileExtent (ExtendedVCB *vcb, FCB *fcb, UInt32 startBlock, UInt32 blockCount);
+
 #if TARGET_API_MACOS_X
 EXTERN_API_C( Boolean )
 NodesAreContiguous                             (ExtendedVCB *                  vcb,
@@ -342,10 +319,6 @@ NodesAreContiguous                         (ExtendedVCB *                  vcb,
                                                                 UInt32                                 nodeSize);
 #endif
 
-/*     Utility routines*/
-
-EXTERN_API_C( OSErr )
-VolumeWritable                                 (ExtendedVCB *  vcb);
 
 
 /*     Get the current time in UTC (GMT)*/