amiga-fdisk-0.04.orig/0040755000175000017500000000000006617464055014161 5ustar lutherlutheramiga-fdisk-0.04.orig/include/0040755000175000017500000000000006617464005015577 5ustar lutherlutheramiga-fdisk-0.04.orig/include/amigastuff.h0100644000175000017500000000276206617464005020102 0ustar lutherluther/* amiga-fdisk - Amiga RDB Fdisk for Linux * amigastuff.h part - function includes * written in 1996 by Stefan Reinauer * * Copyright (C) 1996-1998 by Stefan Reinauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA */ int get_rdb(void); int partition_new(int nr); int partition_delete (int nr); int partition_togglebootable(int nr); int partition_togglenomount(int nr); int partition_locyl(int nr,int cyl); int partition_hicyl(int nr,int cyl); int partition_bootpri(int nr,int pri); int partition_bootblk(int nr,int blks); int partition_dostype(int nr, ULONG dostype); int rigiddisk_reorg(int startblk); int rigiddisk_save(void); int rigiddisk_show(void); int partition_show(void); int quitall(void); int room_for_partition(void); #ifdef DEBUG int pt(void); #endif extern int firstblock; amiga-fdisk-0.04.orig/include/amiga/0040755000175000017500000000000006617464005016655 5ustar lutherlutheramiga-fdisk-0.04.orig/include/amiga/filehandler.h0100600000175000017500000000557706617464005021306 0ustar lutherlutherstruct DosEnvec { ULONG de_TableSize; /* Size of Environment vector */ ULONG de_SizeBlock; /* in longwords: standard value is 128 */ ULONG de_SecOrg; /* not used; must be 0 */ ULONG de_Surfaces; /* # of heads (surfaces). drive specific */ ULONG de_SectorPerBlock; /* not used; must be 1 */ ULONG de_BlocksPerTrack; /* blocks per track. drive specific */ ULONG de_Reserved; /* DOS reserved blocks at start of partition. */ ULONG de_PreAlloc; /* DOS reserved blocks at end of partition */ ULONG de_Interleave; /* usually 0 */ ULONG de_LowCyl; /* starting cylinder. typically 0 */ ULONG de_HighCyl; /* max cylinder. drive specific */ ULONG de_NumBuffers; /* Initial # DOS of buffers. */ ULONG de_BufMemType; /* type of mem to allocate for buffers */ ULONG de_MaxTransfer; /* Max number of bytes to transfer at a time */ ULONG de_Mask; /* Address Mask to block out certain memory */ LONG de_BootPri; /* Boot priority for autoboot */ ULONG de_DosType; /* ASCII (HEX) string showing filesystem type; * 0X444F5300 is old filesystem, * 0X444F5301 is fast file system */ ULONG de_Baud; /* Baud rate for serial handler */ ULONG de_Control; /* Control word for handler/filesystem */ ULONG de_BootBlocks; /* Number of blocks containing boot code */ }; /* these are the offsets into the array */ /* DE_TABLESIZE is set to the number of longwords in the table minus 1 */ #define DE_TABLESIZE 0 /* minimum value is 11 (includes NumBuffers) */ #define DE_SIZEBLOCK 1 /* in longwords: standard value is 128 */ #define DE_SECORG 2 /* not used; must be 0 */ #define DE_NUMHEADS 3 /* # of heads (surfaces). drive specific */ #define DE_SECSPERBLK 4 /* not used; must be 1 */ #define DE_BLKSPERTRACK 5 /* blocks per track. drive specific */ #define DE_RESERVEDBLKS 6 /* unavailable blocks at start. usually 2 */ #define DE_PREFAC 7 /* not used; must be 0 */ #define DE_INTERLEAVE 8 /* usually 0 */ #define DE_LOWCYL 9 /* starting cylinder. typically 0 */ #define DE_UPPERCYL 10 /* max cylinder. drive specific */ #define DE_NUMBUFFERS 11 /* starting # of buffers. typically 5 */ #define DE_MEMBUFTYPE 12 /* type of mem to allocate for buffers. */ #define DE_BUFMEMTYPE 12 /* same as above, better name * 1 is public, 3 is chip, 5 is fast */ #define DE_MAXTRANSFER 13 /* Max number bytes to transfer at a time */ #define DE_MASK 14 /* Address Mask to block out certain memory */ #define DE_BOOTPRI 15 /* Boot priority for autoboot */ #define DE_DOSTYPE 16 /* ASCII (HEX) string showing filesystem type; * 0X444F5300 is old filesystem, * 0X444F5301 is fast file system */ #define DE_BAUD 17 /* Baud rate for serial handler */ #define DE_CONTROL 18 /* Control word for handler/filesystem */ #define DE_BOOTBLOCKS 19 /* Number of blocks containing boot code */ amiga-fdisk-0.04.orig/include/amiga/hardblocks.h0100600000175000017500000001646206617464005021140 0ustar lutherlutherstruct RigidDiskBlock { ULONG rdb_ID; /* 4 character identifier */ ULONG rdb_SummedLongs; /* size of this checksummed structure */ LONG rdb_ChkSum; /* block checksum (longword sum to zero) */ ULONG rdb_HostID; /* SCSI Target ID of host */ ULONG rdb_BlockBytes; /* size of disk blocks */ ULONG rdb_Flags; /* see below for defines */ /* block list heads */ ULONG rdb_BadBlockList; /* optional bad block list */ ULONG rdb_PartitionList; /* optional first partition block */ ULONG rdb_FileSysHeaderList; /* optional file system header block */ ULONG rdb_DriveInit; /* optional drive-specific init code */ /* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 */ ULONG rdb_Reserved1[6]; /* set to $ffffffff */ /* physical drive characteristics */ ULONG rdb_Cylinders; /* number of drive cylinders */ ULONG rdb_Sectors; /* sectors per track */ ULONG rdb_Heads; /* number of drive heads */ ULONG rdb_Interleave; /* interleave */ ULONG rdb_Park; /* landing zone cylinder */ ULONG rdb_Reserved2[3]; ULONG rdb_WritePreComp; /* starting cylinder: write precompensation */ ULONG rdb_ReducedWrite; /* starting cylinder: reduced write current */ ULONG rdb_StepRate; /* drive step rate */ ULONG rdb_Reserved3[5]; /* logical drive characteristics */ ULONG rdb_RDBBlocksLo; /* low block of range reserved for hardblocks */ ULONG rdb_RDBBlocksHi; /* high block of range for these hardblocks */ ULONG rdb_LoCylinder; /* low cylinder of partitionable disk area */ ULONG rdb_HiCylinder; /* high cylinder of partitionable data area */ ULONG rdb_CylBlocks; /* number of blocks available per cylinder */ ULONG rdb_AutoParkSeconds; /* zero for no auto park */ ULONG rdb_HighRDSKBlock; /* highest block used by RDSK */ /* (not including replacement bad blocks) */ ULONG rdb_Reserved4; /* drive identification */ char rdb_DiskVendor[8]; char rdb_DiskProduct[16]; char rdb_DiskRevision[4]; char rdb_ControllerVendor[8]; char rdb_ControllerProduct[16]; char rdb_ControllerRevision[4]; ULONG rdb_Reserved5[10]; }; #define IDNAME_RIGIDDISK 0x5244534B /* 'RDSK' */ #define RDB_LOCATION_LIMIT 16 #define RDBFB_LAST 0 /* no disks exist to be configured after */ #define RDBFF_LAST 0x01L /* this one on this controller */ #define RDBFB_LASTLUN 1 /* no LUNs exist to be configured greater */ #define RDBFF_LASTLUN 0x02L /* than this one at this SCSI Target ID */ #define RDBFB_LASTTID 2 /* no Target IDs exist to be configured */ #define RDBFF_LASTTID 0x04L /* greater than this one on this SCSI bus */ #define RDBFB_NORESELECT 3 /* don't bother trying to perform reselection */ #define RDBFF_NORESELECT 0x08L /* when talking to this drive */ #define RDBFB_DISKID 4 /* rdb_Disk... identification valid */ #define RDBFF_DISKID 0x10L #define RDBFB_CTRLRID 5 /* rdb_Controller... identification valid */ #define RDBFF_CTRLRID 0x20L /* added 7/20/89 by commodore: */ #define RDBFB_SYNCH 6 /* drive supports scsi synchronous mode */ #define RDBFF_SYNCH 0x40L /* CAN BE DANGEROUS TO USE IF IT DOESN'T! */ /*------------------------------------------------------------------*/ struct BadBlockEntry { ULONG bbe_BadBlock; /* block number of bad block */ ULONG bbe_GoodBlock; /* block number of replacement block */ }; struct BadBlockBlock { ULONG bbb_ID; /* 4 character identifier */ ULONG bbb_SummedLongs; /* size of this checksummed structure */ LONG bbb_ChkSum; /* block checksum (longword sum to zero) */ ULONG bbb_HostID; /* SCSI Target ID of host */ ULONG bbb_Next; /* block number of the next BadBlockBlock */ ULONG bbb_Reserved; struct BadBlockEntry bbb_BlockPairs[61]; /* bad block entry pairs */ /* note [61] assumes 512 byte blocks */ }; #define IDNAME_BADBLOCK 0x42414442 /* 'BADB' */ /*------------------------------------------------------------------*/ struct PartitionBlock { ULONG pb_ID; /* 4 character identifier */ ULONG pb_SummedLongs; /* size of this checksummed structure */ LONG pb_ChkSum; /* block checksum (longword sum to zero) */ ULONG pb_HostID; /* SCSI Target ID of host */ ULONG pb_Next; /* block number of the next PartitionBlock */ ULONG pb_Flags; /* see below for defines */ ULONG pb_Reserved1[2]; ULONG pb_DevFlags; /* preferred flags for OpenDevice */ UBYTE pb_DriveName[32]; /* preferred DOS device name: BSTR form */ /* (not used if this name is in use) */ ULONG pb_Reserved2[15]; /* filler to 32 longwords */ ULONG pb_Environment[17]; /* environment vector for this partition */ ULONG pb_EReserved[15]; /* reserved for future environment vector */ }; #define IDNAME_PARTITION 0x50415254 /* 'PART' */ #define PBFB_BOOTABLE 0 /* this partition is intended to be bootable */ #define PBFF_BOOTABLE 1L /* (expected directories and files exist) */ #define PBFB_NOMOUNT 1 /* do not mount this partition (e.g. manually */ #define PBFF_NOMOUNT 2L /* mounted, but space reserved here) */ /*------------------------------------------------------------------*/ struct FileSysHeaderBlock { ULONG fhb_ID; /* 4 character identifier */ ULONG fhb_SummedLongs; /* size of this checksummed structure */ LONG fhb_ChkSum; /* block checksum (longword sum to zero) */ ULONG fhb_HostID; /* SCSI Target ID of host */ ULONG fhb_Next; /* block number of next FileSysHeaderBlock */ ULONG fhb_Flags; /* see below for defines */ ULONG fhb_Reserved1[2]; ULONG fhb_DosType; /* file system description: match this with */ /* partition environment's DE_DOSTYPE entry */ ULONG fhb_Version; /* release version of this code */ ULONG fhb_PatchFlags; /* bits set for those of the following that */ /* need to be substituted into a standard */ /* device node for this file system: e.g. */ /* 0x180 to substitute SegList & GlobalVec */ ULONG fhb_Type; /* device node type: zero */ ULONG fhb_Task; /* standard dos "task" field: zero */ ULONG fhb_Lock; /* not used for devices: zero */ ULONG fhb_Handler; /* filename to loadseg: zero placeholder */ ULONG fhb_StackSize; /* stacksize to use when starting task */ LONG fhb_Priority; /* task priority when starting task */ LONG fhb_Startup; /* startup msg: zero placeholder */ LONG fhb_SegListBlocks; /* first of linked list of LoadSegBlocks: */ /* note that this entry requires some */ /* processing before substitution */ LONG fhb_GlobalVec; /* BCPL global vector when starting task */ ULONG fhb_Reserved2[23]; /* (those reserved by PatchFlags) */ ULONG fhb_Reserved3[21]; }; #define IDNAME_FILESYSHEADER 0x46534844 /* 'FSHD' */ /*------------------------------------------------------------------*/ struct LoadSegBlock { ULONG lsb_ID; /* 4 character identifier */ ULONG lsb_SummedLongs; /* size of this checksummed structure */ LONG lsb_ChkSum; /* block checksum (longword sum to zero) */ ULONG lsb_HostID; /* SCSI Target ID of host */ ULONG lsb_Next; /* block number of the next LoadSegBlock */ ULONG lsb_LoadData[123]; /* data for "loadseg" */ /* note [123] assumes 512 byte blocks */ }; #define IDNAME_LOADSEG 0x4C534547 /* 'LSEG' */ amiga-fdisk-0.04.orig/include/amiga/types.h0100600000175000017500000000242506617464005020162 0ustar lutherluther#define VOID void #ifndef __alpha__ typedef long LONG; /* signed 32-bit quantity */ typedef unsigned long ULONG; /* unsigned 32-bit quantity */ typedef unsigned long LONGBITS; /* 32 bits manipulated individually */ #else typedef int LONG; /* signed 32-bit quantity */ typedef unsigned int ULONG; /* unsigned 32-bit quantity */ typedef unsigned int LONGBITS; /* 32 bits manipulated individually */ #endif typedef short WORD; /* signed 16-bit quantity */ typedef unsigned short UWORD; /* unsigned 16-bit quantity */ typedef unsigned short WORDBITS; /* 16 bits manipulated individually */ #if __STDC__ typedef signed char BYTE; /* signed 8-bit quantity */ #else typedef char BYTE; /* signed 8-bit quantity */ #endif typedef unsigned char UBYTE; /* unsigned 8-bit quantity */ typedef unsigned char BYTEBITS; /* 8 bits manipulated individually */ typedef unsigned short RPTR; /* signed relative pointer */ typedef unsigned char *STRPTR; /* string pointer (NULL terminated) */ /* Types with specific semantics */ typedef float FLOAT; typedef double DOUBLE; typedef short BOOL; typedef unsigned char TEXT; #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifndef NULL #define NULL 0L #endif #define BYTEMASK 0xFF amiga-fdisk-0.04.orig/include/fdisk.h0100644000175000017500000000200506617464005017042 0ustar lutherluther/* amiga-fdisk - Amiga RDB Fdisk for Linux * amigastuff.h part - function includes * written in 1996 by Stefan Reinauer * * Copyright (C) 1996-1998 by Stefan Reinauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA */ extern int get_dev,list_only; extern char disk_device[256]; int override(void); amiga-fdisk-0.04.orig/include/implemented.h0100644000175000017500000000145406617464005020254 0ustar lutherlutherstruct notimplemented { char key; char *desc; }; const struct notimplemented functions[] = { { 's', "List size of the partition" }, { 'd', "Dump partition table in amiga-fdisk format" }, { 'V', "Verify partitions" }, { 'i', "Start with cylinder 1 instead of 0" }, { 'N', "Change only single partition" }, { 'A', "Make partition active" }, { 'c', "Change partition id" }, { 'u', "Unit size" }, { 'x', "Show extended" }, { 'C', "Specify Cylinders - override kernel" }, { 'H', "Specify Heads- override kernel" }, { 'S', "Specify Sectors- override kernel" }, { 'f', "Force - even if stupid" }, { 'q', "Quiet execution" }, { 'L', "Not complain about Linux irrelevant things" }, { 'n', "Do not write to disk" }, { 'O', "Save Sector Table to file" }, { 'I', "Restore Sector Table from file" } }; amiga-fdisk-0.04.orig/fdisk.c0100644000175000017500000001704006617464005015417 0ustar lutherluther/* AFDISK - Amiga RDB Fdisk for Linux * fdisk.c part - generic input output stuff * written in 1996 by Stefan Reinauer * * Copyright (C) 1996-1998 Stefan Reinauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA */ #include #include #include #include #include #include #include #include #include #include #include #include #define VERSION "0.04" #define RELDATE "98/11/03" char *testdevs[] = { "/dev/hda", "/dev/hdb", "/dev/hdc", "/dev/hdd", "/dev/sda", "/dev/sdb", "/dev/sdc", "/dev/sdd", "/dev/sde", "/dev/sdf", "/dev/sdg", "/dev/sdh", NULL }; char disk_device[256]="/dev/sda"; int list_only=0, get_dev=0; int atonum(char *s) { char *d=s; int n; while (*s == ' ') /* Eat spaces */ s++; /* 0x is hex, 0 is octal, everything else is decimal. */ if (strncmp(s, "0x", 2) == 0 || strncmp(s, "0X", 2) == 0) sscanf(s + 2, "%x", &n); else if (s[0] == '0' && s[1]) sscanf(s + 1, "%o", &n); else { d=s; while (d[0]!=0) { if (!isdigit( ((int)(d[0])) )) return 0; d++; } sscanf(s, "%d", &n); } return n; } int partition(void) { char *partnum; int i; partition_show(); partnum=readline("Partition number: "); if (partnum==NULL) exit(0); i=atonum(partnum); free(partnum); return i; } int override(void) { char *ovr; int i=0; if (!list_only) { ovr=readline("Do you want to override this error? [y/N] "); if (ovr==NULL) exit(0); if (ovr[0]=='y' || ovr[0]=='Y') i=1; free(ovr); } else { fprintf (stderr,"Overriding last error.\n"); i=1; } return i; } int listknown(void) { printf("Known Partition Types\n---------------------\n 1. DOS\\0 Old Filesystem 2. DOS\\1 Original FastFileSystem (FFS) 3. DOS\\2 Old International Filesystem 4. DOS\\3 International FastFileSystem 5. DOS\\4 Old Filesystem with directory cache 6. DOS\\6 FastFileSystem with directory cache 7. UNI\\0 classic AT&T System-V filesystem 8. UNI\\1 UNIX boot \"filesystem\" (dummy entry for Amiga OS's boot menu) 9. UNI\\2 Berkeley filesystem for System V 10. RESV Reserved (e.g. swap space) 11. LNX\\0 Linux native 12. SWP\\0 Linux swap\n\n"); return 0; } int menu(void) { printf ("Command action a toggle bootable flag b change number of bootblocks c change boot priority d delete a partition e toggle nomount flag l list known partition types m print this menu n add a new partition p print the partition table q quit without saving changes t change a partition's DosType r reorganize/move RDB w write table to disk and exit\n\n"); return 0; } int version(void) { printf ("amiga-fdisk %s (%s) by Stefan Reinauer, \n\n",VERSION,RELDATE); return 0; } ULONG gettype(void) { char *dtype; ULONG hexval,ascii; listknown(); printf ("\n Choose a number of the upper list or\n enter a DosType of the format 0x444f5302\n\n"); dtype=readline("Enter DosType: "); if (dtype==NULL) exit (0); hexval=atonum(dtype); ascii=ntohl(*(ULONG *)dtype); free(dtype); switch (hexval) { case 0: return ascii; case 1: return 0x444f5300; case 2: return 0x444f5301; case 3: return 0x444f5302; case 4: return 0x444f5303; case 5: return 0x444f5304; case 6: return 0x444f5305; case 7: return 0x554e4900; case 8: return 0x554e4901; case 9: return 0x554e4902; case 10: return 0x52455356; case 11: return 0x4C4E5800; case 12: return 0x53575000; default: return (hexval); } return 0; } int main(int argc, char **argv) { int c, count; char *entry, *optinput; /* Parsing all command line parameters */ while(((c = getopt(argc, argv, "-dvls:TViN:A:u:xC:H:S:fqLnRO:I:?")) != EOF)) switch(c) { case 1: get_dev=1; strcpy(disk_device, optarg); break; case 'v': version(); return 0; case '?': printf ("\nUsage: %s [-l] [-v] [-d] [-s /dev/hdxn] [/dev/hdx]\n",argv[0]); return 0; case 'l': list_only = 1; break; case 'T': version(); listknown(); return 0; default: count=0; while (functions[count].key!='!') { if (functions[count].key==c) { printf ("Option \"%c\" - \"%s\" - not yet implemented.\n",c, functions[count].desc); break; } count++; } return 0; } /* switch to selected mode and look for valid device */ if (list_only) { if (get_dev) { if (get_rdb()!=-1) { rigiddisk_show(); partition_show(); printf ("\n"); } } else { count=0; while (testdevs[count] != NULL) { strcpy(disk_device, testdevs[count++]); if (get_rdb()!=-1) { rigiddisk_show(); partition_show(); printf ("\n"); } } } return 0; } else { if (!get_dev) printf ("Using %s as default device!\n",disk_device); if (get_rdb()==-1) return -1; } printf ("\n"); /* Entering interactive mode */ for (;;) { #ifdef DEBUG pt(); #endif entry=readline( "Command (m for help): "); if (entry==NULL) { quitall(); return 0; } switch ((*entry)) { case 'q': case 'Q': quitall(); free(entry); return 0; case 'l': case 'L': listknown(); break; case 'p': case 'P': printf ("\n"); rigiddisk_show(); partition_show(); printf ("\n"); break; case 'a': case 'A': partition_togglebootable(partition()); break; case 'b': case 'B': count=partition(); optinput=readline("Number of bootblocks: "); if (optinput==NULL) return 0; partition_bootblk(count,atonum(optinput)); free(optinput); break; case 'c': case 'C': count=partition(); optinput=readline("New Boot Priority: "); if (optinput==NULL) return 0; partition_bootpri(count,atonum(optinput)); free(optinput); break; case 'd': case 'D': partition_delete(partition()); break; case 'e': case 'E': partition_togglenomount(partition()); break; case 'n': case 'N': if (room_for_partition()!=-1) { count=partition(); if (partition_new(count)!=-1) { optinput=readline("Low Cylinder: "); if (optinput==NULL) return 0; partition_locyl(count,atonum(optinput)); free(optinput); optinput=readline("High Cylinder: "); if (optinput==NULL) return 0; partition_hicyl(count,atonum(optinput)); free(optinput); } } break; case 't': case 'T': count=partition(); partition_dostype(count,gettype()); break; case 'w': case 'W': free(entry); rigiddisk_reorg(firstblock); rigiddisk_save(); return 0; case 'r': case 'R': printf ("\n"); rigiddisk_show(); printf ("\n"); optinput=readline(" RDB start at: "); if (optinput==NULL) return 0; rigiddisk_reorg(atonum(optinput)); free(optinput); break; case '\0': break; case 'm': case 'M': default: menu(); break; } free(entry); } } amiga-fdisk-0.04.orig/Makefile0100644000175000017500000000121306617464005015606 0ustar lutherluther# Makefile -- Makefile for amiga-fdisk # # Copyright '96-'98 Stefan Reinauer (stepan@linux.de) # CC= gcc CFLAGS= -O2 -fomit-frame-pointer -Wall -I./include #CFLAGS= -g -fomit-frame-pointer -Wall -I./include -DDEBUG LDFLAGS= # -s -N LIBS= -lreadline # Where to put binaries? # See the "install" rule for the links. . . SBIN= amiga-fdisk # Where to put datebase files? all: $(SBIN) amiga-fdisk: amigastuff.o fdisk.o $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ install: all $(INSTALLDIR) $(SBINDIR) $(INSTALLBIN) $(SBIN) $(SBINDIR) clean: -rm -f *.o *~ core $(SBIN) tidy: -rm -f *.o *~ core -strip amiga-fdisk amiga-fdisk-0.04.orig/amigastuff.c0100644000175000017500000005641606617464005016457 0ustar lutherluther/* amiga-fdisk - Amiga RDB fdisk for Linux * amigastuff.c part - amiga specific stuff * written in 1996 by Stefan Reinauer * * Copyright (C) 1996-1998 by Stefan Reinauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define SECTOR_SIZE 512 #define MAXPARTS 16 #define BBB(pos) ((struct BadBlockBlock *)(pos)) #define PART(pos) ((struct PartitionBlock *)(pos)) #define FSHB(pos) ((struct FileSysHeaderBlock *)(pos)) #define LSEG(pos) ((struct LoadSegBlock *)(pos)) #define RDSK(pos) ((struct RigidDiskBlock *)(pos)) struct AmigaBlock { ULONG amiga_ID; /* 4 character identifier */ ULONG amiga_SummedLongs; /* size of this checksummed structure */ LONG amiga_ChkSum; /* block checksum (longword sum to zero) */ }; struct RigidDiskBlock *rdb; struct PartitionBlock *pa[MAXPARTS]; int parts, firstblock, lastblock, maxblock, minblock; char *initsectors, *listsector; char type[32]; /* Needed by DosType() */ int rigiddisk_new(int first); char *get_block(block) { /* This is a true quickhack. Whenn we are in list only * mode, we may not have swap and so we may not be able * to hold the whole RDB data, so we do some stupid * switching. This is slow and breaks the interactive mode. * So, in interactive mode you still need to have all RDB data * in memory at once */ int l; if (list_only) { if ((l=open(disk_device,O_RDONLY))<0) { if (get_dev) fprintf (stderr,"Cannot open device %s\n",disk_device); return NULL; } if (lseek(l,(block*SECTOR_SIZE),SEEK_SET)<0) { close(l); fprintf (stderr,"Seek error occured while reading block %d.\n",block); return NULL; } if (read(l,listsector,SECTOR_SIZE)!=SECTOR_SIZE) { close(l); fprintf (stderr,"Error occured while reading block %d.\n",block); return NULL; } close(l); return listsector; } return initsectors+(block*SECTOR_SIZE); } LONG checksum(struct AmigaBlock *ptr) { /* This function calculates the Checksum of one AmigaBlock. Trivial. */ int i, end; LONG sum; ULONG *pt=(ULONG *)ptr; sum=htonl(pt[0]); end=htonl(pt[1]); if (end>SECTOR_SIZE) end=SECTOR_SIZE; for (i=1; i=minblock && block<=maxblock) || (block == -1)); } int sector_correct(struct AmigaBlock *ablock) { if (valid_blocktype(htonl(ablock->amiga_ID))) { ablock->amiga_ChkSum = ntohl( htonl(ablock->amiga_ChkSum) - checksum((struct AmigaBlock *)ablock)); return 0; } return -1; } int check_lseg(int blk) { char *curr; while (blk!=-1) { if (blk>lastblock) lastblock=blk; curr=get_block(blk); if (htonl(LSEG(curr)->lsb_ID)!=IDNAME_LOADSEG) { fprintf (stderr, "LoadSeg messed up at block #%d.\n",blk); if (!override()) return -1; LSEG(curr)->lsb_ID=ntohl(IDNAME_LOADSEG); } if (checksum((struct AmigaBlock *)curr)!=0) { fprintf (stderr, "LoadSeg block #%d had wrong checksum. Fixed.\n",blk); sector_correct((struct AmigaBlock *)curr); } blk=htonl(LSEG(curr)->lsb_Next); if (!valid_blocknum(blk)) { fprintf (stderr, "LoadSeg block not valid. Skipping other LoadSeg blocks.\n"); LSEG(curr)->lsb_Next=ntohl(-1); // Correct this. break; } } return 0; } int check_bbb(int blk) { char *curr; while (blk!=-1) { if (blk>lastblock) lastblock=blk; curr=get_block(blk); if (htonl(BBB(curr)->bbb_ID)!=IDNAME_BADBLOCK) { fprintf (stderr, "BadBlockList messed up at block #%d.\n",blk); return -1; } if (checksum((struct AmigaBlock *)curr)!=0) { fprintf (stderr, "BadBlockList block #%d had wrong checksum. Fixed.\n",blk); sector_correct((struct AmigaBlock *)curr); } blk=htonl(BBB(curr)->bbb_Next); if (!valid_blocknum(blk)) { fprintf (stderr, "BadBlockList block not valid. Skipping other BadBlockList blocks.\n"); BBB(curr)->bbb_Next=ntohl(-1); // Correct this. break; } } return 0; } int connectivity(void) { char *curr; int block; /* Check whether all checksums are ok and try to fix them * Extract partition data. */ lastblock=firstblock; /* Check BadBlockBlocks, LoadSegBlocks & FileSystemHeaderBlocks */ if (check_bbb(htonl(rdb->rdb_BadBlockList))==-1) return -1; if (check_lseg(htonl(rdb->rdb_DriveInit))==-1) return -1; block=htonl(rdb->rdb_FileSysHeaderList); while (block!=-1) { if (block>lastblock) lastblock=block; curr=get_block(block); if (htonl(FSHB(curr)->fhb_ID)!=IDNAME_FILESYSHEADER) { fprintf (stderr, "FilesystemHeader messed up at block #%d.\n",block); return -1; } if (checksum((struct AmigaBlock *)curr)!=0) { fprintf (stderr, "FilesystemHeader block #%d had wrong checksum. Fixed.\n",block); sector_correct((struct AmigaBlock *)curr); } if (check_lseg(htonl(FSHB(curr)->fhb_SegListBlocks))==-1) return -1; if (list_only) /* Because we overwrote the buffer with check_lseg */ curr=get_block(block); block=htonl(FSHB(curr)->fhb_Next); } /* Check Partition Blocks */ parts=0; block=htonl(rdb->rdb_PartitionList); while (block!=-1) { if (block>lastblock) lastblock=block; curr=get_block(block); if (htonl(PART(curr)->pb_ID)!=IDNAME_PARTITION) { fprintf (stderr, "PartitionEntry messed up at block #%d.\n",block); return -1; } if (checksum((struct AmigaBlock *)curr)!=0) { fprintf (stderr, "PartitionEntry block #%d had wrong checksum. Fixed.\n",block); sector_correct((struct AmigaBlock *)curr); } if (!list_only) pa[parts]=PART(curr); parts++; if (parts>MAXPARTS) { fprintf (stderr, "Too many partitions(max=%d). Giving up.\n",MAXPARTS); return -1; } block=htonl(PART(curr)->pb_Next); } /* Everything seems to be alright */ return 0; } int get_rdb(void) { /* Initial work. * - Get RDB * - Check size of all init blocks * - get init sectors */ int f,i; if ((rdb=RDSK(malloc(SECTOR_SIZE)))==NULL) { fprintf (stderr,"Not enough memory for one sector (poor guy).\n"); return -1; } if ((f=open(disk_device,O_RDONLY))<0) { if (!list_only || get_dev) fprintf (stderr,"Cannot open device %s\n",disk_device); free((char *)rdb); return -1; } i=0; firstblock=-1; while ((irdb_ID)==IDNAME_RIGIDDISK) { firstblock=i; if (checksum((struct AmigaBlock *)rdb)) { sector_correct((struct AmigaBlock *)rdb); fprintf(stderr,"RDB on block %d had bad checksum. Fixed.\n",i); } } i++; } if (firstblock==-1) { fprintf(stderr,"No valid RDB found... "); close(f); free((char *)rdb); rigiddisk_new(0); return 0; } if ((i=htonl(rdb->rdb_RDBBlocksHi))==0) { fprintf (stderr,"RDB unrepairable inconsistent.\n"); return -1; } if (!list_only) { free ((char *)rdb); if ((initsectors=malloc(i*SECTOR_SIZE))==NULL) { fprintf (stderr,"Not enough memory for partition table.\n"); return -1; } if (lseek(f,0,SEEK_SET)<0) { close(f); free(initsectors); fprintf (stderr,"Seek error occured while reading partition table.\n"); return -1; } if (read(f,initsectors,i*SECTOR_SIZE)!=i*SECTOR_SIZE) { close(f); free(initsectors); fprintf (stderr,"Error while reading partition table.\n"); return -1; } rdb=RDSK(initsectors+firstblock*SECTOR_SIZE); } else { if ((listsector=malloc(SECTOR_SIZE))==NULL) { fprintf (stderr,"Not enough memory for one sector. Poor guy.\n"); return -1; } } close (f); maxblock=htonl(rdb->rdb_RDBBlocksHi); minblock=htonl(rdb->rdb_RDBBlocksLo); if (connectivity()==-1) { free(initsectors); fprintf (stderr,"Could not solve RDB problems. Sorry.\n"); return -1; } /* Everything alright ? */ return 0; } int countblk(void) { int i,j=0; struct AmigaBlock *curr; // Implement: Checking whether found block is in chained list for (i=0;i<=maxblock;i++) { curr=(struct AmigaBlock *)get_block(i); if (valid_blocktype(htonl(curr->amiga_ID))) j++; } #ifdef DEBUG printf ("%d/%d blocks counted.\n",j,maxblock); #endif return j; } int findblk(void) { int i; struct AmigaBlock *curr; // Implement: Checking whether found block is in chained list for (i=firstblock;i<=maxblock;i++) { curr=(struct AmigaBlock *)get_block(i); if (!valid_blocktype(htonl(curr->amiga_ID))) { printf ("block %d is free.\n",i); return i; } } return -1; } int room_for_partition(void) { /* This function will never be called in list_only mode :-) */ int i; if (parts==MAXPARTS) { fprintf (stderr,"Too many partitions(max=%d).\n",MAXPARTS); return -1; } if ((i=findblk())parts+1)) { fprintf (stderr,"Invalid partition number. existing: %d, tried: %d\n",parts,nr); return -1; } if ((i=room_for_partition())==-1) { fprintf (stderr,"Could not create new partition.\n"); return -1; } printf ("Creating new partition entry at block %d.\n",i); nr--; for (j=parts;j>nr;j--) pa[j]=pa[j-1]; parts++; if (i>lastblock) lastblock=i; rdb->rdb_HighRDSKBlock=ntohl(lastblock); pa[nr]=PART(get_block(i)); /* And we hope, that list_only will * never call us :) */ memset(pa[nr],-1,SECTOR_SIZE); pa[nr]->pb_ID = ntohl(IDNAME_PARTITION); pa[nr]->pb_SummedLongs = ntohl(64); pa[nr]->pb_HostID = rdb->rdb_HostID; pa[nr]->pb_Flags = ntohl(0); pa[nr]->pb_DevFlags = ntohl(0); memcpy(pa[nr]->pb_DriveName,"\003dhx",4); if (nr==0) { pa[nr]->pb_Next=rdb->rdb_PartitionList; rdb->rdb_PartitionList=ntohl(i); } else { pa[nr]->pb_Next=pa[nr-1]->pb_Next; pa[nr-1]->pb_Next=ntohl(i); } de=(struct DosEnvec *)pa[nr]->pb_Environment; de->de_TableSize = ntohl(19); /* 20 ? */ de->de_SizeBlock = ntohl(128); de->de_SecOrg = ntohl(0); de->de_Surfaces = ntohl(1); /* On my old Seagate this was 1. If it does not work, try * de->de_Surfaces=rdb->rdb_Heads */ de->de_SectorPerBlock = ntohl(1); de->de_BlocksPerTrack = rdb->rdb_CylBlocks; /* BlocksPerTrack should be rdb->rdb_sectors?! But CylBlocks * seems to be better if a hd has more than 1 _LOGICAL_ surface * (Does this ever happen? Correct me if I am wrong.. */ de->de_Reserved = ntohl(2); de->de_PreAlloc = ntohl(0); de->de_Interleave = ntohl(0); de->de_NumBuffers = ntohl(30); de->de_BufMemType = ntohl(0); de->de_MaxTransfer = ntohl(0x7fffffff); de->de_Mask = ntohl(0xffffffff); de->de_BootPri = ntohl(0); de->de_DosType = ntohl(0x444f5301); de->de_Baud = ntohl(0); de->de_Control = ntohl(0); de->de_BootBlocks = ntohl(0); return 0; } int partition_delete (int nr) { if ((partsrdb_PartitionList)==(ULONG)lastblock) lastblock--; /* Correct lastblock counter */ rdb->rdb_PartitionList=pa[0]->pb_Next; } else { if (htonl(pa[nr-1]->pb_Next)==(ULONG)lastblock) lastblock--; pa[nr-1]->pb_Next=pa[nr]->pb_Next; } while (nrparts)) return -1; nr--; pa[nr]->pb_Flags=ntohl(htonl(pa[nr]->pb_Flags)^PBFF_BOOTABLE); return 0; } int partition_togglenomount(int nr) { if ((nr<1)||(nr>parts)) return -1; nr--; pa[nr]->pb_Flags=ntohl(htonl(pa[nr]->pb_Flags)^PBFF_NOMOUNT); return 0; } int partition_locyl(int nr,int cyl) { if ((nr<1)||(nr>parts)) return -1; nr--; ((struct DosEnvec *)(pa[nr]->pb_Environment))->de_LowCyl=ntohl(cyl); return 0; } int partition_hicyl(int nr,int cyl) { if ((nr<1)||(nr>parts)) return -1; nr--; ((struct DosEnvec *)pa[nr]->pb_Environment)->de_HighCyl=ntohl(cyl); return 0; } int partition_bootpri(int nr,int pri) { if ((nr<1)||(nr>parts)) return -1; nr--; ((struct DosEnvec *)pa[nr]->pb_Environment)->de_BootPri=ntohl(pri); return 0; } int partition_bootblk(int nr,int blks) { if ((nr<1)||(nr>parts)) return -1; nr--; ((struct DosEnvec *)pa[nr]->pb_Environment)->de_BootBlocks=ntohl(blks); return 0; } int partition_dostype(int nr, ULONG dostype) { if ((nr<1)||(nr>parts)) return -1; nr--; ((struct DosEnvec *)pa[nr]->pb_Environment)->de_DosType=ntohl(dostype); return 0; } int rigiddisk_correct(void) { /* Correct checksums of all Blocks */ int i,ts; struct DosEnvec *de; rdb->rdb_HighRDSKBlock=ntohl(lastblock); /* Historical overhead from the very old days. The DosEnvec is a dynamically growing table, and some fields are only present in newer versions of AmigaDos. So if we decide to create acient looking RDB's, we are ready for it. (If a partion is mounted under AmigaDos, unknown fields should be ignored, and missing fields given a senseful default.) NB, AmigaLilo depends on the presence of fields 19 and 20, which are only supported by V37 or newer ROMs. */ for (i=firstblock;ipb_Environment; ts=htonl(de->de_TableSize); if (ts<12) de->de_BufMemType=ntohl(0); if (ts<13) de->de_MaxTransfer=ntohl(0x7fffffff); if (ts<14) de->de_Mask=ntohl(0xffffffff); if (ts<15) de->de_BootPri=ntohl(0); if (ts<16) de->de_DosType=ntohl(0x444f5300); if (ts<17) de->de_Baud=ntohl(0); if (ts<18) de->de_Control=ntohl(0); if (ts<19) { de->de_BootBlocks=ntohl(0); de->de_TableSize=ntohl(19); } sector_correct((struct AmigaBlock *)(pa[i])); } return 0; } int rigiddisk_new(int first) { struct hd_geometry geo={-1,}; long long hdsize; int i,f; if ((f=open(disk_device,O_RDONLY))<0) { fprintf (stderr,"Cannot open device %s\n",disk_device); return -1; } printf ("Creating new Rigid Disk Block\n"); if (ioctl(f,HDIO_GETGEO,&geo)!=0) { printf("Can't get geometry data. Trying lseek/trivial mapping.\n"); hdsize=lseek(f,0,SEEK_END); if (hdsize != -1) { if (hdsize==0) { printf("LSEEK: Could not lseek (Floppy?). Exit.\n"); exit(0); } /* XXXXXXX Fixme */ if ((hdsize%SECTOR_SIZE)!=0) { printf("LSEEK: File length error (corrupt disk image?). Exit.\n"); exit(0); } geo.heads=1; geo.sectors=1; geo.cylinders=hdsize/SECTOR_SIZE; geo.start=0; while ((((geo.cylinders/2)*2)==geo.cylinders) && (geo.cylinders>1024)) { geo.sectors*=2; geo.cylinders/=2; if (((geo.cylinders/2)*2)==geo.cylinders && (geo.cylinders>1024) ) { geo.heads*=2; geo.cylinders/=2; } } } else { fprintf (stderr, "LSEEK: Error occured. Exit.\n"); exit(0); } } printf("geometry: %d heads, %d secs, %d cyl, %ld start\n", geo.heads,geo.sectors,geo.cylinders,geo.start); i=geo.sectors*geo.heads*2; if ((initsectors=malloc(i*SECTOR_SIZE))==NULL) { fprintf (stderr,"Not enough memory for partition table.\n"); return -1; } rdb=RDSK(get_block(first)); memset(rdb,-1,SECTOR_SIZE); rdb->rdb_ID = ntohl(IDNAME_RIGIDDISK); rdb->rdb_SummedLongs = ntohl(64); rdb->rdb_BlockBytes = ntohl(SECTOR_SIZE); rdb->rdb_Flags = ntohl(0); rdb->rdb_Cylinders = ntohl(geo.cylinders); rdb->rdb_Sectors = ntohl(geo.sectors); rdb->rdb_Heads = ntohl(geo.heads); rdb->rdb_Interleave = ntohl(0); rdb->rdb_Park = ntohl(geo.cylinders); rdb->rdb_WritePreComp = ntohl(geo.cylinders); rdb->rdb_ReducedWrite = ntohl(geo.cylinders); rdb->rdb_StepRate = ntohl(0); rdb->rdb_RDBBlocksLo = ntohl(first); rdb->rdb_RDBBlocksHi = ntohl(geo.sectors*geo.heads*2-1); rdb->rdb_LoCylinder = ntohl(2); rdb->rdb_HiCylinder = ntohl(geo.cylinders-1); rdb->rdb_CylBlocks = ntohl(geo.sectors*geo.heads); rdb->rdb_AutoParkSeconds= ntohl(0); rdb->rdb_HighRDSKBlock = ntohl(first); firstblock=first; lastblock=first; minblock=first; maxblock=geo.sectors*geo.heads*2-1; rigiddisk_correct(); return 0; } int rigiddisk_reorg(int startblk) { /* Put all Blocks together and/or move RDB to another block */ char *curr, *curr2, *newblks; int i,j,block,blk2; ULONG *crk; #ifdef DEBUG printf ("Reorganizing RDB.\n"); #endif i=countblk()+startblk-1; /* Needed blocks = Starting Block + Allocated Blocks. Is this correct? */ if (i>maxblock) { fprintf (stderr,"Not enough disk space to place RDB at Block %d. Have %d, need %d.\n", startblk,maxblock,i); return -1; } if ((newblks=malloc(maxblock*SECTOR_SIZE))==NULL) { fprintf (stderr,"Not enough memory for reorganisation.\n"); return -1; } memset(newblks,-1,maxblock*SECTOR_SIZE); j = (firstblock0) printf ("Trying to save %d sector(s) \n",j); for (i=0; iamiga_ID))) { printf ("Copying raw block #%d (MBR?)\n",i); memcpy (newblks+i*SECTOR_SIZE,initsectors+i*SECTOR_SIZE,SECTOR_SIZE); } } i=startblk; memcpy (newblks+i*SECTOR_SIZE,rdb,SECTOR_SIZE); crk=&(RDSK(newblks+(startblk*SECTOR_SIZE))->rdb_BadBlockList); i++; curr=newblks+(i*SECTOR_SIZE); block=htonl(rdb->rdb_BadBlockList); while (block!=-1) { memcpy (curr,initsectors+block*SECTOR_SIZE,SECTOR_SIZE); (*crk)=ntohl(i); crk=&(BBB(curr)->bbb_Next); block=htonl(BBB(initsectors+block*SECTOR_SIZE)->bbb_Next); i++; curr=newblks+i*SECTOR_SIZE; } (*crk)=ntohl(-1); crk=&(RDSK(newblks+(startblk*SECTOR_SIZE))->rdb_DriveInit); block=htonl(rdb->rdb_DriveInit); while (block!=-1) { memcpy (curr,initsectors+(block*SECTOR_SIZE),SECTOR_SIZE); (*crk)=ntohl(i); crk=&(LSEG(curr)->lsb_Next); block=htonl(LSEG(initsectors+block*SECTOR_SIZE)->lsb_Next); i++; curr=newblks+i*SECTOR_SIZE; } (*crk)=ntohl(-1); crk=&(RDSK(newblks+startblk*SECTOR_SIZE)->rdb_FileSysHeaderList); block=htonl(rdb->rdb_FileSysHeaderList); while (block!=-1) { memcpy (curr,initsectors+block*SECTOR_SIZE,SECTOR_SIZE); (*crk)=ntohl(i); crk=&(FSHB(curr)->fhb_SegListBlocks); curr2=curr; i++; curr=newblks+i*SECTOR_SIZE; blk2=htonl(FSHB(get_block(block))->fhb_SegListBlocks); while (blk2!=-1) { memcpy (curr,initsectors+blk2*SECTOR_SIZE,SECTOR_SIZE); (*crk)=ntohl(i); crk=&(LSEG(curr)->lsb_Next); blk2=htonl(LSEG(initsectors+blk2*SECTOR_SIZE)->lsb_Next); i++; curr=newblks+i*SECTOR_SIZE; } crk=&(FSHB(curr2)->fhb_Next); block=htonl(FSHB(initsectors+block*SECTOR_SIZE)->fhb_Next); } crk=&(RDSK(newblks+startblk*SECTOR_SIZE)->rdb_PartitionList); block=htonl(rdb->rdb_PartitionList); while (block!=-1) { memcpy (curr,initsectors+block*SECTOR_SIZE,SECTOR_SIZE); (*crk)=ntohl(i); crk=&(PART(curr)->pb_Next); block=htonl(PART(initsectors+block*SECTOR_SIZE)->pb_Next); i++; curr=newblks+i*SECTOR_SIZE; } lastblock=i; firstblock=startblk; minblock=startblk; free (initsectors); initsectors=newblks; rdb=RDSK(initsectors+firstblock*SECTOR_SIZE); rigiddisk_correct(); return 0; } int rigiddisk_save(void) { /* save RDB to disk */ int f; rigiddisk_correct(); if ((f=open(disk_device,O_WRONLY))<0) { fprintf (stderr,"Cannot open device %s\n",disk_device); return -1; } if (lseek(f,0,SEEK_SET)<0) { close(f); fprintf (stderr,"Seek error occured while writing partition table.\n"); return -1; } if (write(f,initsectors,maxblock*SECTOR_SIZE)!=maxblock*SECTOR_SIZE) { close(f); fprintf (stderr,"Error occured while writing partition table.\n"); return -1; } printf ("Rereading partition table.\n"); sync(); if(ioctl(f, BLKRRPART)) { printf ("Could not reread partition table. You MUST reboot now to see the changes.\n"); return -1; } return 0; } char *DosType(ULONG dostype) { int i,j=0; union { ULONG dlong; char dchar[4]; } dt; dt.dlong = htonl(dostype); if (!list_only) { j = sprintf(type, "0x%04x = ",dostype); for (i = 0; i < 4; i++) if (isprint(dt.dchar[i])) type[j++] = dt.dchar[i]; else j += sprintf(type + j, "\\%o", dt.dchar[i]); j += sprintf(type + j, " "); type[j]=0; } switch (ntohl(dt.dlong)) { case 0x444f5300: j += sprintf(type + j, "Amiga OFS");break; case 0x444f5301: j += sprintf(type + j, "Amiga FFS");break; case 0x444f5302: j += sprintf(type + j, "Amiga OFS Int.");break; case 0x444f5303: j += sprintf(type + j, "Amiga FFS Int.");break; case 0x444f5304: j += sprintf(type + j, "Amiga OFS DirCache");break; case 0x444f5305: j += sprintf(type + j, "Amiga FFS DirCache");break; case 0x4C4E5800: j += sprintf(type + j, "Linux native");break; case 0x53575000: j += sprintf(type + j, "Linux swap");break; default: j += sprintf(type + j, "[unknown]");break; } return type; } int rigiddisk_show(void) { printf ("Disk %s: %ld heads, %ld sectors, %ld cylinders, RDB: %d\n", disk_device, htonl(rdb->rdb_Heads),htonl(rdb->rdb_Sectors),htonl(rdb->rdb_Cylinders),firstblock); printf ("Logical Cylinders from %ld to %ld, %ld bytes/Cylinder \n\n", htonl(rdb->rdb_LoCylinder), htonl(rdb->rdb_HiCylinder), SECTOR_SIZE*htonl(rdb->rdb_Sectors)*htonl(rdb->rdb_Heads)); return 0; } int partition_show(void) { int i,block; struct DosEnvec *de; struct PartitionBlock *curr; block=htonl(rdb->rdb_PartitionList); printf (" Device Boot Mount Begin End Size Pri BBlks System\n"); for (i=0; ipb_Next); de=(struct DosEnvec *)curr->pb_Environment; printf ("%s%-2d ",disk_device,(i+1)); printf ("%s ", htonl(curr->pb_Flags)&PBFF_BOOTABLE?"*":" "); printf ("%s ", htonl(curr->pb_Flags)&PBFF_NOMOUNT?" ":"*"); printf ("%6ld %6ld ", htonl(de->de_LowCyl),htonl(de->de_HighCyl)); printf ("%6ld ", (htonl(de->de_HighCyl)-htonl(de->de_LowCyl)+1)* htonl(de->de_BlocksPerTrack)*htonl(de->de_Surfaces)/2); printf ("%3ld ",htonl(de->de_BootPri)); printf ("%3ld ",htonl(de->de_BootBlocks)); printf ("%s\n",DosType(htonl(de->de_DosType))); } return 0; } int quitall(void) { if (!list_only) { free (initsectors); } else free (listsector); return 0; } amiga-fdisk-0.04.orig/COPYING0100644000175000017500000006151006617464005015207 0ustar lutherlutherCopyright (C) '96-'98 by Stefan Reinauer This is an fdisk for Amiga RDB-Type harddisks written by Stefan Reinauer, GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! amiga-fdisk-0.04.orig/README0100644000175000017500000000760106617464005015035 0ustar lutherlutheramiga-fdisk 0.04 (consider this being unstable) This is an fdisk program for partioning harddrives using the Amiga Rigid Disk Block standard(RDB) It's in a very early stage. The most current release of amiga-fdisk can be obtained from: http://www.freiburg.linux.de/~stepan Amiga-fdisk is known to work on Linux systems with at least all kernels since 1.2.13. I suggest that you use at least a recent 2.0 kernel. Be careful! With amiga-fdisk, it is easy to erase your whole data within few seconds If you have a MBR on your harddisk, too, you should *NEVER* reorganize rdb to block 0 (or 1?) or the MBR gets lost. If you don't want to read your harddisks in a PC style workstation, this is very likely of no interest to you. Thanks to Frank Neumann and Leland for their ideas and help. Many thanks to Joerg Dorchain. He made the first attempt to write an amiga-fdisk and he allowed me to have a *very* close look at his code. In fact, I think some larger parts are stolen from his work. Look at the TODO-file if you feel inspired to work on amiga-fdisk. Feel free to ask me anything about the RDB interna. Please note: This program has been developed on an Intel box running Linux/x86, but I have tested it on my Amiga 3000 running Linux m68k quite often now. It works fine for me and it seems that it behaves equally on both little and big endianed platforms. This version is still ALPHA. It's to your responsibility if your data gets lost. (I am sorry for this, but of course I will try to help you, if your harddisks crash because of amiga-fdisk) For the Dostype-Choice, read the following: Cite from 'The Amiga Guru Book' from Ralph Babel, Page 561: de_DosType - The DOS type determines a disk's block structure; $444F5300 ('DOS\0')identifies the old filesystem (default), $444F5301 ('DOS\1') the FastFileSystem, and $444F5302 ('DOS\2') and $444F5303 ('DOS\3') the new "international" versions thereof. It is used as the default DOS type by Format, as the 2.0 ROM filesystem is able to handle different formats (see section 17.1.50). The filesystem-private DOS-type identifier as stored in block 0 of a partition determines the actual block structure (see section 15.3.9). For DosEnvec structures that are part of the RDB, de_DosType is also used to indicate the type of partition data, e.g under Amiga-UNIX ( :-) ): UNI\0 - classic AT&T System-V filesystem UNI\1 - UNIX boot "filesystem" (dummy entry for Amiga OS's boot menu) UNI\2 - Berkeley filesystem for System V RESV - reserved (e.g. swap space) Under 2.0, FileSystem.resource entries exist for DOS\1, DOS\2, DOS\3 and UNI\1 (i.e all bootable "filesystems" other than DOS\0, which is always considered to be available as boot filesystem). As different revisions of Commodore's filesystems can handle different sets of partition formats, it is unclear wether de_DosType is used as an alias for the filesystem code to be used (e.g. during autobooting) or as an indicator as to which format the partition is in. Neither of these interpretations is fully consistent with the current usage and existing filesystems and may therefore cause problems. What follows up from this for now is: If you set the DosType of all your Linux partitions to RESV and Flags to noboot,nomount, they will not appear in the boot menu nor show up anyhow under Amiga OS. Set the DosType to RESV and Flags to noboot,mount if you want to share a partition (e.g swap) between Linux and AmigaDos without an appropriate filesystem (e.g. for use with VMM). This gives only the device name without a volume node -> no annoying "Not a Dos disk" icon. set the DosType to UNI\1, Flags to boot,mount (priority as desired) and BootBlocks to 2 of your Linux root partition for use of Amiga-LILO. So the partion will show up in the bootmenu but dissappear silently when booting AmigaDos from another partition. Stefan Reinauer, November 1998. amiga-fdisk-0.04.orig/ChangeLog0100644000175000017500000000221406617464005015722 0ustar lutherluther** 0.04****** 98/11/03 ******************************************************** * After a long period of idling around, afdisk development is continued. * Name changed to amiga-fdisk to prevent people from thinking this is fdisk for atari style partition tables. * Manpage from Frank Neumann added to distribution (lay around since Feb 25) * Switched everything to libreadline instead of the unsecure gets. * rewrote some minor parts of the code, removed lots of small bugs. * Changing Partition types should work now. * Resyncing partition table, so that you don't need to reboot after changes. * Added some ifdefs to make amiga-fdisk 64bit clean. * Added possibility to override/correct errors. * Implemented command line option "-T" * Threw out this weird and unpretty sectortable[] stuff. * Checking whether blocknumbers are valid. No more segfaults.. * Implemented functions valid_blocktype(), valid_blocknum() and get_block() * switched block handling in list mode. this reduced needed mem from 2M to 512 bytes * ... (much more changes) ******************************************************************************* amiga-fdisk-0.04.orig/amiga-fdisk.80100644000175000017500000000242606617464005016422 0ustar lutherluther.TH AMIGA-FDISK 8 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection .\" other parms are allowed: see man(7), man(1) .SH NAME amiga-fdisk \- Amiga disk partitioning program .SH SYNOPSIS .B amiga-fdisk [ .B \-l ] [ .B \-v ] .I device .SH DESCRIPTION .B amiga-fdisk is a program to partition harddisks under Linux/m68k. It uses command line parameters similar to those of the PC .B fdisk program, and operates on the disk associated with \fIdevice\fR. In interactive mode, it behaves similarly to the .B fdisk program. .SH OPTIONS .TP .B \-l List partition tables of all disks. If this flag is given, interactive mode isn't entered. .TP .B \-v Show version of the program. .SH BUGS Many of the command line options known from .B fdisk have not been implemented yet. .LP Using .B amiga-fdisk on large harddisks (like larger than 2 GB) consumes lots of memory, as the program currently tries to read in the entire RDB blocks \- which can be several MB if the (reported) geometry of the disk says so (the RDB occupies the first two cylinders of the disk). .LP The whole stuff about interactive usage of .B amiga-fdisk in this manpage still has to be written. .SH AUTHORS Stefan Reinauer (author) .LP Frank Neumann (manpage) amiga-fdisk-0.04.orig/amiga-fdisk-0.04.lsm0100644000175000017500000000111706617464005017421 0ustar lutherlutherBegin3 Title: Fdisk for Amiga RDB harddisks Version: 0.04 Entered-date: 98/11/03 Description: An fdisk implementation for hard disks using the Rigid Disk Block (RDB=Amiga m68k stuff). This tool works on little endian Linux platforms, too. Keywords: fdisk affs RDB amiga partition disklabel Author: Stefan Reinauer Maintained-by: Stefan Reinauer Primary-site: http://www.freiburg.linux.de/~stepan/ 30k amiga-fdisk-0.04.tar.gz Alternate-site: sunsite.unc.edu /pub/Linux/system/Misc Original-site: Platform: any Linux System Copying-policy: GPL End amiga-fdisk-0.04.orig/ToDo0100644000175000017500000000266406617464005014751 0ustar lutherlutherNice Features/Bugs to fix: * cfdisk like gui would be nice (using curses maybe) * create MBR from RDB, create RDB from MBR add a feature to read in an ms-dos partition-sector and build an RDB from it. (Should be compatibly reside on the same disk, as the RDB may start anywhere within the first 16 blocks. * implement full fdisk funktionality / all options of MBR Version (fdisk 3.x) * use variable blocksize (currently fixed to 512 byte ) * Option to change rdb->rdb_LoCylinder. BE CAREFUL! * I noticed some segfaults when moving RDB to the upper end-1 and then adding a partition. (96/09) * reorg to last possible block, then reorg back to last possible -1 try to create a new partition. Hmmm... Weird. (96/09) * The RedHat m68k Linux 'group' have been seeing segfaults from afdisk when altering/deleting AFFS DirCache partitions. (98/04) segfault in if (room_for_partition()!=-1) { /* Already done? */ * I suspect problems with blocks that have a valid id but are not connected to the rdb. These can occur when one deletes a partition. They should be found and marked out by countblk and findblk * boot priority can't be negative at the moment * rigiddisk_correct "corrects" checksums of all rdb blocks, even if they don't belong to rdb. This could i.e. destroy an MBR. * check whether block->next is a valid block. if it is not, set to -1. (This is already done in LSEG and BBB) * Interpret reserved blocks!!!