mirror of
https://github.com/openwrt/packages.git
synced 2026-01-10 11:44:48 +00:00
hfsprogs: initial import
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>
This commit is contained in:
187
utils/hfsprogs/patches/0009-Rename-dprintf-to-dbg_printf.patch
Normal file
187
utils/hfsprogs/patches/0009-Rename-dprintf-to-dbg_printf.patch
Normal file
@@ -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__ */
|
||||
Reference in New Issue
Block a user