Adds supports for hfsprogs, allowing the creation and verification of HFS/HFS+ filesystems. This creates two selectable packages: - hfsfsck - mkhfs A filesystem checking script is included with hfsfsck to allow OpenWrt to check/repair filesystem errors. Using Ubuntu's 332.25 sources plus their patches from debian/patches/. Signed-off-by: Florian Fainelli <florian@openwrt.org>lilik-openwrt-22.03
@ -0,0 +1,81 @@ | |||
# | |||
# Copyright (C) 2015 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=hfsprogs | |||
PKG_VERSION:=332.25 | |||
PKG_RELEASE:=1 | |||
PKG_LICENSE:=GPL-3.0+ | |||
PKG_LICENSE_FILES:=COPYING | |||
PKG_MAINTAINER:=Florian Fainelli <florian@openwrt.org> | |||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz | |||
PKG_SOURCE_URL:=http://archive.ubuntu.com/ubuntu/pool/universe/h/$(PKG_NAME) | |||
PKG_BUILD_DIR:=$(BUILD_DIR)/diskdev_cmds-$(PKG_VERSION) | |||
PKG_MD5SUM:=261c3de5ec0dcf5244e3f60d79c1d6f1 | |||
PKG_LICENSE:=APSL 2.0 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
define Package/hfsprogs/Default | |||
SECTION:=utils | |||
CATEGORY:=Utilities | |||
SUBMENU:=Filesystem | |||
DEPENDS:=+libopenssl | |||
endef | |||
define Package/hfsfsck | |||
$(call Package/hfsprogs/Default) | |||
TITLE:=fsck (fsck.hfs) utility from hfsprogs | |||
endef | |||
define Package/mkhfs | |||
$(call Package/hfsprogs/Default) | |||
TITLE:=mkfs (mkfs.hfs) utility from hfsprogs | |||
endef | |||
define Package/hfsfsck/description | |||
Utilities to create and check HFS/HFS+ filesystems. | |||
(fsck.hfs and fsck.hfsplus for checking integrity of HFS/HFS+ volumes) | |||
endef | |||
define Package/mkhfs/description | |||
Utilities to create and check HFS/HFS+ filesystems. | |||
(mkfs.hfs and mkfs.hfsplus for creating HFS/HFS+ volumes) | |||
endef | |||
define Build/Configure | |||
endef | |||
define Build/Compile | |||
$(MAKE) -C $(PKG_BUILD_DIR) \ | |||
-f Makefile.lnx \ | |||
$(TARGET_CONFIGURE_OPTS) \ | |||
CFLAGS+="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1" \ | |||
all | |||
endef | |||
define Package/hfsfsck/install | |||
$(INSTALL_DIR) $(1)/lib/functions/fsck | |||
$(INSTALL_DATA) ./files/hfsfsck.sh $(1)/lib/functions/fsck/ | |||
$(INSTALL_DIR) $(1)/usr/sbin | |||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fsck_hfs.tproj/fsck_hfs $(1)/usr/sbin/fsck.hfsplus | |||
(cd $(1)/usr/sbin; ln -sf fsck.hfsplus fsck.hfs;) | |||
endef | |||
define Package/mkhfs/install | |||
$(INSTALL_DIR) $(1)/usr/sbin | |||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/newfs_hfs.tproj/newfs_hfs $(1)/usr/sbin/mkfs.hfsplus | |||
(cd $(1)/usr/sbin; ln -sf mkfs.hfsplus mkfs.hfs;) | |||
endef | |||
$(eval $(call BuildPackage,hfsfsck)) | |||
$(eval $(call BuildPackage,mkhfs)) |
@ -0,0 +1,30 @@ | |||
#!/bin/sh | |||
# Copyright 2015 OpenWrt.org | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
fsck_hfsfsck() { | |||
hfsfsck "$device" 2>&1 | logger -t "fstab: hfsfsck ($device)" | |||
local status="$?" | |||
case "$status" in | |||
0) ;; #success | |||
4) reboot;; | |||
8) echo "hfsfsck ($device): Warning! Uncorrected errors."| logger -t fstab | |||
return 1 | |||
;; | |||
*) echo "hfsfsck ($device): Error $status. Check not complete."| logger -t fstab;; | |||
esac | |||
return 0 | |||
} | |||
fsck_hfs() { | |||
fsck_hfsfsck "$@" | |||
} | |||
fsck_hfsplus() { | |||
fsck_hfsfsck "$@" | |||
} | |||
append libmount_known_fsck "hfs" | |||
append libmount_known_fsck "hfsplus" |
@ -0,0 +1,93 @@ | |||
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 | |||
diff --git a/Makefile.lnx b/Makefile.lnx | |||
new file mode 100644 | |||
index 0000000..687d1e7 | |||
--- /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 | |||
diff --git a/fsck_hfs.tproj/Makefile.lnx b/fsck_hfs.tproj/Makefile.lnx | |||
new file mode 100644 | |||
index 0000000..977d7e8 | |||
--- /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 | |||
diff --git a/fsck_hfs.tproj/dfalib/Makefile.lnx b/fsck_hfs.tproj/dfalib/Makefile.lnx | |||
new file mode 100644 | |||
index 0000000..8c07196 | |||
--- /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 | |||
diff --git a/newfs_hfs.tproj/Makefile.lnx b/newfs_hfs.tproj/Makefile.lnx | |||
new file mode 100644 | |||
index 0000000..58e6700 | |||
--- /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 |
@ -0,0 +1,131 @@ | |||
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(-) | |||
diff --git a/fsck_hfs.tproj/dfalib/BTreePrivate.h b/fsck_hfs.tproj/dfalib/BTreePrivate.h | |||
index 058c75b..2fc2f28 100644 | |||
--- 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 { // fields specific to BTree CBs | |||
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; | |||
diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c | |||
index 37eb242..4ce9e16 100644 | |||
--- 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; | |||
} | |||
} | |||
} | |||
diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c | |||
index c272d4d..a273bf3 100644 | |||
--- a/fsck_hfs.tproj/dfalib/SVerify1.c | |||
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c | |||
@@ -789,8 +789,8 @@ OSErr CreateExtentsBTreeControlBlock( SGlobPtr GPtr ) | |||
// | |||
// 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( SGlobPtr GPtr ) | |||
// 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( SGlobPtr GPtr ) | |||
// | |||
// 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( SGlobPtr GPtr ) | |||
} | |||
else | |||
{ | |||
- if ( btcb->refCon == (UInt32)nil ) { | |||
+ if ( btcb->refCon == nil ) { | |||
err = R_NoMem; | |||
goto exit; | |||
} | |||
diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.c b/fsck_hfs.tproj/dfalib/hfs_endian.c | |||
index 69500c1..3cc9eb4 100755 | |||
--- 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) { |
@ -0,0 +1,291 @@ | |||
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(-) | |||
diff --git a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c | |||
index b812b14..37fb170 100644 | |||
--- a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c | |||
+++ b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c | |||
@@ -223,7 +223,7 @@ OSStatus SearchTree (BTreeControlBlockPtr btreePtr, | |||
// | |||
if (curNodeNum == 0) | |||
{ | |||
-// Panic("\pSearchTree: curNodeNum is zero!"); | |||
+ Panic("SearchTree: curNodeNum is zero!"); | |||
err = fsBTInvalidNodeErr; | |||
goto ErrorExit; | |||
} | |||
@@ -433,7 +433,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
secondaryKey = nil; | |||
- PanicIf ( (level == btreePtr->treeDepth), "\p InsertLevel: unfinished insert!?"); | |||
+ PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?"); | |||
++level; | |||
@@ -456,7 +456,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
{ | |||
//¥¥Ê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 (BTreeControlBlockPtr btreePtr, | |||
*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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
//¥¥Ê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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
} | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
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 (BTreeControlBlockPtr btreePtr, | |||
keyPtr, keyLength, recPtr, recSize); | |||
if ( !didItFit ) | |||
{ | |||
- Panic ("\pRotateRight: InsertKeyRecord (right) returned false!"); | |||
+ Panic ("RotateRight: InsertKeyRecord (right) returned false!"); | |||
err = fsBTBadRotateErr; | |||
goto ErrorExit; | |||
} | |||
diff --git a/fsck_hfs.tproj/dfalib/SBTree.c b/fsck_hfs.tproj/dfalib/SBTree.c | |||
index cd81b13..eeb4e8c 100644 | |||
--- a/fsck_hfs.tproj/dfalib/SBTree.c | |||
+++ b/fsck_hfs.tproj/dfalib/SBTree.c | |||
@@ -103,7 +103,7 @@ OSErr SearchBTreeRecord(SFCB *fcb, const void* key, UInt32 hint, void* foundKey, | |||
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 selectionIndex, void* key, void* data, UI | |||
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 void* key, const void* data, UInt16 dat | |||
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, const void* key, UInt32 hint, void *newData, | |||
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 minEOF, FSSize maxEOF ) | |||
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 minEOF, FSSize maxEOF ) | |||
// 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 BTreeKey *key, const BTreeControlBlock *btcb) | |||
if ( (keyLen < 6) || (keyLen > btcb->maxKeyLength) ) | |||
{ | |||
if ( DEBUG_BUILD ) | |||
- DebugStr("\pCheckBTreeKey: bad key length!"); | |||
+ DebugStr("CheckBTreeKey: bad key length!"); | |||
return fsBTInvalidKeyLengthErr; | |||
} | |||
@ -0,0 +1,37 @@ | |||
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(-) | |||
diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c | |||
index 4ce9e16..8b03ece 100644 | |||
--- 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 ); | |||
diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.c b/fsck_hfs.tproj/dfalib/hfs_endian.c | |||
index 3cc9eb4..6ca2ac1 100755 | |||
--- 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); |
@ -0,0 +1,23 @@ | |||
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br> | |||
Date: Thu, 24 Oct 2013 01:11:21 -0200 | |||
Subject: Fix path for HFS wrapper block | |||
Fix the installation of the HFS wrapper block to be compliant in Linux | |||
systems (since it is arch independent). | |||
--- | |||
newfs_hfs.tproj/makehfs.c | 2 +- | |||
1 file changed, 1 insertion(+), 1 deletion(-) | |||
diff --git a/newfs_hfs.tproj/makehfs.c b/newfs_hfs.tproj/makehfs.c | |||
index 7609779..2233ef7 100644 | |||
--- a/newfs_hfs.tproj/makehfs.c | |||
+++ b/newfs_hfs.tproj/makehfs.c | |||
@@ -70,7 +70,7 @@ extern Boolean _CFStringGetFileSystemRepresentation(CFStringRef string, UInt8 *b | |||
#include "readme.h" | |||
-#define HFS_BOOT_DATA "/usr/share/misc/hfsbootdata" | |||
+#define HFS_BOOT_DATA "/usr/share/hfsprogs/hfsbootdata" | |||
#define HFS_JOURNAL_FILE ".journal" | |||
#define HFS_JOURNAL_INFO ".journal_info_block" |
@ -0,0 +1,40 @@ | |||
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(-) | |||
diff --git a/fsck_hfs.tproj/fsck_hfs.c b/fsck_hfs.tproj/fsck_hfs.c | |||
index f1a18bd..6117698 100644 | |||
--- 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"); |
@ -0,0 +1,187 @@ | |||
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(-) | |||
diff --git a/fsck_hfs.tproj/dfalib/SRepair.c b/fsck_hfs.tproj/dfalib/SRepair.c | |||
index 8eb759c..89c12d6 100644 | |||
--- a/fsck_hfs.tproj/dfalib/SRepair.c | |||
+++ b/fsck_hfs.tproj/dfalib/SRepair.c | |||
@@ -1825,13 +1825,13 @@ static OSErr FixAttrSize(SGlobPtr GPtr, RepairOrderPtr p) | |||
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, RepairOrderPtr p) | |||
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, ExtentInfo *extentInfo) | |||
&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, ExtentInfo *extentInfo) | |||
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, ExtentInfo *extentInfo) | |||
} | |||
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(SGlobPtr GPtr, ExtentInfo *extentInfo, | |||
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; | |||
} | |||
diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c | |||
index a273bf3..39bda5c 100644 | |||
--- a/fsck_hfs.tproj/dfalib/SVerify1.c | |||
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c | |||
@@ -2157,9 +2157,9 @@ CheckAttributeRecord(SGlobPtr GPtr, const HFSPlusAttrKey *key, const HFSPlusAttr | |||
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, UInt32 fileNumber, UInt8 forkType, | |||
// 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) || | |||
diff --git a/fsck_hfs.tproj/fsck_debug.c b/fsck_hfs.tproj/fsck_debug.c | |||
index 1be3fc5..77e8e51 100644 | |||
--- 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; | |||
diff --git a/fsck_hfs.tproj/fsck_debug.h b/fsck_hfs.tproj/fsck_debug.h | |||
index 81e3932..cb1b9be 100644 | |||
--- 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__ */ |
@ -0,0 +1,71 @@ | |||
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(-) | |||
diff --git a/fsck_hfs.tproj/cache.c b/fsck_hfs.tproj/cache.c | |||
index 527088a..540fa0b 100644 | |||
--- a/fsck_hfs.tproj/cache.c | |||
+++ b/fsck_hfs.tproj/cache.c | |||
@@ -961,20 +961,21 @@ int CacheLookup (Cache_t *cache, uint64_t off, Tag_t **tag) | |||
*/ | |||
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_t off, uint32_t len, void *buf) | |||
*/ | |||
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++; |
@ -0,0 +1,50 @@ | |||
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(-) | |||
diff --git a/include/missing.h b/include/missing.h | |||
index 0a859c4..f50e8fb 100644 | |||
--- a/include/missing.h | |||
+++ b/include/missing.h | |||
@@ -72,7 +72,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) | |||
@@ -88,6 +88,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 | |||
@@ -102,6 +105,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 |
@ -0,0 +1,157 @@ | |||
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(-) | |||
diff --git a/fsck_hfs.tproj/fsck_hfs.8 b/fsck_hfs.tproj/fsck_hfs.8 | |||
index aec9949..0bc804d 100644 | |||
--- 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 systems. | |||
.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 file and if there is no damage | |||
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 | |||
diff --git a/newfs_hfs.tproj/newfs_hfs.8 b/newfs_hfs.tproj/newfs_hfs.8 | |||
index d002cc9..fe91962 100644 | |||
--- 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 directory to | |||
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 |
@ -0,0 +1,15 @@ | |||
--- diskdev_cmds-332.25/newfs_hfs.tproj/makehfs.c 2015-03-27 21:58:04.163171675 -0700 | |||
+++ hfsprogs-332.25/newfs_hfs.tproj/makehfs.c 2015-03-27 21:56:03.687175020 -0700 | |||
@@ -2119,10 +2119,12 @@ | |||
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 |