Skip to content
Snippets Groups Projects
Verified Commit 9e44b83b authored by Anna Wilcox's avatar Anna Wilcox :fox:
Browse files

user/diskdev_cmds: add 1985 Apple C code to our modern Linux distro

parent 00814ce3
No related branches found
No related tags found
No related merge requests found
# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=diskdev_cmds
pkgver=332.14
pkgrel=0
pkgdesc="HFS+ utilities ported from OS X 10.8.4 (fsck/mkfs)"
url="https://opensource.apple.com/release/mac-os-x-10411ppc.html"
arch="all"
license="APSL-2.0"
depends=""
makedepends="bsd-compat-headers openssl-dev"
install=""
options="!check"
subpackages="$pkgname-doc"
source="https://opensource.apple.com/tarballs/diskdev_cmds/diskdev_cmds-$pkgver.tar.gz
linux.patch
musl.patch
"
builddir="$srcdir/diskdev_cmds-$pkgver"
build() {
cd "$builddir"
make -f Makefile.lnx
}
package() {
cd "$builddir"
install -D -m755 "$builddir"/fsck_hfs.tproj/fsck_hfs "$pkgdir"/sbin/fsck_hfs
install -m755 "$builddir"/newfs_hfs.tproj/newfs_hfs "$pkgdir"/sbin/newfs_hfs
ln -s fsck_hfs "$pkgdir"/sbin/fsck.hfs
ln -s fsck_hfs "$pkgdir"/sbin/fsck.hfsplus
ln -s newfs_hfs "$pkgdir"/sbin/mkfs.hfs
ln -s newfs_hfs "$pkgdir"/sbin/mkfs.hfsplus
install -D -m644 "$builddir"/fsck_hfs.tproj/fsck_hfs.8 "$pkgdir"/usr/share/man/man8/fsck_hfs.8
ln -s fsck_hfs.8 "$pkgdir"/usr/share/man/man8/fsck.hfs.8
ln -s fsck_hfs.8 "$pkgdir"/usr/share/man/man8/fsck.hfsplus.8
install -m644 "$builddir"/newfs_hfs.tproj/newfs_hfs.8 "$pkgdir"/usr/share/man/man8/newfs_hfs.8
ln -s newfs_hfs.8 "$pkgdir"/usr/share/man/man8/mkfs.hfs.8
ln -s newfs_hfs.8 "$pkgdir"/usr/share/man/man8/mkfs.hfsplus.8
}
sha512sums="e1df91fb5330dc01a79de99dd8b1f389a337a19c2136994d59b7cbca9c2e1cb5f7d47101366dd01db4e23a5d3d7afab41758045bf7402d739fa22182dc922044 diskdev_cmds-332.14.tar.gz
bd736c087291024d352d7e3379069f440cf1af6abbcb236499a00c6a756c1b2b3c36e61a13d08e8db7319654b9cb1c04574a4dbda79cedeceb32660708900da9 linux.patch
0b6280e20b0e8d2e453505866af2f1423a4f0172de2e5a6b14feb82df3c659270d9af0320a098e41d405e5cf9111852926e8a4eb5bea1604c262b126917f442f musl.patch"
This diff is collapsed.
--- 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 <sys/param.h>
#include <sys/stat.h>
#if LINUX
+#include <sys/cdefs.h>
#include <time.h>
#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 <sys/types.h>
#include <sys/time.h>
#if LINUX
+#include <sys/cdefs.h>
#include <time.h>
#include "missing.h"
#endif
#include <sys/errno.h>
#include <sys/stat.h>
-#include <sys/sysctl.h>
#if !LINUX
#include <sys/vmmeter.h>
+#include <sys/sysctl.h>
#endif
#include <err.h>
--- 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 <sys/cdefs.h>
#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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment