hfsprogs: update to 540.1.linux3

Updates hfsprogs from 2011 to 2013 version.

Updated patches to latest Debian ones. Kept custom OpenWrt ones.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2022-04-29 13:36:04 -07:00
parent bf6f2dae15
commit 760e0fe1ee
25 changed files with 373 additions and 5053 deletions

View File

@ -8,20 +8,21 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hfsprogs
PKG_VERSION:=332.25
PKG_RELEASE:=4
PKG_VERSION:=540.1.linux3
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
PKG_SOURCE_URL:=http://archive.ubuntu.com/ubuntu/pool/universe/h/$(PKG_NAME)
PKG_HASH:=74c9aeca899ed7f4bf155c65fc45bf0f250c0f6d57360ea953b1d536d9aa45e6
PKG_SOURCE:=diskdev_cmds-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://src.fedoraproject.org/repo/pkgs/hfsplus-tools/$(PKG_SOURCE)/0435afc389b919027b69616ad1b05709
PKG_HASH:=b01b203a97f9a3bf36a027c13ddfc59292730552e62722d690d33bd5c24f5497
PKG_BUILD_DIR:=$(BUILD_DIR)/diskdev_cmds-$(PKG_VERSION)
PKG_MAINTAINER:=
PKG_LICENSE:=APSL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_BUILD_DEPENDS:=util-linux
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/hfsprogs/Default
SECTION:=utils
@ -53,11 +54,12 @@ endef
define Build/Configure
endef
TARGET_CFLAGS+=$(if $(CONFIG_USE_MUSL),-D__P\(x\)=x -D__va_copy=va_copy -DBSD_SOURCE)
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
-f Makefile.lnx \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS+="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1" \
CFLAGS+="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\\\"$(PKG_VERSION)\\\"" \
LDFLAGS+="$(TARGET_LDFLAGS) $(if $(CONFIG_USE_GLIBC),-lbsd)" \
all
endef

View File

@ -1,81 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Create short Makefiles for Debian
Create short Makefiles for compiling just the necessary parts for a
Debian-based (and possibly other distributions) HFS+ filesystem
utilities.
---
Makefile.lnx | 8 ++++++++
fsck_hfs.tproj/Makefile.lnx | 16 ++++++++++++++++
fsck_hfs.tproj/dfalib/Makefile.lnx | 15 +++++++++++++++
newfs_hfs.tproj/Makefile.lnx | 12 ++++++++++++
4 files changed, 51 insertions(+)
create mode 100644 Makefile.lnx
create mode 100644 fsck_hfs.tproj/Makefile.lnx
create mode 100644 fsck_hfs.tproj/dfalib/Makefile.lnx
create mode 100644 newfs_hfs.tproj/Makefile.lnx
--- /dev/null
+++ b/Makefile.lnx
@@ -0,0 +1,8 @@
+CC := gcc
+CFLAGS += -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1
+SUBDIRS := newfs_hfs.tproj fsck_hfs.tproj
+
+all clean:
+ for d in $(SUBDIRS); do $(MAKE) -C $$d -f Makefile.lnx $@; done
+
+export CC CFLAGS
--- /dev/null
+++ b/fsck_hfs.tproj/Makefile.lnx
@@ -0,0 +1,16 @@
+CFILES = fsck_hfs.c strings.c utilities.c cache.c fsck_debug.c
+OFILES = $(CFILES:.c=.o)
+
+all: fsck_hfs
+
+fsck_hfs: $(OFILES) dfalib/libdfa.a
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) dfalib/libdfa.a
+
+dfalib/libdfa.a: FORCE
+ $(MAKE) -C dfalib -f Makefile.lnx CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" libdfa.a
+
+clean:
+ $(RM) fsck_hfs $(OFILES)
+ $(MAKE) -C dfalib -f Makefile.lnx clean
+
+.PHONY : FORCE clean
--- /dev/null
+++ b/fsck_hfs.tproj/dfalib/Makefile.lnx
@@ -0,0 +1,15 @@
+CFILES = hfs_endian.c BlockCache.c\
+ BTree.c BTreeAllocate.c BTreeMiscOps.c \
+ BTreeNodeOps.c BTreeScanner.c BTreeTreeOps.c\
+ CatalogCheck.c HardLinkCheck.c\
+ SBTree.c SControl.c SVerify1.c SVerify2.c\
+ SRepair.c SRebuildCatalogBTree.c\
+ SUtils.c SKeyCompare.c SDevice.c SExtents.c SAllocate.c\
+ SCatalog.c SStubs.c VolumeBitmapCheck.c
+OFILES = $(CFILES:.c=.o)
+
+libdfa.a: $(OFILES)
+ $(AR) rc $@ $?
+
+clean:
+ $(RM) $(OFILES) libdfa.a
--- /dev/null
+++ b/newfs_hfs.tproj/Makefile.lnx
@@ -0,0 +1,12 @@
+CFILES = hfs_endian.c makehfs.c newfs_hfs.c
+OFILES = $(CFILES:.c=.o)
+
+all: newfs_hfs
+
+newfs_hfs: $(OFILES)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) -lcrypto
+
+clean:
+ $(RM) newfs_hfs $(OFILES)
+
+.PHONY : FORCE clean

View File

@ -1,123 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Fix compilation on 64-bit arches
---
fsck_hfs.tproj/dfalib/BTreePrivate.h | 5 ++++-
fsck_hfs.tproj/dfalib/SControl.c | 8 ++++----
fsck_hfs.tproj/dfalib/SVerify1.c | 14 +++++++-------
fsck_hfs.tproj/dfalib/hfs_endian.c | 2 +-
4 files changed, 16 insertions(+), 13 deletions(-)
--- a/fsck_hfs.tproj/dfalib/BTreePrivate.h
+++ b/fsck_hfs.tproj/dfalib/BTreePrivate.h
@@ -104,6 +104,9 @@ typedef enum {
///////////////////////////////////// Types /////////////////////////////////////
+// Forward declaration from Scavenger.h
+struct BTreeExtensionsRec;
+
typedef struct BTreeControlBlock { // fields specific to BTree CBs
UInt8 keyCompareType; /* Key string Comparison Type */
@@ -144,7 +147,7 @@ typedef struct BTreeControlBlock { /
UInt32 numPossibleHints; // Looks like a formated hint
UInt32 numValidHints; // Hint used to find correct record.
- UInt32 refCon; // Used by DFA to point to private data.
+ struct BTreeExtensionsRec *refCon; // Used by DFA to point to private data.
SFCB *fcbPtr; // fcb of btree file
} BTreeControlBlock, *BTreeControlBlockPtr;
--- a/fsck_hfs.tproj/dfalib/SControl.c
+++ b/fsck_hfs.tproj/dfalib/SControl.c
@@ -1034,7 +1034,7 @@ static int ScavTerm( SGlobPtr GPtr )
btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
if ( btcbP != nil)
{
- if( btcbP->refCon != (UInt32)nil )
+ if( btcbP->refCon != nil )
{
if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
{
@@ -1043,13 +1043,13 @@ static int ScavTerm( SGlobPtr GPtr )
}
DisposeMemory( (Ptr)btcbP->refCon );
err = MemError();
- btcbP->refCon = (UInt32)nil;
+ btcbP->refCon = nil;
}
fcbP = GPtr->calculatedCatalogFCB; // release catalog BTree bit map
btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
- if( btcbP->refCon != (UInt32)nil )
+ if( btcbP->refCon != nil )
{
if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
{
@@ -1058,7 +1058,7 @@ static int ScavTerm( SGlobPtr GPtr )
}
DisposeMemory( (Ptr)btcbP->refCon );
err = MemError();
- btcbP->refCon = (UInt32)nil;
+ btcbP->refCon = nil;
}
}
}
--- a/fsck_hfs.tproj/dfalib/SVerify1.c
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c
@@ -789,8 +789,8 @@ OSErr CreateExtentsBTreeControlBlock( SG
//
// set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
//
- btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
- if ( btcb->refCon == (UInt32) nil ) {
+ btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
+ if ( btcb->refCon == nil ) {
err = R_NoMem;
goto exit;
}
@@ -1144,8 +1144,8 @@ OSErr CreateCatalogBTreeControlBlock( SG
// set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
//
- btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
- if ( btcb->refCon == (UInt32)nil ) {
+ btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
+ if ( btcb->refCon == nil ) {
err = R_NoMem;
goto exit;
}
@@ -1779,8 +1779,8 @@ OSErr CreateAttributesBTreeControlBlock(
//
// set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
//
- btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
- if ( btcb->refCon == (UInt32)nil ) {
+ btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
+ if ( btcb->refCon == nil ) {
err = R_NoMem;
goto exit;
}
@@ -1793,7 +1793,7 @@ OSErr CreateAttributesBTreeControlBlock(
}
else
{
- if ( btcb->refCon == (UInt32)nil ) {
+ if ( btcb->refCon == nil ) {
err = R_NoMem;
goto exit;
}
--- a/fsck_hfs.tproj/dfalib/hfs_endian.c
+++ b/fsck_hfs.tproj/dfalib/hfs_endian.c
@@ -437,7 +437,7 @@ hfs_swap_HFSPlusBTInternalNode (
BTNodeDescriptor *srcDesc = src->buffer;
UInt16 *srcOffs = (UInt16 *)((char *)src->buffer + (src->blockSize - (srcDesc->numRecords * sizeof (UInt16))));
char *nextRecord; /* Points to start of record following current one */
- UInt32 i;
+ int i;
UInt32 j;
if (fileID == kHFSExtentsFileID) {

View File

@ -1,287 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Remove (Apple-specific?) \p from strings
Modify the way that debug messages are sent to the user, by eliminating one
character of them.
---
fsck_hfs.tproj/dfalib/BTreeTreeOps.c | 48 ++++++++++++++++++------------------
fsck_hfs.tproj/dfalib/SBTree.c | 14 +++++------
2 files changed, 31 insertions(+), 31 deletions(-)
--- a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
+++ b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
@@ -223,7 +223,7 @@ OSStatus SearchTree (BTreeControlBlockPt
//
if (curNodeNum == 0)
{
-// Panic("\pSearchTree: curNodeNum is zero!");
+ Panic("SearchTree: curNodeNum is zero!");
err = fsBTInvalidNodeErr;
goto ErrorExit;
}
@@ -433,7 +433,7 @@ OSStatus InsertLevel (BTreeControlBlockP
M_ExitOnError (err);
if ( DEBUG_BUILD && updateParent && newRoot )
- DebugStr("\p InsertLevel: New root from primary key, update from secondary key...");
+ DebugStr("InsertLevel: New root from primary key, update from secondary key...");
}
//////////////////////// Update Parent(s) ///////////////////////////////
@@ -448,7 +448,7 @@ OSStatus InsertLevel (BTreeControlBlockP
secondaryKey = nil;
- PanicIf ( (level == btreePtr->treeDepth), "\p InsertLevel: unfinished insert!?");
+ PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?");
++level;
@@ -456,7 +456,7 @@ OSStatus InsertLevel (BTreeControlBlockP
index = treePathTable [level].index;
parentNodeNum = treePathTable [level].node;
- PanicIf ( parentNodeNum == 0, "\p InsertLevel: parent node is zero!?");
+ PanicIf ( parentNodeNum == 0, "InsertLevel: parent node is zero!?");
err = GetNode (btreePtr, parentNodeNum, &parentNode); // released as target node in next level up
M_ExitOnError (err);
@@ -470,7 +470,7 @@ OSStatus InsertLevel (BTreeControlBlockP
{
//¥¥Êdebug: check if ptr == targetNodeNum
GetRecordByIndex (btreePtr, parentNode.buffer, index, &keyPtr, &recPtr, &recSize);
- PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "\p InsertLevel: parent ptr doesn't match target node!");
+ PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "InsertLevel: parent ptr doesn't match target node!");
// need to delete and re-insert this parent key/ptr
// we delete it here and it gets re-inserted in the
@@ -532,7 +532,7 @@ ErrorExit:
(void) ReleaseNode (btreePtr, targetNode);
(void) ReleaseNode (btreePtr, &siblingNode);
- Panic ("\p InsertLevel: an error occured!");
+ Panic ("InsertLevel: an error occured!");
return err;
@@ -566,7 +566,7 @@ static OSErr InsertNode (BTreeControlBlo
*rootSplit = false;
- PanicIf ( targetNode->buffer == siblingNode->buffer, "\p InsertNode: targetNode == siblingNode, huh?");
+ PanicIf ( targetNode->buffer == siblingNode->buffer, "InsertNode: targetNode == siblingNode, huh?");
leftNodeNum = ((NodeDescPtr) targetNode->buffer)->bLink;
rightNodeNum = ((NodeDescPtr) targetNode->buffer)->fLink;
@@ -606,7 +606,7 @@ static OSErr InsertNode (BTreeControlBlo
if ( leftNodeNum > 0 )
{
- PanicIf ( siblingNode->buffer != nil, "\p InsertNode: siblingNode already aquired!");
+ PanicIf ( siblingNode->buffer != nil, "InsertNode: siblingNode already aquired!");
if ( siblingNode->buffer == nil )
{
@@ -614,7 +614,7 @@ static OSErr InsertNode (BTreeControlBlo
M_ExitOnError (err);
}
- PanicIf ( ((NodeDescPtr) siblingNode->buffer)->fLink != nodeNum, "\p InsertNode, RotateLeft: invalid sibling link!" );
+ PanicIf ( ((NodeDescPtr) siblingNode->buffer)->fLink != nodeNum, "InsertNode, RotateLeft: invalid sibling link!" );
if ( !key->skipRotate ) // are rotates allowed?
{
@@ -703,7 +703,7 @@ OSStatus DeleteTree (BTreeControlBlock
targetNodeNum = treePathTable[level].node;
targetNodePtr = targetNode->buffer;
- PanicIf (targetNodePtr == nil, "\pDeleteTree: targetNode has nil buffer!");
+ PanicIf (targetNodePtr == nil, "DeleteTree: targetNode has nil buffer!");
DeleteRecord (btreePtr, targetNodePtr, index);
@@ -797,7 +797,7 @@ OSStatus DeleteTree (BTreeControlBlock
//¥¥Êdebug: check if ptr == targetNodeNum
GetRecordByIndex (btreePtr, parentNode.buffer, index, &keyPtr, &recPtr, &recSize);
- PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "\p DeleteTree: parent ptr doesn't match targetNodeNum!!");
+ PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, " DeleteTree: parent ptr doesn't match targetNodeNum!!");
// need to delete and re-insert this parent key/ptr
DeleteRecord (btreePtr, parentNode.buffer, index);
@@ -1018,7 +1018,7 @@ static OSStatus RotateLeft (BTreeContro
keyPtr, keyLength, recPtr, recSize);
if ( !didItFit )
{
- Panic ("\pRotateLeft: InsertKeyRecord (left) returned false!");
+ Panic ("RotateLeft: InsertKeyRecord (left) returned false!");
err = fsBTBadRotateErr;
goto ErrorExit;
}
@@ -1031,7 +1031,7 @@ static OSStatus RotateLeft (BTreeContro
didItFit = RotateRecordLeft (btreePtr, leftNode, rightNode);
if ( !didItFit )
{
- Panic ("\pRotateLeft: RotateRecordLeft returned false!");
+ Panic ("RotateLeft: RotateRecordLeft returned false!");
err = fsBTBadRotateErr;
goto ErrorExit;
}
@@ -1048,7 +1048,7 @@ static OSStatus RotateLeft (BTreeContro
keyPtr, keyLength, recPtr, recSize);
if ( !didItFit )
{
- Panic ("\pRotateLeft: InsertKeyRecord (right) returned false!");
+ Panic ("RotateLeft: InsertKeyRecord (right) returned false!");
err = fsBTBadRotateErr;
goto ErrorExit;
}
@@ -1117,7 +1117,7 @@ static OSStatus SplitLeft (BTreeControl
right = rightNode->buffer;
left = leftNode->buffer;
- PanicIf ( right->bLink != 0 && left == 0, "\p SplitLeft: left sibling missing!?" );
+ PanicIf ( right->bLink != 0 && left == 0, " SplitLeft: left sibling missing!?" );
//¥¥ type should be kLeafNode or kIndexNode
@@ -1240,8 +1240,8 @@ static OSStatus AddNewRootNode (BTreeCon
Boolean didItFit;
UInt16 keyLength;
- PanicIf (leftNode == nil, "\pAddNewRootNode: leftNode == nil");
- PanicIf (rightNode == nil, "\pAddNewRootNode: rightNode == nil");
+ PanicIf (leftNode == nil, "AddNewRootNode: leftNode == nil");
+ PanicIf (rightNode == nil, "AddNewRootNode: rightNode == nil");
/////////////////////// Initialize New Root Node ////////////////////////////
@@ -1264,7 +1264,7 @@ static OSStatus AddNewRootNode (BTreeCon
didItFit = InsertKeyRecord ( btreePtr, rootNode.buffer, 0, keyPtr, keyLength,
(UInt8 *) &rightNode->bLink, 4 );
- PanicIf ( !didItFit, "\pAddNewRootNode:InsertKeyRecord failed for left index record");
+ PanicIf ( !didItFit, "AddNewRootNode:InsertKeyRecord failed for left index record");
//////////////////// Insert Right Node Index Record /////////////////////////
@@ -1275,7 +1275,7 @@ static OSStatus AddNewRootNode (BTreeCon
didItFit = InsertKeyRecord ( btreePtr, rootNode.buffer, 1, keyPtr, keyLength,
(UInt8 *) &leftNode->fLink, 4 );
- PanicIf ( !didItFit, "\pAddNewRootNode:InsertKeyRecord failed for right index record");
+ PanicIf ( !didItFit, "AddNewRootNode:InsertKeyRecord failed for right index record");
#if DEBUG_TREEOPS
@@ -1355,7 +1355,7 @@ static OSStatus SplitRight (BTreeContro
}
rightPtr = rightNodePtr->buffer;
- PanicIf ( leftPtr->fLink != 0 && rightPtr == 0, "\p SplitRight: right sibling missing!?" );
+ PanicIf ( leftPtr->fLink != 0 && rightPtr == 0, "SplitRight: right sibling missing!?" );
//¥¥ type should be kLeafNode or kIndexNode
@@ -1557,7 +1557,7 @@ static OSStatus RotateRight (BTreeContr
keyPtr, keyLength, recPtr, recSize);
if ( !didItFit )
{
- Panic ("\pRotateRight: InsertKeyRecord (left) returned false!");
+ Panic ("RotateRight: InsertKeyRecord (left) returned false!");
err = fsBTBadRotateErr;
goto ErrorExit;
}
@@ -1572,7 +1572,7 @@ static OSStatus RotateRight (BTreeContr
didItFit = RotateRecordRight( btreePtr, leftNodePtr, rightNodePtr );
if ( !didItFit )
{
- Panic ("\pRotateRight: RotateRecordRight returned false!");
+ Panic ("RotateRight: RotateRecordRight returned false!");
err = fsBTBadRotateErr;
goto ErrorExit;
}
@@ -1583,7 +1583,7 @@ static OSStatus RotateRight (BTreeContr
keyPtr, keyLength, recPtr, recSize);
if ( !didItFit )
{
- Panic ("\pRotateRight: InsertKeyRecord (left) returned false!");
+ Panic ("RotateRight: InsertKeyRecord (left) returned false!");
err = fsBTBadRotateErr;
goto ErrorExit;
}
@@ -1607,7 +1607,7 @@ static OSStatus RotateRight (BTreeContr
keyPtr, keyLength, recPtr, recSize);
if ( !didItFit )
{
- Panic ("\pRotateRight: InsertKeyRecord (right) returned false!");
+ Panic ("RotateRight: InsertKeyRecord (right) returned false!");
err = fsBTBadRotateErr;
goto ErrorExit;
}
--- a/fsck_hfs.tproj/dfalib/SBTree.c
+++ b/fsck_hfs.tproj/dfalib/SBTree.c
@@ -103,7 +103,7 @@ OSErr SearchBTreeRecord(SFCB *fcb, const
CopyMemory(&resultIterator->key, foundKey, CalcKeySize(btcb, &resultIterator->key)); //¥¥ warning, this could overflow user's buffer!!!
if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, *dataSize) )
- DebugStr("\pSearchBTreeRecord: bad record?");
+ DebugStr("SearchBTreeRecord: bad record?");
}
ErrorExit:
@@ -211,7 +211,7 @@ OSErr GetBTreeRecord(SFCB *fcb, SInt16 s
CopyMemory(&iterator->key, key, CalcKeySize(btcb, &iterator->key)); //¥¥ warning, this could overflow user's buffer!!!
if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, *dataSize) )
- DebugStr("\pGetBTreeRecord: bad record?");
+ DebugStr("GetBTreeRecord: bad record?");
}
@@ -243,7 +243,7 @@ OSErr InsertBTreeRecord(SFCB *fcb, const
CopyMemory(key, &iterator.key, CalcKeySize(btcb, (BTreeKey *) key)); //¥¥ should we range check against maxkeylen?
if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, dataSize) )
- DebugStr("\pInsertBTreeRecord: bad record?");
+ DebugStr("InsertBTreeRecord: bad record?");
result = BTInsertRecord( fcb, &iterator, &btRecord, dataSize );
@@ -305,7 +305,7 @@ OSErr ReplaceBTreeRecord(SFCB *fcb, cons
CopyMemory(key, &iterator.key, CalcKeySize(btcb, (BTreeKey *) key)); //¥¥ should we range check against maxkeylen?
if ( DEBUG_BUILD && !ValidHFSRecord(newData, btcb, dataSize) )
- DebugStr("\pReplaceBTreeRecord: bad record?");
+ DebugStr("ReplaceBTreeRecord: bad record?");
result = BTReplaceRecord( fcb, &iterator, &btRecord, dataSize );
@@ -344,7 +344,7 @@ SetEndOfForkProc ( SFCB *filePtr, FSSize
else
{
if ( DEBUG_BUILD )
- DebugStr("\pSetEndOfForkProc: minEOF is smaller than current size!");
+ DebugStr("SetEndOfForkProc: minEOF is smaller than current size!");
return -1;
}
@@ -370,7 +370,7 @@ SetEndOfForkProc ( SFCB *filePtr, FSSize
// Make sure we got at least as much space as we needed
//
if (filePtr->fcbLogicalSize < minEOF) {
- Panic("\pSetEndOfForkProc: disk too full to extend B-tree file");
+ Panic("SetEndOfForkProc: disk too full to extend B-tree file");
return dskFulErr;
}
@@ -442,7 +442,7 @@ static OSErr CheckBTreeKey(const BTreeKe
if ( (keyLen < 6) || (keyLen > btcb->maxKeyLength) )
{
if ( DEBUG_BUILD )
- DebugStr("\pCheckBTreeKey: bad key length!");
+ DebugStr("CheckBTreeKey: bad key length!");
return fsBTInvalidKeyLengthErr;
}

View File

@ -1,33 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Adjust types for printing
Try to address the issues of a given integral type having different sizes
in 32 and 64-bit architectures.
---
fsck_hfs.tproj/dfalib/SControl.c | 2 +-
fsck_hfs.tproj/dfalib/hfs_endian.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/fsck_hfs.tproj/dfalib/SControl.c
+++ b/fsck_hfs.tproj/dfalib/SControl.c
@@ -776,7 +776,7 @@ static int ScavSetUp( SGlob *GPtr)
pointer = (ScavStaticStructures *) AllocateClearMemory( sizeof(ScavStaticStructures) );
if ( pointer == nil ) {
if ( GPtr->logLevel >= kDebugLog ) {
- printf( "\t error %d - could not allocate %ld bytes of memory \n",
+ printf( "\t error %d - could not allocate %i bytes of memory \n",
R_NoMem, sizeof(ScavStaticStructures) );
}
return( R_NoMem );
--- a/fsck_hfs.tproj/dfalib/hfs_endian.c
+++ b/fsck_hfs.tproj/dfalib/hfs_endian.c
@@ -563,7 +563,7 @@ hfs_swap_HFSPlusBTInternalNode (
/* Make sure name length is consistent with key length */
if (keyLength < sizeof(srcKey->parentID) + sizeof(srcKey->nodeName.length) +
srcKey->nodeName.length*sizeof(srcKey->nodeName.unicode[0])) {
- if (debug) printf("hfs_swap_HFSPlusBTInternalNode: catalog record #%d keyLength=%d expected=%lu\n",
+ if (debug) printf("hfs_swap_HFSPlusBTInternalNode: catalog record #%d keyLength=%d expected=%i\n",
srcDesc->numRecords-i, keyLength, sizeof(srcKey->parentID) + sizeof(srcKey->nodeName.length) +
srcKey->nodeName.length*sizeof(srcKey->nodeName.unicode[0]));
WriteError(fcb->fcbVolume->vcbGPtr, E_KeyLen, fcb->fcbFileID, src->blockNum);

View File

@ -10,8 +10,8 @@ systems (since it is arch independent).
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -70,7 +70,7 @@ extern Boolean _CFStringGetFileSystemRep
#include "readme.h"
@@ -86,7 +86,7 @@ extern Boolean _CFStringGetFileSystemRep
#include "newfs_hfs.h"
-#define HFS_BOOT_DATA "/usr/share/misc/hfsbootdata"

View File

@ -1,38 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Provide command line option -a
Create a new command line option (-a) for the fsck.hfsplus that has the same
behavior that the -p option has, for greater compatibility with other tools.
---
fsck_hfs.tproj/fsck_hfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/fsck_hfs.tproj/fsck_hfs.c
+++ b/fsck_hfs.tproj/fsck_hfs.c
@@ -104,7 +104,7 @@ main(argc, argv)
else
progname = *argv;
- while ((ch = getopt(argc, argv, "c:D:dfglm:npqruy")) != EOF) {
+ while ((ch = getopt(argc, argv, "c:D:dfglm:napqruy")) != EOF) {
switch (ch) {
case 'c':
/* Cache size to use in fsck_hfs */
@@ -169,6 +169,7 @@ main(argc, argv)
yflag = 0;
break;
+ case 'a':
case 'p':
preen++;
break;
@@ -572,7 +573,7 @@ usage()
(void) fprintf(stderr, " l = live fsck (lock down and test-only)\n");
(void) fprintf(stderr, " m arg = octal mode used when creating lost+found directory \n");
(void) fprintf(stderr, " n = assume a no response \n");
- (void) fprintf(stderr, " p = just fix normal inconsistencies \n");
+ (void) fprintf(stderr, " p, a = just fix normal inconsistencies \n");
(void) fprintf(stderr, " q = quick check returns clean, dirty, or failure \n");
(void) fprintf(stderr, " r = rebuild catalog btree \n");
(void) fprintf(stderr, " u = usage \n");

View File

@ -1,179 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Rename dprintf to dbg_printf
---
fsck_hfs.tproj/dfalib/SRepair.c | 18 +++++++++---------
fsck_hfs.tproj/dfalib/SVerify1.c | 6 +++---
fsck_hfs.tproj/fsck_debug.c | 10 +++++-----
fsck_hfs.tproj/fsck_debug.h | 10 +++++-----
4 files changed, 22 insertions(+), 22 deletions(-)
--- a/fsck_hfs.tproj/dfalib/SRepair.c
+++ b/fsck_hfs.tproj/dfalib/SRepair.c
@@ -1825,13 +1825,13 @@ static OSErr FixAttrSize(SGlobPtr GPtr,
result = BTSearchRecord(GPtr->calculatedAttributesFCB, &iterator,
kInvalidMRUCacheKey, &btRecord, &recSize, &iterator);
if (result) {
- dprintf (d_error|d_xattr, "%s: Cannot find attribute record (err = %d)\n", __FUNCTION__, result);
+ dbg_printf (d_error|d_xattr, "%s: Cannot find attribute record (err = %d)\n", __FUNCTION__, result);
goto out;
}
/* We should only get record of type kHFSPlusAttrForkData */
if (record.recordType != kHFSPlusAttrForkData) {
- dprintf (d_error|d_xattr, "%s: Record found is not attribute fork data\n", __FUNCTION__);
+ dbg_printf (d_error|d_xattr, "%s: Record found is not attribute fork data\n", __FUNCTION__);
result = btNotFound;
goto out;
}
@@ -1862,7 +1862,7 @@ static OSErr FixAttrSize(SGlobPtr GPtr,
result = BTReplaceRecord(GPtr->calculatedAttributesFCB, &iterator,
&btRecord, recSize);
if (result) {
- dprintf (d_error|d_xattr, "%s: Cannot replace attribute record (err=%d)\n", __FUNCTION__, result);
+ dbg_printf (d_error|d_xattr, "%s: Cannot replace attribute record (err=%d)\n", __FUNCTION__, result);
goto out;
}
}
@@ -2058,7 +2058,7 @@ del_overflow_extents:
/* Delete the extent record */
err = DeleteBTreeRecord(GPtr->calculatedExtentsFCB, &extentKey);
- dprintf (d_info, "%s: Deleting extent overflow for fileID=%u, forkType=%u, startBlock=%u\n", __FUNCTION__, fileID, forkType, foundStartBlock);
+ dbg_printf (d_info, "%s: Deleting extent overflow for fileID=%u, forkType=%u, startBlock=%u\n", __FUNCTION__, fileID, forkType, foundStartBlock);
if (err) {
goto create_symlink;
}
@@ -3227,12 +3227,12 @@ static OSErr MoveExtent(SGlobPtr GPtr, E
&extentData, &recordSize, &foundExtentIndex);
foundLocation = extentsBTree;
if (err != noErr) {
- dprintf (d_error|d_overlap, "%s: No matching extent record found in extents btree for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err);
+ dbg_printf (d_error|d_overlap, "%s: No matching extent record found in extents btree for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err);
goto out;
}
} else {
/* No more extents exist for this file */
- dprintf (d_error|d_overlap, "%s: No matching extent record found for fileID = %d\n", __FUNCTION__, extentInfo->fileID);
+ dbg_printf (d_error|d_overlap, "%s: No matching extent record found for fileID = %d\n", __FUNCTION__, extentInfo->fileID);
goto out;
}
}
@@ -3241,7 +3241,7 @@ static OSErr MoveExtent(SGlobPtr GPtr, E
err = CopyDiskBlocks(GPtr, extentInfo->startBlock, extentInfo->blockCount,
extentInfo->newStartBlock);
if (err != noErr) {
- dprintf (d_error|d_overlap, "%s: Error in copying disk blocks for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err);
+ dbg_printf (d_error|d_overlap, "%s: Error in copying disk blocks for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err);
goto out;
}
@@ -3260,7 +3260,7 @@ static OSErr MoveExtent(SGlobPtr GPtr, E
}
if (err != noErr) {
- dprintf (d_error|d_overlap, "%s: Error in updating extent record for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err);
+ dbg_printf (d_error|d_overlap, "%s: Error in updating extent record for fileID = %d (err=%d)\n", __FUNCTION__, extentInfo->fileID, err);
goto out;
}
@@ -3491,7 +3491,7 @@ static OSErr SearchExtentInAttributeBT(S
result = BTSearchRecord(GPtr->calculatedAttributesFCB, &iterator,
kInvalidMRUCacheKey, &btRecord, recordSize, &iterator);
if (result) {
- dprintf (d_error|d_overlap, "%s: Error finding attribute record (err=%d) for fileID = %d, attrname = %d\n", __FUNCTION__, result, extentInfo->fileID, extentInfo->attrname);
+ dbg_printf (d_error|d_overlap, "%s: Error finding attribute record (err=%d) for fileID = %d, attrname = %d\n", __FUNCTION__, result, extentInfo->fileID, extentInfo->attrname);
goto out;
}
--- a/fsck_hfs.tproj/dfalib/SVerify1.c
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c
@@ -2157,9 +2157,9 @@ CheckAttributeRecord(SGlobPtr GPtr, cons
if (doDelete == true) {
result = DeleteBTreeRecord(GPtr->calculatedAttributesFCB, key);
- dprintf (d_info|d_xattr, "%s: Deleting attribute %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType);
+ dbg_printf (d_info|d_xattr, "%s: Deleting attribute %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType);
if (result) {
- dprintf (d_error|d_xattr, "%s: Error in deleting record for %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType);
+ dbg_printf (d_error|d_xattr, "%s: Error in deleting record for %s for fileID %d, type = %d\n", __FUNCTION__, attrname, key->fileID, rec->recordType);
}
/* Set flags to mark header and map dirty */
@@ -3034,7 +3034,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, U
// checkout the extent record first
err = ChkExtRec( GPtr, extents, &lastExtentIndex );
if (err != noErr) {
- dprintf (d_info, "%s: Bad extent for fileID %u in extent %u for startblock %u\n", __FUNCTION__, fileNumber, lastExtentIndex, blockCount);
+ dbg_printf (d_info, "%s: Bad extent for fileID %u in extent %u for startblock %u\n", __FUNCTION__, fileNumber, lastExtentIndex, blockCount);
/* Stop verification if bad extent is found for system file or EA */
if ((fileNumber < kHFSFirstUserCatalogNodeID) ||
--- a/fsck_hfs.tproj/fsck_debug.c
+++ b/fsck_hfs.tproj/fsck_debug.c
@@ -25,18 +25,18 @@
#include <stdio.h>
#include <stdarg.h>
-/* Current debug level of fsck_hfs for printing messages via dprintf */
+/* Current debug level of fsck_hfs for printing messages via dbg_printf */
unsigned long cur_debug_level;
-/* Function: dprintf
+/* Function: dbg_printf
*
* Description: Debug function similar to printf except the first parameter
- * which indicates the type of message to be printed by dprintf. Based on
+ * which indicates the type of message to be printed by dbg_printf. Based on
* current debug level and the type of message, the function decides
* whether to print the message or not.
*
* Each unique message type has a bit assigned to it. The message type
- * passed to dprintf can be one or combination (OR-ed value) of pre-defined
+ * passed to dbg_printf can be one or combination (OR-ed value) of pre-defined
* debug message types. Only the messages whose type have one or more similar
* bits set in comparison with current global debug level are printed.
*
@@ -56,7 +56,7 @@ unsigned long cur_debug_level;
* Output:
* Nothing
*/
-void dprintf (unsigned long type, char *fmt, ...)
+void dbg_printf (unsigned long type, char *fmt, ...)
{
if (cur_debug_level & type) {
va_list ap;
--- a/fsck_hfs.tproj/fsck_debug.h
+++ b/fsck_hfs.tproj/fsck_debug.h
@@ -36,18 +36,18 @@ enum debug_message_type {
d_overlap = 0x0020 /* Overlap extents related messages */
};
-/* Current debug level of fsck_hfs for printing messages via dprintf */
+/* Current debug level of fsck_hfs for printing messages via dbg_printf */
extern unsigned long cur_debug_level;
-/* Function: dprintf
+/* Function: dbg_printf
*
* Description: Debug function similar to printf except the first parameter
- * which indicates the type of message to be printed by dprintf. Based on
+ * which indicates the type of message to be printed by dbg_printf. Based on
* current debug level and the type of message, the function decides
* whether to print the message or not.
*
* Each unique message type has a bit assigned to it. The message type
- * passed to dprintf can be one or combination (OR-ed value) of pre-defined
+ * passed to dbg_printf can be one or combination (OR-ed value) of pre-defined
* debug message types. Only the messages whose type have one or more similar
* bits set in comparison with current global debug level are printed.
*
@@ -67,6 +67,6 @@ extern unsigned long cur_debug_level;
* Output:
* Nothing
*/
-extern void dprintf (unsigned long message_type, char *format, ...);
+extern void dbg_printf (unsigned long message_type, char *format, ...);
#endif /* __FSCK_DEBUG__ */

View File

@ -1,69 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:22 -0200
Subject: Fix types
---
fsck_hfs.tproj/cache.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
--- a/fsck_hfs.tproj/cache.c
+++ b/fsck_hfs.tproj/cache.c
@@ -961,20 +961,21 @@ int CacheLookup (Cache_t *cache, uint64_
*/
int CacheRawRead (Cache_t *cache, uint64_t off, uint32_t len, void *buf)
{
- uint64_t result;
+ off_t result1;
+ ssize_t result2;
/* Both offset and length must be multiples of the device block size */
if (off % cache->DevBlockSize) return (EINVAL);
if (len % cache->DevBlockSize) return (EINVAL);
/* Seek to the position */
- result = lseek (cache->FD_R, off, SEEK_SET);
- if (result < 0) return (errno);
- if (result != off) return (ENXIO);
+ result1 = lseek(cache->FD_R, off, SEEK_SET);
+ if (result1 < 0) return (errno);
+ if (result1 != off) return (ENXIO);
/* Read into the buffer */
- result = read (cache->FD_R, buf, len);
- if (result < 0) return (errno);
- if (result == 0) return (ENXIO);
+ result2 = read(cache->FD_R, buf, len);
+ if (result2 < 0) return (errno);
+ if (result2 == 0) return (ENXIO);
/* Update counters */
cache->DiskRead++;
@@ -989,21 +990,22 @@ int CacheRawRead (Cache_t *cache, uint64
*/
int CacheRawWrite (Cache_t *cache, uint64_t off, uint32_t len, void *buf)
{
- uint64_t result;
+ off_t result1;
+ ssize_t result2;
/* Both offset and length must be multiples of the device block size */
if (off % cache->DevBlockSize) return (EINVAL);
if (len % cache->DevBlockSize) return (EINVAL);
/* Seek to the position */
- result = lseek (cache->FD_W, off, SEEK_SET);
- if (result < 0) return (errno);
- if (result != off) return (ENXIO);
+ result1 = lseek (cache->FD_W, off, SEEK_SET);
+ if (result1 < 0) return (errno);
+ if (result1 != off) return (ENXIO);
/* Write into the buffer */
- result = write (cache->FD_W, buf, len);
- if (result < 0) return (errno);
- if (result == 0) return (ENXIO);
+ result2 = write (cache->FD_W, buf, len);
+ if (result2 < 0) return (errno);
+ if (result2 == 0) return (ENXIO);
/* Update counters */
cache->DiskWrite++;

View File

@ -1,48 +0,0 @@
From: Matthew Garrett <mjg59@codon.org.uk>
Date: Thu, 24 Oct 2013 01:11:22 -0200
Subject: Fix mkfs not creating UUIDs for new filesystems.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix mkfs not creating UUIDs for new filesystems.
Thanks to Lars Noodén for reporting the bug at
<https://bugs.launchpad.net/bugs/737002>.
This closes LP: #737002.
---
include/missing.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/include/missing.h
+++ b/include/missing.h
@@ -71,7 +71,7 @@
#define NAME_MAX 255
/* Byteswap stuff */
-#define NXSwapHostLongToBig(x) cpu_to_be64(x)
+#define NXSwapHostLongToBig(x) cpu_to_be32(x)
#define NXSwapBigShortToHost(x) be16_to_cpu(x)
#define OSSwapBigToHostInt16(x) be16_to_cpu(x)
#define NXSwapBigLongToHost(x) be32_to_cpu(x)
@@ -87,6 +87,9 @@
#ifndef be32_to_cpu
#define be32_to_cpu(x) bswap_32(x)
#endif
+#ifndef cpu_to_be32
+#define cpu_to_be32(x) bswap_32(x)
+#endif
#ifndef be64_to_cpu
#define be64_to_cpu(x) bswap_64(x)
#endif
@@ -101,6 +104,9 @@
#ifndef be32_to_cpu
#define be32_to_cpu(x) (x)
#endif
+#ifndef cpu_to_be32
+#define cpu_to_be32(x) (x)
+#endif
#ifndef be64_to_cpu
#define be64_to_cpu(x) (x)
#endif

View File

@ -1,153 +0,0 @@
From: =?UTF-8?q?Rog=C3=A9rio=20Theodoro=20de=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 25 Nov 2010 00:00:00 -0200
Subject: Fix manpages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Remove typos, references in the "See also" sections of the manpages to
commands that are not available in Debian systems (and, quite probably,
other systems too) and non-Linux specific comments.
Authored also by Christoph Hellwig <hch@lst.de> and "A. Costa" <agcosta@gis.net>
Bug-Debian: http://bugs.debian.org/598714
Bug-Debian: http://bugs.debian.org/575201
Forwarded: no
Reviewed-by: Rogério Theodoro de Brito <rbrito@ime.usp.br>
---
fsck_hfs.tproj/fsck_hfs.8 | 18 +++++++-----------
newfs_hfs.tproj/newfs_hfs.8 | 23 ++++++++---------------
2 files changed, 15 insertions(+), 26 deletions(-)
--- a/fsck_hfs.tproj/fsck_hfs.8
+++ b/fsck_hfs.tproj/fsck_hfs.8
@@ -19,18 +19,18 @@
.Dt FSCK_HFS 8
.Os "Mac OS X"
.Sh NAME
-.Nm fsck_hfs
+.Nm fsck.hfs
.Nd HFS file system consistency check
.Sh SYNOPSIS
-.Nm fsck_hfs
+.Nm fsck.hfs
.Fl q
.Op Fl df
.Ar special ...
-.Nm fsck_hfs
+.Nm fsck.hfs
.Fl p
.Op Fl df
.Ar special ...
-.Nm fsck_hfs
+.Nm fsck.hfs
.Op Fl n | y | r
.Op Fl dfgl
.Op Fl m Ar mode
@@ -52,9 +52,7 @@ The second form of
preens the specified file systems.
It is normally started by
.Xr fsck 8
-run from
-.Pa /etc/rc.boot
-during automatic reboot, when a HFS file system is detected.
+during systen boot, when a HFS file system is detected.
When preening file systems,
.Nm
will fix common inconsistencies for file systems that were not
@@ -105,9 +103,9 @@ to check and repair journaled HFS+ file
.It Fl g
Causes
.Nm
-to generate it's output strings in GUI format.
+to generate its output strings in GUI format.
This option is used when another application with a graphical user interface
-(like Mac OS X Disk Utility) is envoking the
+(like Mac OS X Disk Utility) is invoking the
.Nm
tool.
.It Fl l
@@ -144,8 +142,6 @@ specified file system for a new catalog
to the leaf nodes in the existing catalog file.
.El
.Pp
-Because of inconsistencies between the block device and the buffer cache,
-the raw device should always be used.
.Sh SEE ALSO
.Xr fsck 8
.Sh BUGS
--- a/newfs_hfs.tproj/newfs_hfs.8
+++ b/newfs_hfs.tproj/newfs_hfs.8
@@ -19,10 +19,10 @@
.Dt NEWFS_HFS 8
.Os "Mac OS X"
.Sh NAME
-.Nm newfs_hfs
+.Nm mkfs.hfs
.Nd construct a new HFS Plus file system
.Sh SYNOPSIS
-.Nm newfs_hfs
+.Nm mkfs.hfs
.Op Fl N Ar [partition-size]
.Op Fl U Ar uid
.Op Fl G Ar gid
@@ -37,19 +37,13 @@
.Op Fl v Ar volume-name
.Ar special
.Sh DESCRIPTION
-.Nm Newfs_hfs
+.Nm mkfs.hfs
builds an HFS Plus file system on the specified special device.
-Before running
-.Nm newfs_hfs
-the disk should be partitioned using the
-.Em Disk Utility
-application or
-.Xr pdisk 8 .
.Pp
The file system default parameters are calculated based on
the size of the disk partition. Typically the defaults are
reasonable, however
-.Nm newfs_hfs
+.Nm mkfs.hfs
has several options to allow the defaults to be selectively overridden.
The options are as follows:
.Bl -tag -width Fl
@@ -66,7 +60,7 @@ Set the group of the file system's root
Specify the access permissions mask for the file system's root directory.
.It Fl h
Creates a legacy HFS format filesystem. This option
-is not recomended for file systems that will be
+is not recommended for file systems that will be
primarily used with Mac OS X or Darwin.
.It Fl s
Creates a case-sensitive HFS Plus filesystem. By
@@ -93,7 +87,7 @@ sizes are specified with the
option followed by a comma
separated list of the form arg=blocks.
.Pp
-Example: -c c=5000,e=500
+Example: \-c c=5000,e=500
.Bl -tag -width Fl
.It Em a=blocks
Set the attribute file clump size.
@@ -126,7 +120,7 @@ the form arg=bytes. The
size must be a power of two and no larger than
32768 bytes.
.Pp
-Example: -n c=8192,e=4096
+Example: \-n c=8192,e=4096
.Bl -tag -width Fl
.It Em a=bytes
Set the attribute b-tree node size.
@@ -139,8 +133,7 @@ Set the extent overflow b-tree node size
Volume name (file system name) in ascii or UTF-8 format.
.El
.Sh SEE ALSO
-.Xr mount 8 ,
-.Xr pdisk 8
+.Xr mount 8
.Sh HISTORY
The
.Nm

View File

@ -1,15 +0,0 @@
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -2119,10 +2119,12 @@ void GenerateVolumeUUID(VolumeUUID *newV
sysctl(mib, 2, sysctlstring, &datalen, NULL, 0);
SHA1_Update(&context, sysctlstring, datalen);
#endif
+#ifndef __UCLIBC__
/* The system's load average: */
datalen = sizeof(sysloadavg);
getloadavg(sysloadavg, 3);
SHA1_Update(&context, &sysloadavg, datalen);
+#endif
/* The system's VM statistics: */
#if !LINUX

View File

@ -1,91 +0,0 @@
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -37,7 +37,9 @@
#endif
#include <sys/errno.h>
#include <sys/stat.h>
+#if 0
#include <sys/sysctl.h>
+#endif
#if !LINUX
#include <sys/vmmeter.h>
#endif
@@ -2039,6 +2041,7 @@ getencodinghint(unsigned char *name)
if (getvfsbyname("hfs", &vfc) < 0)
goto error;
+#ifdef __GLIBC__
mib[0] = CTL_VFS;
mib[1] = vfc.vfc_typenum;
mib[2] = HFS_ENCODINGHINT;
@@ -2046,6 +2049,7 @@ getencodinghint(unsigned char *name)
if (sysctl(mib, 3, &hint, &buflen, name, strlen((char *)name) + 1) < 0)
goto error;
return (hint);
+#endif
error:
hint = GetDefaultEncoding();
return (0);
@@ -2062,7 +2066,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
clock_t uptime;
size_t datalen;
double sysloadavg[3];
-#if !LINUX
+#if !LINUX && defined(__GLIBC__)
int sysdata;
int mib[2];
char sysctlstring[128];
@@ -2080,7 +2084,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
SHA1_Update(&context, &uptime, sizeof(uptime));
/* The kernel's boot time: */
-#if !LINUX
+#if !LINUX && defined(__GLIBC__)
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
datalen = sizeof(sysdata);
@@ -2088,7 +2092,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
SHA1_Update(&context, &sysdata, datalen);
#endif
/* The system's host id: */
-#if !LINUX
+#if !LINUX && defined(__GLIBC__)
mib[0] = CTL_KERN;
mib[1] = KERN_HOSTID;
datalen = sizeof(sysdata);
@@ -2096,7 +2100,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
SHA1_Update(&context, &sysdata, datalen);
#endif
/* The system's host name: */
-#if !LINUX
+#if !LINUX && defined(__GLIBC__)
mib[0] = CTL_KERN;
mib[1] = KERN_HOSTNAME;
datalen = sizeof(sysctlstring);
@@ -2104,7 +2108,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
SHA1_Update(&context, sysctlstring, datalen);
#endif
/* The running kernel's OS release string: */
-#if !LINUX
+#if !LINUX && defined(__GLIBC__)
mib[0] = CTL_KERN;
mib[1] = KERN_OSRELEASE;
datalen = sizeof(sysctlstring);
@@ -2112,7 +2116,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
SHA1_Update(&context, sysctlstring, datalen);
#endif
/* The running kernel's version string: */
-#if !LINUX
+#if !LINUX && defined(__GLIBC__)
mib[0] = CTL_KERN;
mib[1] = KERN_VERSION;
datalen = sizeof(sysctlstring);
@@ -2127,7 +2131,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
#endif
/* The system's VM statistics: */
-#if !LINUX
+#if !LINUX && defined(__GLIBC__)
mib[0] = CTL_VM;
mib[1] = VM_METER;
datalen = sizeof(sysvmtotal);

View File

@ -1,11 +1,11 @@
--- a/fsck_hfs.tproj/dfalib/SVerify1.c
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c
@@ -2848,7 +2848,7 @@ OSErr VLockedChk( SGlobPtr GPtr )
@@ -3454,7 +3454,7 @@ OSErr VLockedChk( SGlobPtr GPtr )
}
else // Because we don't have the unicode converters, just fill it with a dummy name.
{
- CopyMemory( "\x0dPure HFS Plus", calculatedVCB->vcbVN, sizeof(Str27) );
+ CopyMemory( u"\x0dPure HFS Plus", calculatedVCB->vcbVN, sizeof(Str27) );
+ CopyMemory( "u\x0dPure HFS Plus", calculatedVCB->vcbVN, sizeof(Str27) );
}
GPtr->TarBlock = hint;

View File

@ -0,0 +1,119 @@
--- a/fsck_hfs.tproj/utilities.c
+++ b/fsck_hfs.tproj/utilities.c
@@ -296,11 +296,8 @@ static volatile int keep_going = 1;
#undef printf
// prototype
-void print_to_mem(int type, const char *fmt, const char *str, va_list ap);
-
-#define DO_VPRINT 1 // types for print_to_mem
-#define DO_STR 2
-
+void vprint_to_mem(const char *fmt, va_list ap);
+void print_to_mem(const char *fmt, ...);
static void *
fsck_printing_thread(void *arg)
@@ -547,8 +544,8 @@ setup_logging(void)
cur_in_mem = in_mem_log;
t = time(NULL);
- print_to_mem(DO_STR, "\n%s: ", cdevname ? cdevname : "UNKNOWN-DEV", NULL);
- print_to_mem(DO_STR, "fsck_hfs run at %s", ctime(&t), NULL);
+ print_to_mem("\n%s: ", cdevname ? cdevname : "UNKNOWN-DEV");
+ print_to_mem("fsck_hfs run at %s", ctime(&t));
if (live_fsck && log_file) {
pthread_cond_init(&mem_buf_cond, NULL);
@@ -576,26 +573,20 @@ setup_logging(void)
void
-print_to_mem(int type, const char *fmt, const char *str, va_list ap)
+vprint_to_mem(const char *fmt, va_list ap)
{
int ret;
size_t size_remaining;
va_list ap_copy;
- if (type == DO_VPRINT) {
- va_copy(ap_copy, ap);
- }
+ va_copy(ap_copy, ap);
if (live_fsck) {
pthread_mutex_lock(&mem_buf_lock);
}
size_remaining = in_mem_size - (ptrdiff_t)(cur_in_mem - in_mem_log);
- if (type == DO_VPRINT) {
- ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap);
- } else {
- ret = snprintf(cur_in_mem, size_remaining, fmt, str);
- }
+ ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap);
if (ret > size_remaining) {
char *new_log;
size_t amt;
@@ -619,11 +610,7 @@ print_to_mem(int type, const char *fmt,
cur_in_mem = new_log + (cur_in_mem - in_mem_log);
in_mem_log = new_log;
size_remaining = in_mem_size - (ptrdiff_t)(cur_in_mem - new_log);
- if (type == DO_VPRINT) {
- ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap_copy);
- } else {
- ret = snprintf(cur_in_mem, size_remaining, fmt, str);
- }
+ ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap_copy);
if (ret <= size_remaining) {
cur_in_mem += ret;
}
@@ -636,11 +623,18 @@ print_to_mem(int type, const char *fmt,
pthread_mutex_unlock(&mem_buf_lock);
}
done:
- if (type == DO_VPRINT) {
- va_end(ap_copy);
- }
+ va_end(ap_copy);
}
+void
+print_to_mem(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprint_to_mem(fmt, ap);
+ va_end(ap);
+}
static int need_prefix=1;
@@ -662,7 +656,7 @@ static int need_prefix=1;
LOG_PREFIX \
vfprintf(log_file, fmt, ap); \
} else { \
- print_to_mem(DO_VPRINT, fmt, NULL, ap); \
+ vprint_to_mem(fmt, ap); \
}
#define FLOG(fmt, str) \
@@ -670,7 +664,7 @@ static int need_prefix=1;
LOG_PREFIX; \
fprintf(log_file, fmt, str); \
} else { \
- print_to_mem(DO_STR, fmt, str, NULL); \
+ print_to_mem(fmt, str); \
}
@@ -800,7 +794,7 @@ vplog(const char *fmt, va_list ap)
LOG_PREFIX;
vfprintf(log_file, fmt, ap);
} else {
- print_to_mem(DO_VPRINT, fmt, NULL, ap);
+ vprint_to_mem(fmt, ap);
}
}

View File

@ -1,20 +0,0 @@
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -376,7 +376,7 @@ make_hfsplus(const DriveInfo *driveInfo,
if ( (temp & 0x01FF) != 0 )
temp = (temp + kBytesPerSector) & 0xFFFFFE00;
- nodeBuffer = valloc((size_t)temp);
+ (void)posix_memalign(&nodeBuffer, sysconf(_SC_PAGESIZE), (size_t)temp);
if (nodeBuffer == NULL)
err(1, NULL);
@@ -1814,7 +1814,7 @@ ClearDisk(const DriveInfo *driveInfo, UI
bufferSize = bufferSizeInSectors << kLog2SectorSize;
- tempBuffer = valloc((size_t)bufferSize);
+ (void)posix_memalign(&tempBuffer, sysconf(_SC_PAGESIZE), (size_t)bufferSize);
if (tempBuffer == NULL)
err(1, NULL);

View File

@ -1,30 +0,0 @@
--- a/fsck_hfs.tproj/fsck_hfs.h
+++ b/fsck_hfs.tproj/fsck_hfs.h
@@ -24,6 +24,7 @@
#include "cache.h"
+#include <sys/cdefs.h>
const extern char *cdevname; /* name of device being checked */
extern char *progname;
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -28,6 +28,7 @@
*/
+#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
--- a/newfs_hfs.tproj/newfs_hfs.c
+++ b/newfs_hfs.tproj/newfs_hfs.c
@@ -34,6 +34,7 @@
#include <syslog.h>
#include <unistd.h>
+#include <sys/cdefs.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/param.h>

View File

@ -0,0 +1,142 @@
--- a/fsck_hfs.tproj/dfalib/SControl.c
+++ b/fsck_hfs.tproj/dfalib/SControl.c
@@ -200,6 +200,22 @@ isMinorError(int msg, int *counts)
}
}
+static int *msgCounts = NULL;
+static jmp_buf envBuf;
+
+static fsck_block_status_t
+fsckAfterCallback(fsck_ctx_t c, int msgNum, va_list args)
+{
+ if (abs(msgNum) > E_FirstError && abs(msgNum) < E_LastError) {
+ if (isMinorError(abs(msgNum), msgCounts) == 1)
+ return fsckBlockContinue;
+ longjmp(envBuf, 1);
+ return fsckBlockAbort;
+ } else {
+ return fsckBlockContinue;
+ }
+}
+
/*------------------------------------------------------------------------------
External
@@ -207,7 +223,6 @@ External
------------------------------------------------------------------------------*/
-static jmp_buf envBuf;
int
CheckHFS( const char *rdevnode, int fsReadRef, int fsWriteRef, int checkLevel,
int repairLevel, fsck_ctx_t fsckContext, int lostAndFoundMode,
@@ -222,7 +237,6 @@ CheckHFS( const char *rdevnode, int fsRe
int isJournaled = 0;
Boolean autoRepair;
Boolean exitEarly = 0;
- __block int *msgCounts = NULL;
Boolean majorErrors = 0;
if (checkLevel == kMajorCheck) {
@@ -292,16 +306,7 @@ CheckHFS( const char *rdevnode, int fsRe
* the message in question corresponds to a major or a minor error. If it's
* major, we longjmp just above, which causes us to exit out early.
*/
- fsckSetBlock(fsckContext, fsckPhaseAfterMessage, (fsckBlock_t) ^(fsck_ctx_t c, int msgNum, va_list args) {
- if (abs(msgNum) > E_FirstError && abs(msgNum) < E_LastError) {
- if (isMinorError(abs(msgNum), msgCounts) == 1)
- return fsckBlockContinue;
- longjmp(envBuf, 1);
- return fsckBlockAbort;
- } else {
- return fsckBlockContinue;
- }
- });
+ fsckSetBlock(fsckContext, fsckPhaseAfterMessage, fsckAfterCallback);
}
}
DoAgain:
--- a/fsck_hfs.tproj/fsck_messages.c
+++ b/fsck_hfs.tproj/fsck_messages.c
@@ -29,7 +29,6 @@
#include <stdarg.h>
#include <string.h>
#include <assert.h>
-#include <Block.h>
#include "fsck_messages.h"
#include "fsck_keys.h"
@@ -287,20 +286,10 @@ fsckSetBlock(fsck_ctx_t c, fsck_block_ph
if (c != NULL) {
switch (phase) {
case fsckPhaseBeforeMessage:
- if (ctx->preMessage) {
- Block_release(ctx->preMessage);
- ctx->preMessage = NULL;
- }
- if (bp)
- ctx->preMessage = (fsckBlock_t)Block_copy(bp);
+ ctx->preMessage = bp;
break;
case fsckPhaseAfterMessage:
- if (ctx->postMessage) {
- Block_release(ctx->postMessage);
- ctx->postMessage = NULL;
- }
- if (bp)
- ctx->postMessage = (fsckBlock_t)Block_copy(bp);
+ ctx->postMessage = bp;
break;
case fsckPhaseNone:
/* Just here for compiler warnings */
@@ -591,12 +580,6 @@ fsckDestroy(fsck_ctx_t c)
if (ctx->flags & cfFromFD) {
fclose(ctx->fp);
}
- if (ctx->preMessage) {
- Block_release(ctx->preMessage);
- }
- if (ctx->postMessage) {
- Block_release(ctx->postMessage);
- }
free(ctx);
return;
--- a/fsck_hfs.tproj/fsck_messages.h
+++ b/fsck_hfs.tproj/fsck_messages.h
@@ -139,7 +139,7 @@ typedef enum fsck_block_phase_type fsck_
* the third is a va_list of the arguments for the message.
*/
-typedef fsck_block_status_t (^fsckBlock_t)(fsck_ctx_t, int, va_list);
+typedef fsck_block_status_t (*fsckBlock_t)(fsck_ctx_t, int, va_list);
extern fsckBlock_t fsckGetBlock(fsck_ctx_t, fsck_block_phase_t);
extern void fsckSetBlock(fsck_ctx_t, fsck_block_phase_t, fsckBlock_t);
--- a/fsck_hfs.tproj/Makefile.lnx
+++ b/fsck_hfs.tproj/Makefile.lnx
@@ -4,7 +4,7 @@ OFILES = $(CFILES:.c=.o)
all: fsck_hfs
fsck_hfs: $(OFILES) dfalib/libdfa.a
- $(CC) $(CFLAGS) $(LDFLAGS) $(OFILES) dfalib/libdfa.a -o fsck_hfs -lBlocksRunTime -lpthread
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OFILES) dfalib/libdfa.a -o fsck_hfs -lpthread
dfalib/libdfa.a: FORCE
$(MAKE) -C dfalib -f Makefile.lnx libdfa.a
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,8 @@
VERSION=540.1.linux3
-CC := clang
-CFLAGS := -g3 -Wall -fblocks -I$(PWD)/BlocksRunTime -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"$(VERSION)\"
-LDFLAGS := -Wl,--build-id -L$(PWD)/BlocksRunTime
-SUBDIRS := BlocksRunTime newfs_hfs.tproj fsck_hfs.tproj
+CFLAGS += -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"$(VERSION)\"
+LDFLAGS := -Wl,--build-id
+SUBDIRS := newfs_hfs.tproj fsck_hfs.tproj
all clean:
for d in $(SUBDIRS); do $(MAKE) -C $$d -f Makefile.lnx $@; done

View File

@ -1,199 +0,0 @@
--- a/disklib/dump.h
+++ b/disklib/dump.h
@@ -110,9 +110,7 @@ extern long dev_bsize; /* block size of
extern int dev_bshift; /* log2(dev_bsize) */
extern int tp_bshift; /* log2(TP_BSIZE) */
-#ifndef __P
-#include <sys/cdefs.h>
-#endif
+#define __P(x) x
/* operator interface functions */
void broadcast __P((char *message));
--- a/dump.tproj/unctime.c
+++ b/dump.tproj/unctime.c
@@ -64,9 +64,7 @@
#include <string.h>
#endif
-#ifndef __P
-#include <sys/cdefs.h>
-#endif
+#define __P(x) x
/*
* Convert a ctime(3) format string into a system format date.
--- a/fdisk.tproj/getrawpartition.c
+++ b/fdisk.tproj/getrawpartition.c
@@ -59,7 +59,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getrawpartition.c,v 1.4 1999/07/02 15:49:12 simonb Exp $");
#endif
--- a/fdisk.tproj/util.h
+++ b/fdisk.tproj/util.h
@@ -59,9 +59,10 @@
#ifndef _UTIL_H_
#define _UTIL_H_
-#include <sys/cdefs.h>
#include <sys/types.h>
+#define __P(x) x
+
/*
* fparseln() specific operation flags.
*/
--- a/fsck_hfs.tproj/fsck_hfs.h
+++ b/fsck_hfs.tproj/fsck_hfs.h
@@ -24,7 +24,7 @@
#include "cache.h"
-#include <sys/cdefs.h>
+#define __P(x) x
const extern char *cdevname; /* name of device being checked */
extern char *progname;
--- a/fsck_msdos.tproj/boot.c
+++ b/fsck_msdos.tproj/boot.c
@@ -54,8 +54,6 @@
*/
-#include <sys/cdefs.h>
-
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
--- a/fsck_msdos.tproj/check.c
+++ b/fsck_msdos.tproj/check.c
@@ -54,8 +54,6 @@
*/
-#include <sys/cdefs.h>
-
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
--- a/fsck_msdos.tproj/dir.c
+++ b/fsck_msdos.tproj/dir.c
@@ -56,8 +56,6 @@
*/
-#include <sys/cdefs.h>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -109,6 +107,7 @@
#define DD_YEAR_MASK 0xFE00 /* year - 1980 */
#define DD_YEAR_SHIFT 9
+#define __P(x) x
/* dir.c */
static struct dosDirEntry *newDosDirEntry __P((void));
--- a/fsck_msdos.tproj/fat.c
+++ b/fsck_msdos.tproj/fat.c
@@ -54,8 +54,6 @@
*/
-#include <sys/cdefs.h>
-
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -67,6 +65,8 @@
#include "ext.h"
#include "fsutil.h"
+#define __P(x) x
+
/*
* The following value should be a multiple of the sector size in bytes. The
* Microsoft supported sector sizes are 512, 1024, 2048, and 4096, which means
--- a/fsck_msdos.tproj/fsutil.c
+++ b/fsck_msdos.tproj/fsutil.c
@@ -54,8 +54,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -74,6 +72,8 @@
#include "ext.h"
#include "fsutil.h"
+#define __P(x) x
+
static const char *dev = NULL;
static int hot = 0;
/*static int preen = 0;*/
--- a/fsck_msdos.tproj/main.c
+++ b/fsck_msdos.tproj/main.c
@@ -54,8 +54,6 @@
*/
-#include <sys/cdefs.h>
-
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -68,6 +66,8 @@
#include <varargs.h>
#endif
+#define __P(x) x
+
#include "fsutil.h"
#include "ext.h"
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -28,7 +28,6 @@
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
@@ -80,6 +79,7 @@ extern Boolean _CFStringGetFileSystemRep
#define kJournalFileType 0x6a726e6c /* 'jrnl' */
+#define __P(x) x
typedef HFSMasterDirectoryBlock HFS_MDB;
--- a/newfs_hfs.tproj/newfs_hfs.c
+++ b/newfs_hfs.tproj/newfs_hfs.c
@@ -34,7 +34,6 @@
#include <syslog.h>
#include <unistd.h>
-#include <sys/cdefs.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/param.h>
@@ -62,6 +61,8 @@
#define ROUNDUP(x,y) (((x)+(y)-1)/(y)*(y))
+#define __P(x) x
+
static void getnodeopts __P((char* optlist));
static void getclumpopts __P((char* optlist));
static gid_t a_gid __P((char *));

View File

@ -0,0 +1,44 @@
--- a/fsck_hfs.tproj/dfalib/Scavenger.h
+++ b/fsck_hfs.tproj/dfalib/Scavenger.h
@@ -48,7 +48,7 @@
#endif
#include <sys/errno.h>
#include <sys/param.h>
-#include <sys/sysctl.h>
+#include <linux/sysctl.h>
#include <sys/mount.h>
#include <hfs/hfs_mount.h>
--- a/fsck_hfs.tproj/fsck_hfs.c
+++ b/fsck_hfs.tproj/fsck_hfs.c
@@ -30,7 +30,7 @@
#include <sys/ioctl.h>
#if !LINUX
#include <sys/disk.h>
-#include <sys/sysctl.h>
+#include <linux/sysctl.h>
#include <setjmp.h>
#endif
#include <hfs/hfs_mount.h>
--- a/fsck_hfs.tproj/utilities.c
+++ b/fsck_hfs.tproj/utilities.c
@@ -70,7 +70,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/sysctl.h>
+#include <linux/sysctl.h>
#include "fsck_hfs.h"
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -38,7 +38,7 @@
#endif
#include <sys/errno.h>
#include <sys/stat.h>
-#include <sys/sysctl.h>
+#include <linux/sysctl.h>
#if !LINUX
#include <sys/vmmeter.h>
#endif

View File

@ -0,0 +1,43 @@
--- a/fsck_hfs.tproj/cache.h
+++ b/fsck_hfs.tproj/cache.h
@@ -29,6 +29,7 @@
#ifndef _CACHE_H_
#define _CACHE_H_
#include <stdint.h>
+#include <sys/types.h>
/* Different values for initializing cache */
enum {
--- a/fsck_hfs.tproj/dfalib/Scavenger.h
+++ b/fsck_hfs.tproj/dfalib/Scavenger.h
@@ -46,7 +46,7 @@
#include <sys/kauth.h>
#include <sys/syslimits.h>
#endif
-#include <sys/errno.h>
+#include <errno.h>
#include <sys/param.h>
#include <linux/sysctl.h>
#include <sys/mount.h>
--- a/fsck_hfs.tproj/utilities.c
+++ b/fsck_hfs.tproj/utilities.c
@@ -55,7 +55,7 @@
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/errno.h>
+#include <errno.h>
#if LINUX
#include <limits.h>
#include <signal.h>
--- a/newfs_hfs.tproj/makehfs.c
+++ b/newfs_hfs.tproj/makehfs.c
@@ -36,7 +36,7 @@
#include <time.h>
#include "missing.h"
#endif
-#include <sys/errno.h>
+#include <errno.h>
#include <sys/stat.h>
#include <linux/sysctl.h>
#if !LINUX

View File

@ -0,0 +1,11 @@
--- a/fsck_hfs.tproj/dfalib/Makefile.lnx
+++ b/fsck_hfs.tproj/dfalib/Makefile.lnx
@@ -9,7 +9,7 @@ CFILES = hfs_endian.c BlockCache.c\
OFILES = $(CFILES:.c=.o)
libdfa.a: $(OFILES)
- ar rc $@ $?
+ $(AR) rc $@ $?
clean:
$(RM) $(OFILES) libdfa.a