From 9e44b83b0c4963e2e5b3600c6592a64fb3d96d91 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 21 Aug 2017 19:52:15 -0500 Subject: user/diskdev_cmds: add 1985 Apple C code to our modern Linux distro --- user/diskdev_cmds/musl.patch | 188 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 user/diskdev_cmds/musl.patch (limited to 'user/diskdev_cmds/musl.patch') diff --git a/user/diskdev_cmds/musl.patch b/user/diskdev_cmds/musl.patch new file mode 100644 index 000000000..f5977a20b --- /dev/null +++ b/user/diskdev_cmds/musl.patch @@ -0,0 +1,188 @@ +--- diskdev_cmds-332.14/newfs_hfs.tproj/newfs_hfs.c.old 2017-01-22 02:17:05.677956396 +0100 ++++ diskdev_cmds-332.14/newfs_hfs.tproj/newfs_hfs.c 2017-01-22 02:37:37.415539705 +0100 +@@ -39,6 +39,7 @@ + #include + #include + #if LINUX ++#include + #include + #endif + +--- diskdev_cmds-332.14/newfs_hfs.tproj/makehfs.c.old 2017-01-22 02:17:05.677956396 +0100 ++++ diskdev_cmds-332.14/newfs_hfs.tproj/makehfs.c 2017-01-22 02:36:51.065627226 +0100 +@@ -32,14 +32,15 @@ + #include + #include + #if LINUX ++#include + #include + #include "missing.h" + #endif + #include + #include +-#include + #if !LINUX + #include ++#include + #endif + + #include +--- diskdev_cmds-332.14/fsck_hfs.tproj/fsck_hfs.h.old 2006-02-20 22:45:15.000000000 +0100 ++++ diskdev_cmds-332.14/fsck_hfs.tproj/fsck_hfs.h 2017-01-22 02:28:49.256503270 +0100 +@@ -22,6 +22,7 @@ + * @APPLE_LICENSE_HEADER_END@ + */ + ++#include + #include "cache.h" + + +--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/CatalogCheck.c.old 2006-02-20 22:45:15.000000000 +0100 ++++ diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/CatalogCheck.c 2017-01-22 02:32:45.319415260 +0100 +@@ -64,7 +64,7 @@ + static void CheckBSDInfo(const HFSPlusCatalogKey * key, const HFSPlusBSDInfo * bsdInfo, int isdir); + static int CheckCatalogName(u_int16_t charCount, const u_int16_t *uniChars, + u_int32_t parentID, Boolean thread); +-static int CheckCatalogName_HFS(u_int16_t charCount, const u_char *filename, ++static int CheckCatalogName_HFS(u_int16_t charCount, const UInt8 *filename, + u_int32_t parentID, Boolean thread); + + static int RecordBadAllocation(UInt32 parID, unsigned char * filename, UInt32 forkType, UInt32 oldBlkCnt, UInt32 newBlkCnt); +@@ -951,9 +951,9 @@ + * if repairable then log the error and create a repair order + */ + static int +-CheckCatalogName_HFS(u_int16_t charCount, const u_char *filename, u_int32_t parentID, Boolean thread) ++CheckCatalogName_HFS(u_int16_t charCount, const UInt8 *filename, u_int32_t parentID, Boolean thread) + { +- u_char * myPtr; ++ UInt8 * myPtr; + RepairOrderPtr roPtr; + int myLength; + CatalogName newName; +@@ -997,7 +997,7 @@ + if ( roPtr == NULL ) + return( noErr ); + +- myPtr = (u_char *)&roPtr->name[0]; ++ myPtr = (UInt8 *)&roPtr->name[0]; + *myPtr++ = charCount; // copy in length of old name and bump past it + CopyMemory( filename, myPtr, charCount ); + myPtr += charCount; // bump past old name +@@ -1030,15 +1030,15 @@ + Boolean isSingleDotName, + Boolean isHFSPlus ) + { +- u_char newChar; ++ UInt8 newChar; + OSErr result; + int nameLen; + UInt16 recSize; + SFCB * fcbPtr; +- u_char * myPtr; ++ UInt8 * myPtr; + CatalogRecord record; + CatalogKey catKey; +- u_char dotName[] = {'d', 'o', 't', 'd', 'o', 't', 0x0d, 0x00}; ++ UInt8 dotName[] = {'d', 'o', 't', 'd', 'o', 't', 0x0d, 0x00}; + + fcbPtr = GPtr->calculatedCatalogFCB; + +--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRepair.c.old 2017-01-22 02:17:05.674623072 +0100 ++++ diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRepair.c 2017-01-22 02:32:58.596057772 +0100 +@@ -92,11 +92,11 @@ + + /* Functions to copy disk blocks or data buffer to disk */ + static OSErr CopyDiskBlocks(SGlobPtr GPtr, const UInt32 startAllocationBlock, const UInt32 blockCount, const UInt32 newStartAllocationBlock ); +-static OSErr WriteDiskBlocks(SGlobPtr GPtr, UInt32 startBlock, UInt32 blockCount, u_char *buffer, int buflen); ++static OSErr WriteDiskBlocks(SGlobPtr GPtr, UInt32 startBlock, UInt32 blockCount, UInt8 *buffer, int buflen); + + /* Functions to create file and directory by name */ +-static OSErr CreateFileByName(SGlobPtr GPtr, UInt32 parentID, UInt16 fileType, u_char *fileName, unsigned int filenameLen, u_char *data, unsigned int dataLen); +-static UInt32 CreateDirByName(SGlob *GPtr , const u_char *dirName, const UInt32 parentID); ++static OSErr CreateFileByName(SGlobPtr GPtr, UInt32 parentID, UInt16 fileType, UInt8 *fileName, unsigned int filenameLen, UInt8 *data, unsigned int dataLen); ++static UInt32 CreateDirByName(SGlob *GPtr , const UInt8 *dirName, const UInt32 parentID); + + static int BuildFolderRec( u_int16_t theMode, UInt32 theObjID, Boolean isHFSPlus, CatalogRecord * theRecPtr ); + static int BuildThreadRec( CatalogKey * theKeyPtr, CatalogRecord * theRecPtr, Boolean isHFSPlus, Boolean isDirectory ); +@@ -1222,7 +1222,7 @@ + else + { + int myLength; +- u_char * myPtr = (u_char *) oldNamePtr; ++ UInt8 * myPtr = (UInt8 *) oldNamePtr; + myLength = *myPtr; // get length of old name + myPtr += (1 + myLength); // bump past length of old name and old name + newNamePtr = (CatalogName *) myPtr; +@@ -2651,7 +2651,7 @@ + } + + /* Lookup or create damagedFiles directory */ +- damagedDirID = CreateDirByName(GPtr, (u_char *)"DamagedFiles", kHFSRootFolderID); ++ damagedDirID = CreateDirByName(GPtr, (UInt8 *)"DamagedFiles", kHFSRootFolderID); + if (damagedDirID == 0) { + status |= S_SYMCREATE; + #if DEBUG_OVERLAP +@@ -3012,8 +3012,8 @@ + } + + /* Create new file */ +- err = CreateFileByName (GPtr, targetParentID, fileType, (u_char *)filename, +- filenamelen, (u_char *)data, datalen); ++ err = CreateFileByName (GPtr, targetParentID, fileType, (UInt8 *)filename, ++ filenamelen, (UInt8 *)data, datalen); + /* Mask error if file already exists */ + if (err == EEXIST) { + err = noErr; +@@ -3544,7 +3544,7 @@ + struct fsPathString *listHeadPtr = NULL; + struct fsPathString *listTailPtr = NULL; + struct fsPathString *curPtr = NULL; +- u_char *filename = NULL; ++ UInt8 *filename = NULL; + size_t namelen; + + if (!fullPath && !fileName) { +@@ -3832,13 +3832,13 @@ + * returns zero on success, non-zero on failure. + * memFullErr - Not enough memory + */ +-OSErr WriteDiskBlocks(SGlobPtr GPtr, UInt32 startBlock, UInt32 blockCount, u_char *buffer, int bufLen) ++OSErr WriteDiskBlocks(SGlobPtr GPtr, UInt32 startBlock, UInt32 blockCount, UInt8 *buffer, int bufLen) + { + OSErr err = noErr; + int i; + SVCB *vcb; + int drive; +- u_char *dataBuffer; ++ UInt8 *dataBuffer; + UInt32 sectorsPerBlock; + UInt32 sectorsInBuffer; + UInt32 ioReqCount; +@@ -3959,7 +3959,7 @@ + if ( mtp->thread.parentID == 0 ) { + char myString[32]; + if ( lostAndFoundDirID == 0 ) +- lostAndFoundDirID = CreateDirByName( GPtr , (u_char *)"lost+found", kHFSRootFolderID); ++ lostAndFoundDirID = CreateDirByName( GPtr , (UInt8 *)"lost+found", kHFSRootFolderID); + if ( lostAndFoundDirID == 0 ) { + if ( GPtr->logLevel >= kDebugLog ) + printf( "\tCould not create lost+found directory \n" ); +@@ -4144,7 +4144,7 @@ + * memFullErr - Not enough memory + * paramErr - Invalid paramter + */ +-OSErr CreateFileByName(SGlobPtr GPtr, UInt32 parentID, UInt16 fileType, u_char *fileName, unsigned int filenameLen, u_char *data, unsigned int dataLen) ++OSErr CreateFileByName(SGlobPtr GPtr, UInt32 parentID, UInt16 fileType, UInt8 *fileName, unsigned int filenameLen, UInt8 *data, unsigned int dataLen) + { + OSErr err = noErr; + Boolean isHFSPlus; +@@ -4378,7 +4378,7 @@ + * on failure, zero. + * + */ +-UInt32 CreateDirByName(SGlob *GPtr , const u_char *dirName, const UInt32 parentID) ++UInt32 CreateDirByName(SGlob *GPtr , const UInt8 *dirName, const UInt32 parentID) + { + Boolean isHFSPlus; + UInt16 recSize; -- cgit v1.2.3-70-g09d2