]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/hfs/hfscommon/headers/FileMgrInternal.h
xnu-1504.7.4.tar.gz
[apple/xnu.git] / bsd / hfs / hfscommon / headers / FileMgrInternal.h
index e9ab7e7319ae1a09a59dc438c9f6617210dd70de..a2d1552ee680f183b356456febad0fcf25e4d82c 100644 (file)
 #include "../../hfs_cnode.h"
 
 
-#if PRAGMA_ONCE
-#pragma once
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#if PRAGMA_IMPORT
-#pragma import on
-#endif
-
-#if PRAGMA_STRUCT_ALIGN
-       #pragma options align=mac68k
-#elif PRAGMA_STRUCT_PACKPUSH
-       #pragma pack(push, 2)
-#elif PRAGMA_STRUCT_PACK
-       #pragma pack(2)
-#endif
-
 /* CatalogNodeID is used to track catalog objects */
-typedef UInt32         HFSCatalogNodeID;
+typedef u_int32_t              HFSCatalogNodeID;
 
 /* internal error codes*/
 
@@ -180,34 +164,17 @@ typedef union CatalogName CatalogName;
 #define GetFileControlBlock(fref)              VTOF((fref))
 #define GetFileRefNumFromFCB(fcb)              FTOV((fcb))
 
-
-/*     The following macro marks a VCB as dirty by setting the upper 8 bits of the flags*/
-EXTERN_API_C( void )
-MarkVCBDirty                                   (ExtendedVCB *vcb);
-
-EXTERN_API_C( void )
-MarkVCBClean                                   (ExtendedVCB *vcb);
-
-EXTERN_API_C( Boolean )
-IsVCBDirty                                             (ExtendedVCB *vcb);
-
-
-#define        MarkVCBDirty(vcb)               { ((vcb)->vcbFlags |= 0xFF00); }
-#define        MarkVCBClean(vcb)               { ((vcb)->vcbFlags &= 0x00FF); }
-#define        IsVCBDirty(vcb)                 ((Boolean) ((vcb->vcbFlags & 0xFF00) != 0))
-
-
 /*     Test for error and return if error occurred*/
 EXTERN_API_C( void )
 ReturnIfError                                  (OSErr                                  result);
 
-#define        ReturnIfError(result)                                   if ( (result) != noErr ) return (result); else ;
+#define        ReturnIfError(result)                           do {    if ( (result) != noErr ) return (result); } while(0)
 
 /*     Exit function on error*/
 EXTERN_API_C( void )
 ExitOnError                                            (OSErr                                  result);
 
-#define        ExitOnError( result )                                   if ( ( result ) != noErr )      goto ErrorExit; else ;
+#define        ExitOnError( result )                           do {    if ( ( result ) != noErr )      goto ErrorExit; } while(0)
 
 
 
@@ -219,83 +186,77 @@ ExchangeFileIDs                                   (ExtendedVCB *                  volume,
                                                                 ConstUTF8Param                 destName,
                                                                 HFSCatalogNodeID               srcID,
                                                                 HFSCatalogNodeID               destID,
-                                                                UInt32                                 srcHint,
-                                                                UInt32                                 destHint );
+                                                                u_int32_t                              srcHint,
+                                                                u_int32_t                              destHint );
 
 
 /* BTree Manager Routines*/
 
-typedef CALLBACK_API_C( SInt32 , KeyCompareProcPtr )(void *a, void *b);
-
+typedef CALLBACK_API_C( int32_t , KeyCompareProcPtr )(void *a, void *b);
 
-EXTERN_API_C( OSErr )
-SearchBTreeRecord                              (FileReference                          refNum,
-                                                                const void *                   key,
-                                                                UInt32                                 hint,
-                                                                void *                                 foundKey,
-                                                                void *                                 data,
-                                                                UInt16 *                               dataSize,
-                                                                UInt32 *                               newHint);
 
 EXTERN_API_C( OSErr )
 ReplaceBTreeRecord                             (FileReference                          refNum,
                                                                 const void *                   key,
-                                                                UInt32                                 hint,
+                                                                u_int32_t                              hint,
                                                                 void *                                 newData,
-                                                                UInt16                                 dataSize,
-                                                                UInt32 *                               newHint);
+                                                                u_int16_t                              dataSize,
+                                                                u_int32_t *                    newHint);
 
 
 /*     Prototypes for exported routines in VolumeAllocation.c*/
 EXTERN_API_C( OSErr )
 BlockAllocate                                  (ExtendedVCB *                  vcb,
-                                                                UInt32                                 startingBlock,
-                                                                UInt32                                 minBlocks,
-                                                                UInt32                                 maxBlocks,
+                                                                u_int32_t                              startingBlock,
+                                                                u_int32_t                              minBlocks,
+                                                                u_int32_t                              maxBlocks,
                                                                 Boolean                                forceContiguous,
                                                                 Boolean                                useMetaZone,
-                                                                UInt32 *                               startBlock,
-                                                                UInt32 *                               actualBlocks);
+                                                                u_int32_t *                    startBlock,
+                                                                u_int32_t *                    actualBlocks);
 
 EXTERN_API_C( OSErr )
 BlockDeallocate                                        (ExtendedVCB *                  vcb,
-                                                                UInt32                                 firstBlock,
-                                                                UInt32                                 numBlocks);
+                                                                u_int32_t                              firstBlock,
+                                                                u_int32_t                              numBlocks);
+
+EXTERN_API_C ( void )
+invalidate_free_extent_cache   (ExtendedVCB *                  vcb);
 
 EXTERN_API_C( OSErr )
-BlockMarkAllocated(ExtendedVCB *vcb, UInt32 startingBlock, UInt32 numBlocks);
+BlockMarkAllocated(ExtendedVCB *vcb, u_int32_t startingBlock, u_int32_t numBlocks);
 
 EXTERN_API_C( OSErr )
-BlockMarkFree( ExtendedVCB *vcb, UInt32 startingBlock, UInt32 numBlocks);
+BlockMarkFree( ExtendedVCB *vcb, u_int32_t startingBlock, u_int32_t numBlocks);
 
-EXTERN_API_C( UInt32 )
+EXTERN_API_C( u_int32_t )
 MetaZoneFreeBlocks(ExtendedVCB *vcb);
 
 /*     File Extent Mapping routines*/
 EXTERN_API_C( OSErr )
 FlushExtentFile                                        (ExtendedVCB *                  vcb);
 
-EXTERN_API_C( SInt32 )
+EXTERN_API_C( int32_t )
 CompareExtentKeys                              (const HFSExtentKey *   searchKey,
                                                                 const HFSExtentKey *   trialKey);
 
-EXTERN_API_C( SInt32 )
+EXTERN_API_C( int32_t )
 CompareExtentKeysPlus                  (const HFSPlusExtentKey *searchKey,
                                                                 const HFSPlusExtentKey *trialKey);
 
 EXTERN_API_C( OSErr )
 TruncateFileC                                  (ExtendedVCB *                  vcb,
                                                                 FCB *                                  fcb,
-                                                                SInt64                                 peof,
+                                                                int64_t                                peof,
                                                                 Boolean                                truncateToExtent);
 
 EXTERN_API_C( OSErr )
 ExtendFileC                                            (ExtendedVCB *                  vcb,
                                                                 FCB *                                  fcb,
-                                                                SInt64                                 bytesToAdd,
-                                                                UInt32                                 blockHint,
-                                                                UInt32                                 flags,
-                                                                SInt64 *                               actualBytesAdded);
+                                                                int64_t                                bytesToAdd,
+                                                                u_int32_t                              blockHint,
+                                                                u_int32_t                              flags,
+                                                                int64_t *                              actualBytesAdded);
 
 EXTERN_API_C( OSErr )
 MapFileBlockC                                  (ExtendedVCB *                  vcb,
@@ -305,44 +266,30 @@ MapFileBlockC                                     (ExtendedVCB *                  vcb,
                                                                 daddr64_t *                            startBlock,
                                                                 size_t *                               availableBytes);
 
-OSErr HeadTruncateFile(ExtendedVCB  *vcb, FCB  *fcb, UInt32  headblks);
+OSErr HeadTruncateFile(ExtendedVCB  *vcb, FCB  *fcb, u_int32_t  headblks);
 
 EXTERN_API_C( int )
-AddFileExtent (ExtendedVCB *vcb, FCB *fcb, UInt32 startBlock, UInt32 blockCount);
+AddFileExtent (ExtendedVCB *vcb, FCB *fcb, u_int32_t startBlock, u_int32_t blockCount);
 
 #if TARGET_API_MACOS_X
 EXTERN_API_C( Boolean )
 NodesAreContiguous                             (ExtendedVCB *                  vcb,
                                                                 FCB *                                  fcb,
-                                                                UInt32                                 nodeSize);
+                                                                u_int32_t                              nodeSize);
 #endif
 
 
 
 /*     Get the current time in UTC (GMT)*/
-EXTERN_API_C( UInt32 )
+EXTERN_API_C( u_int32_t )
 GetTimeUTC                                             (void);
 
-EXTERN_API_C( UInt32 )
-LocalToUTC                                             (UInt32                                 localTime);
-
-EXTERN_API_C( UInt32 )
-UTCToLocal                                             (UInt32                                 utcTime);
+EXTERN_API_C( u_int32_t )
+LocalToUTC                                             (u_int32_t                              localTime);
 
+EXTERN_API_C( u_int32_t )
+UTCToLocal                                             (u_int32_t                              utcTime);
 
-#if PRAGMA_STRUCT_ALIGN
-       #pragma options align=reset
-#elif PRAGMA_STRUCT_PACKPUSH
-       #pragma pack(pop)
-#elif PRAGMA_STRUCT_PACK
-       #pragma pack()
-#endif
-
-#ifdef PRAGMA_IMPORT_OFF
-#pragma import off
-#elif PRAGMA_IMPORT
-#pragma import reset
-#endif
 
 #ifdef __cplusplus
 }