fsck_hfs on PPC???
Update:
I think I've got Apple's fsck_hfs working now on PPC, with Roman Zippel's new Linux patch and two additional patches I worked up (see attached e-mail message):
gwiz# fsck_hfs /dev/hda9
** /dev/hda9
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
** The volume gwiz appears to be OK.
-Bill
Begin forwarded message:
Date: Sat, 5 Jul 2003 03:59:59 -0400
From: Bill Fink <[email protected]>
To: Roman Zippel <[email protected]>
Subject: Re: fsck_hfs on PPC???
Hi again,
Quoted 10 lines · Roman Zippel
Quoted 7 lines · Bill Fink
I was trying to use your Linux patch for Apple's
fsck_hfson a PPC system and not having much luck, so I was wondering if you might have any ideas. The attached message to linuxppc-dev gives the details. Basically I was able to get it to build OK with an additional patch (included in the attached message) but runningfsck_hfsdoesn't appear to do anything. I have a similar patch fornewfs_hfsbut I haven't even tried to use that.
Quoted 2 lines
I've updated the patch at http://www.ardistech.com/hfsplus/diskdev_cmds.diff.gz
It should fix these problems, could you give it a try?
I think I've got it working now with the two additional attached patches (to fsck_hfs.tproj/dfalib/HardLinkCheck.c and fsck_hfs.tproj/dfalib/SDevice.c):
gwiz# fsck_hfs /dev/hda9
** /dev/hda9
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking Catalog hierarchy.
** Checking volume bitmap.
** Checking volume information.
** The volume gwiz appears to be OK.
I haven't tried messing with newfs_hfs yet, so I don't know if it would have similar issues.
-Thanks
-Bill
dfalib/.mod/HardLinkCheck.c renamed from dfalib/.orig/HardLinkCheck.c +6 -0
@@ -45,10 +45,16 @@#define _U2 (v) { .u32 = ((((v) & 0xff000000) >> 24) | (((v) & 0xff0000) >> 8) | \ (((v) & 0xff00) << 8) | (((v) & 0xff) << 24)) }#else +#ifdef __BIG_ENDIAN__ +#define _U (v) (v) +#define _U2 (v) (v) + +#else #define _U (v) ((((v) >> 8) & 0xff) | (((v) & 0xff) << 8))#define _U2 (v) ((((v) & 0xff000000) >> 24) | (((v) & 0xff0000) >> 8) | \ (((v) & 0xff00) << 8) | (((v) & 0xff) << 24))#endif +#endif HFSPlusCatalogKey gMetaDataDirKey = {_U (48 ),/* key length */
dfalib/.mod/SDevice.c renamed from dfalib/.orig/SDevice.c +30 -0
@@ -29,6 +29,11 @@#include <errno.h> #include <sys/ioctl.h> +#if __linux__ +#include <linux/fs.h> +#include <stdio.h> +#endif +#if __APPLE__#include <IOKit/storage/IOMediaBSDClient.h> #else
@@ -71,6 +76,12 @@return (0 );#else struct stat statb; +#ifdef __linux__ +FILE *fp; +char partline[80 +2 ]; +int partmajor, partminor; +unsigned long long partn1kblocks; +#endif if (fstat (driveRefNum , &statb) <0 ) {return (-1 ); }
@@ -79,6 +90,25 @@ *blockSize =512 ; return 0; } +if (S_ISBLK (statb.st_mode)) { +#ifdef __linux__ + fp =fopen ("/proc/partitions" ,"r" ); +if (fp) { +while (fgets (partline,80 , fp)) { +sscanf (partline,"%d %d %lld" , &partmajor, + &partminor, &partn1kblocks); +if ((partmajor ==MAJOR (statb.st_rdev)) && + (partminor ==MINOR (statb.st_rdev))) { + *numBlocks = partn1kblocks *2 ; + *blockSize =512 ; +fclose (fp); +return 0 ; + } + } +fclose (fp); + } +#endif + }return (-1 );#endif #else
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/