debian/0000755000000000000000000000000011635126062007170 5ustar debian/control0000644000000000000000000000110711635126061010571 0ustar Source: acorn-fdisk Section: admin Priority: optional Maintainer: Debian QA Group Build-Depends: debhelper (>> 7) Standards-Version: 3.9.2 Homepage: http://www.arm.linux.org.uk/machines/riscpc/stage-2/ Package: acorn-fdisk Architecture: linux-any kfreebsd-any Depends: ${misc:Depends}, ${shlibs:Depends} Description: partition editor for Acorn/RISC OS machines Acorn-fdisk allows you to edit disk partitions on Acorn machines. It understands a variety of the partition tables formats used under RISC OS, including Filecore, ICS-IDE, EESOX and Powertec. debian/compat0000644000000000000000000000000211635126061010365 0ustar 7 debian/docs0000644000000000000000000000001011635126061010031 0ustar README debian/rules0000755000000000000000000000233111635126061010246 0ustar #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 CFLAGS := $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) CFLAGS += -Wall -Wformat build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp: dh_testdir $(MAKE) CPPFLAGS='$(CPPFLAGS)' CFLAGS='$(CFLAGS)' \ LDFLAGS='$(LDFLAGS)' STRIP='# ' touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. $(MAKE) clean dh_clean binary-indep: binary-arch: build-stamp dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/acorn-fdisk. $(MAKE) install DESTDIR=$(CURDIR)/debian/acorn-fdisk find $(CURDIR)/debian/acorn-fdisk -type d -empty -delete dh_installdocs dh_installexamples dh_installmenu dh_installcron dh_installman dh_installinfo dh_installchangelogs ChangeLog dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build-arch build-indep build clean binary-indep binary-arch binary debian/watch0000644000000000000000000000014711635126061010222 0ustar version=3 http://ftp.arm.linux.org.uk/pub/armlinux/source/other/arm-fdisk-(.*)\.tar\.gz debian uupdate debian/source/0000755000000000000000000000000011635126061010467 5ustar debian/source/format0000644000000000000000000000001411635126061011675 0ustar 3.0 (quilt) debian/copyright0000644000000000000000000000413511635126061011125 0ustar This package was debianized by Philip Blundell on Sat, 10 Nov 2001 16:13:13 +0000. It was downloaded from ftp.arm.linux.org.uk:/pub/armlinux/source/other/ Upstream Author: Russell King - ARM Linux Copyright: The gros of this code is Copyright (C) 1997,1998 Russell King THIS SOFTWARE IS PROVIDED `AS IS'. THE AUTHOR MAKES NO WARRANTY, EXPRESS OR IMPLIED OF ANY KIND, INCLUDING BUT NOT LIMITED TO THE MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR OF THIS SOFTWARE BE LIABLE FOR DAMAGES INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. According to the author’s message pasted below, it is covered by the “GPL” since it contains “the original” fdisk.c which has been tracked down to be the one from util-linux. The fdisk.c source file in util-linux and Slackware 3.3 bears the following copyright notice: Copyright (C) 1992 A. V. Le Blanc (LeBlanc@mcc.ac.uk) 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. While the GPL version 1 does not come with the Debian system, a later version can be found in ‘/usr/share/common-licenses/GPL-2’ on Debian systems. Subject: Re: fdisk From: Russell King - ARM Linux Date: Sat, 10 Nov 2001 15:31:44 +0000 To: pb@nexus.co.uk On Sat, Nov 10, 2001 at 03:20:42PM +0000, pb@nexus.co.uk wrote: > >ftp.arm.linux.org.uk:/pub/armlinux/source/other/ > > Thanks. > > This program doesn't seem to contain any explicit licence statement. > What are the terms? GPL, since it contains the original fdisk.c source, which was used as a basis for creating this. debian/changelog0000644000000000000000000001111611635126061011041 0ustar acorn-fdisk (3.0.6-8) unstable; urgency=low * QA upload * split diff into historic patches, change format to 3.0 (quilt) * lower-case short description * bump Standards-Version * modernize debian/rules: - switch to debhelper compatibility 7, using dh_prep - use dpkg-buildflags - support build-arch, build-indep * fix manpage as suggested by lintian * silence lintian's helper-templates-in-copyright -- Bernhard R. Link Sat, 17 Sep 2011 16:13:51 +0200 acorn-fdisk (3.0.6-7) unstable; urgency=low * QA upload. * Acknowledge NMU (Closes: #366447) (Closes: #552791) (Closes: #563996) Thanks Martin! * Apply my patch from January 2010 (Closes: #563522) + fix compiler warnings: - fdisk.c: passing … from incompatible pointer type - lib/scheme/icside.c: dereferencing … does break strict-aliasing rules XXX there might be an endianness issue left from the original code - lib/scheme/pcbios.c: array subscript is above array bounds - lib/scheme/pcbios.c: use of uninitialised value + fix lintian warnings: - debhelper-but-no-misc-depends - debian-rules-ignores-make-clean-error - spelling-error-in-binary - unknown-section base - package-contains-empty-directory + debian/watch: new file (took me some time to track down upstream tho) + debian/control: add Homepage (as close to one as I could find) + debian/manpages, debian/acorn-fdisk.8: new files * Extend the manual page, obsoletes another bug (Closes: #436190) * Set maintainer to QA group. (I will however keep an eye on this package and, while not promising, might take it over. Not now.) * Add debian/source/format (preferring 1.0 at the moment) * Port this to GNU/kFreeBSD (some ideas from util-linux, 10x) * Disable building on GNU/Hurd until we have a way to port it * Fix more compiler warnings (format strings, unused variables) * Support short options in addition to GNU --long-options * Honour dpkg CFLAGS during build * debian/dirs: remove, not needed * debian/README.source: new, describe TODO -- Thorsten Glaser Sat, 02 Oct 2010 18:45:24 +0000 acorn-fdisk (3.0.6-6.4) unstable; urgency=low * Non-maintainer upload. * debian/control: Change Maintainer eMail address to a working one, as requested by Phil Blundell. (Closes: #563996) -- Thorsten Glaser Fri, 22 Jan 2010 17:51:57 +0000 acorn-fdisk (3.0.6-6.3) unstable; urgency=low * Non-maintainer upload. * debian/copyright: Expand on the actual copyright owners (track down fdisk.c) and point to a copy of an applicable licence; explain which ones are applicable and why. (Closes: #552791) -- Thorsten Glaser Thu, 31 Dec 2009 16:41:44 +0000 acorn-fdisk (3.0.6-6.2) unstable; urgency=low * NMU * Remove the udeb again because RiscPC machines are no longer supported by debian-installer. -- Martin Michlmayr Sat, 14 Apr 2007 14:38:53 -0700 acorn-fdisk (3.0.6-6.1) unstable; urgency=low * NMU * Add a udeb for debian-installer, closes: #366447. * Move to debhelper 5. -- Martin Michlmayr Fri, 12 May 2006 17:24:11 +0200 acorn-fdisk (3.0.6-6) unstable; urgency=low * Apply patch from Peter Naulls to fix assorted bugs: - Adds LBA support, and related additions to ensure fields are 64-bit where required - Corrects some prompting behaviour - Improves some debugging with function names - Remove an assertion that is no longer valid under LBA, and therefore allow writing partitions to work again. Closes: #241128 -- Philip Blundell Wed, 31 Mar 2004 09:45:43 +0100 acorn-fdisk (3.0.6-5) unstable; urgency=medium * Fix uninitialised variable in RISCiX partition reader, closes: #157697 -- Philip Blundell Tue, 20 Aug 2002 23:47:04 +0100 acorn-fdisk (3.0.6-4) unstable; urgency=low * Avoid use of kernel headers in fdisk.c (was breaking ARM build) -- Philip Blundell Sat, 22 Dec 2001 23:21:06 +0000 acorn-fdisk (3.0.6-3) unstable; urgency=low * Remove "my_llseek" from blkio/write.c also; closes: #123365 -- Philip Blundell Sat, 22 Dec 2001 16:21:39 +0000 acorn-fdisk (3.0.6-2) unstable; urgency=low * Set _FILE_OFFSET_BITS=64 for blkio library and remove "my_llseek" hack, closes: #123365 -- Philip Blundell Sun, 16 Dec 2001 13:53:51 +0000 acorn-fdisk (3.0.6-1) unstable; urgency=low * Initial Release. -- Philip Blundell Sat, 10 Nov 2001 16:13:13 +0000 Local variables: mode: debian-changelog End: debian/patches/0000755000000000000000000000000011635126062010617 5ustar debian/patches/0009-port-this-to-GNU-kFreeBSD.patch0000644000000000000000000000424711635126062016620 0ustar From e84cd0ade3151a118575388968bc5cd774650926 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sat, 2 Oct 2010 18:45:24 +0000 Subject: port this to GNU/kFreeBSD (some ideas from util-linux, 10x) --- fdisk.c | 10 +++++++++- lib/blkio/open.c | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/fdisk.c b/fdisk.c index 1220767..7bb8a0a 100644 --- a/fdisk.c +++ b/fdisk.c @@ -64,7 +64,7 @@ parse_args(int argc, char *argv[]) int opt; do { - opt = getopt_long(argc, argv, "s:l", options, NULL); + opt = getopt_long(argc, argv, "hls:t:v", options, NULL); switch(opt) { case 'h': @@ -632,6 +632,7 @@ write_tables(void) } printf("The partition table has been altered!\n\n"); +#ifdef BLKRRPART printf("Syncing disks..."); fflush(stdout); sync(); @@ -656,6 +657,7 @@ write_tables(void) if (i < 0) printf("FAILED!\n"); +#endif printf("Syncing disks..."); fflush(stdout); @@ -663,6 +665,12 @@ write_tables(void) sleep(4); printf("OK\n"); +#ifndef BLKRRPART + printf("Note:\tre-reading the partition table is not supported\n" + "\ton this operating system.\n"); + i = ENOSYS; +#endif + if (i < 0) printf("\n*** Re-read table failed with error %d: %s ***\n" " Reboot your system to ensure the partition table is\n" diff --git a/lib/blkio/open.c b/lib/blkio/open.c index 83e4894..be523df 100644 --- a/lib/blkio/open.c +++ b/lib/blkio/open.c @@ -334,7 +334,9 @@ blkio_t *blkio_open (const char *dev_name) dbg_level_up (); do { +#ifdef HDIO_GETGEO struct hd_geometry geometry; +#endif blkio = zmalloc (sizeof (blkio_t)); if (blkio == NULL) @@ -351,6 +353,7 @@ blkio_t *blkio_open (const char *dev_name) break; } +#ifdef HDIO_GETGEO if (!ioctl(blkio->fd, HDIO_GETGEO, &geometry)) { uint64_t length; int sector_size; @@ -368,7 +371,9 @@ blkio_t *blkio_open (const char *dev_name) blkio->geometry.cylinders = (length / sector_size) / (geometry.heads * geometry.sectors); } - } else { + } else +#endif + { blkio->geometry.cylinders = 1024; blkio->geometry.heads = 16; blkio->geometry.sectors = 63; debian/patches/0003-avoid-use-of-kernel-headers-in-fdisk.c-was-breaking-.patch0000644000000000000000000000222711635126062023760 0ustar From 1169714c37ba3a293e316ab497a3f13f22fab66c Mon Sep 17 00:00:00 2001 From: Philip Blundell Date: Sat, 22 Dec 2001 23:21:06 +0000 Subject: avoid use of kernel headers in fdisk.c (was breaking ARM build) --- fdisk.c | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-) diff --git a/fdisk.c b/fdisk.c index 67953eb..b42d30d 100644 --- a/fdisk.c +++ b/fdisk.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -11,10 +12,9 @@ #include #include #include -#include -#include #include #include +#include #include "part/part.h" #include "util/error.h" @@ -204,18 +204,6 @@ static u_int display_factor = 1; /* in units/sector */ static u_int full_bits = 0; /* 1024 cylinders in sectors */ static bool_t unit_flag = 1; -static u_int -rounded(u_int calcul, u_int start) -{ - u_int i; - - if (!full_bits) - return calcul; - while ((i = calcul + full_bits) <= start) - calcul = i; - return calcul; -} - static void update_units(part_t *part) { debian/patches/0006-fix-compiler-warnings.patch0000644000000000000000000000501311635126062016446 0ustar From 96e042ea32c2b4d997a0502fd0d5e69848690c77 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sun, 3 Jan 2010 16:00:02 +0000 Subject: fix compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fdisk.c: passing … from incompatible pointer type - lib/scheme/icside.c: dereferencing … does break strict-aliasing rules XXX there might be an endianness issue left from the original code - lib/scheme/pcbios.c: array subscript is above array bounds - lib/scheme/pcbios.c: use of uninitialised value Bug-Debian: 563522 --- fdisk.c | 2 +- lib/scheme/icside.c | 5 ++++- lib/scheme/pcbios.c | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fdisk.c b/fdisk.c index 95c5830..1a81f72 100644 --- a/fdisk.c +++ b/fdisk.c @@ -859,7 +859,7 @@ int main(int argc, char *argv[]) case mode_list: if (optind < argc) - ret = print_part_tables(argc - optind, argv + optind); + ret = print_part_tables(argc - optind, (const char **)argv + optind); else ret = print_part_tables(NR_DEVICES, part_devs); break; diff --git a/lib/scheme/icside.c b/lib/scheme/icside.c index 88766d4..f2b20ab 100644 --- a/lib/scheme/icside.c +++ b/lib/scheme/icside.c @@ -193,6 +193,7 @@ icside_writeinfo(part_t *part) { icside_pe_t sector; u_int part_no, ret = 0; + unsigned long csum; dbg_printf("icside_writeinfo()"); dbg_level_up(); @@ -234,7 +235,9 @@ icside_writeinfo(part_t *part) assert(0); } } - *(unsigned long *)§or.sector[508] = icside_checksum(sector.sector); + /* XXX possible endianness issue */ + csum = icside_checksum(sector.sector); + memcpy(§or.sector[508], &csum, sizeof(csum)); #ifdef ICSIDE_DUMP dbg_memdump(sector.sector, ICSIDE_SECTOR_SIZE); diff --git a/lib/scheme/pcbios.c b/lib/scheme/pcbios.c index c9da581..a612bc6 100644 --- a/lib/scheme/pcbios.c +++ b/lib/scheme/pcbios.c @@ -217,7 +217,12 @@ pcbios_readinfo(part_t *part) p = part->data.pcbios.pcboot_sector + 0x1be; +#if 0 if (valid && chs.cylinder == 0) { + /* } chs is uninitialised here */ +#else + if (valid) { +#endif /* * Attempt to calculate the size of one track * track_size = (start_log / (cyl * head) - sector @@ -572,7 +577,7 @@ pcbios_nexttype(part_t *part, u_int parn, ptyp_t current, int dir) if (types[i] == current) break; - if (types[i] == current) { + if (i < NR_TYPES && types[i] == current) { i += dir; if (i < 0) debian/patches/0001-fix-usage-of-preprocessor-and-compilation-variables-.patch0000644000000000000000000000751411635126062024342 0ustar From ba41e643dd052a994de80511c9d3a56cf91a9ea8 Mon Sep 17 00:00:00 2001 From: Bernhard R. Link Date: Sat, 17 Sep 2011 14:56:06 +0200 Subject: fix usage of preprocessor and compilation variables and add a install target --- Makefile | 15 +++++++++++---- lib/blkio/Makefile | 6 ++++-- lib/part/Makefile | 6 ++++-- lib/scheme/Makefile | 6 ++++-- lib/util/Makefile | 6 ++++-- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index e1682be..e316698 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ STRIP =strip -#CFLAGS =-DUNIX -DVERSION=\"$(VERSION)\" -O2 -Wall -fomit-frame-pointer -Ilib -pipe -CFLAGS =-DUNIX -DVERSION=\"$(VERSION)\" -O2 -Wall -g -Ilib -pipe -LDFLAGS =-N +CFLAGS = -O2 -Wall -g +M_CPPFLAGS = -DUNIX -DVERSION=\"$(VERSION)\" -Ilib +CPPFLAGS = +LDFLAGS = LIBS =lib/part.a lib/scheme.a lib/blkio.a lib/util.a TAR =tar VERSION =3.0.6 +INSTALL =install FDISKOBJS =fdisk.o #partitions.o utils.o @@ -20,9 +22,13 @@ tar: clean (cd ..; $(TAR) zcf arm-fdisk-$(VERSION).tar.gz arm-fdisk-$(VERSION)) fdisk: $(FDISKOBJS) $(LIBS) - $(CC) $(LDFLAGS) -o $@ $(FDISKOBJS) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(FDISKOBJS) $(LIBS) $(STRIP) --discard-locals $@ +install: + mkdir -p $(DESTDIR)/sbin + $(INSTALL) fdisk $(DESTDIR)/sbin/acorn-fdisk + .PHONY: lib/part.a lib/scheme.a lib/blkio.a lib/util.a lib/part.a:; @$(MAKE) -C lib/part @@ -30,3 +36,4 @@ lib/scheme.a:; @$(MAKE) -C lib/scheme lib/blkio.a:; @$(MAKE) -C lib/blkio lib/util.a:; @$(MAKE) -C lib/util +.c.o:; $(CC) $(M_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< diff --git a/lib/blkio/Makefile b/lib/blkio/Makefile index a9043fa..8423fcc 100644 --- a/lib/blkio/Makefile +++ b/lib/blkio/Makefile @@ -1,7 +1,9 @@ AR = ar CC = cc ARFLAGS = rc -CFLAGS = -DUNIX -O2 -Wall -I.. -g +CFLAGS = -O2 -Wall -g +M_CPPFLAGS = -DUNIX -I.. +CPPFLAGS = OBJS = close.o getgeo.o open.o read.o setblocksz.o setgeo.o write.o LIB = ../blkio.a @@ -13,4 +15,4 @@ clean:; $(RM) $(LIB) *.o $(LIB): $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -.c.o:; $(CC) $(CFLAGS) -o $@ -c $< +.c.o:; $(CC) $(M_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< diff --git a/lib/part/Makefile b/lib/part/Makefile index 43f43a1..4d651f2 100644 --- a/lib/part/Makefile +++ b/lib/part/Makefile @@ -1,7 +1,9 @@ AR = ar CC = cc ARFLAGS = rc -CFLAGS = -DUNIX -O2 -Wall -I.. -g +CFLAGS = -O2 -Wall -g +M_CPPFLAGS = -DUNIX -I.. +CPPFLAGS = SQUEEZE = squeeze OBJS = allocate.o close.o create.o delete.o \ @@ -17,4 +19,4 @@ clean:; $(RM) $(LIB) *.o $(LIB): $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -.c.o:; $(CC) $(CFLAGS) -o $@ -c $< +.c.o:; $(CC) $(M_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< diff --git a/lib/scheme/Makefile b/lib/scheme/Makefile index 352641a..368189b 100644 --- a/lib/scheme/Makefile +++ b/lib/scheme/Makefile @@ -1,7 +1,9 @@ AR = ar CC = cc ARFLAGS = rc -CFLAGS = -DUNIX -O2 -Wall -I.. -g +CFLAGS = -O2 -Wall -g +M_CPPFLAGS = -DUNIX -I.. +CPPFLAGS = OBJS = add.o chs.o overlap.o filecore.o icside.o \ linux.o pcbios.o powertec.o riscix.o eesox.o @@ -14,5 +16,5 @@ clean:; $(RM) $(LIB) *.o $(LIB): $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -.c.o:; $(CC) $(CFLAGS) -o $@ -c $< +.c.o:; $(CC) $(M_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< diff --git a/lib/util/Makefile b/lib/util/Makefile index c7b1a23..ac421cb 100644 --- a/lib/util/Makefile +++ b/lib/util/Makefile @@ -1,7 +1,9 @@ AR = ar CC = cc ARFLAGS = rc -CFLAGS = -DUNIX -O2 -Wall -I.. -g +CFLAGS = -O2 -Wall -g +M_CPPFLAGS = -DUNIX -I.. +CPPFLAGS = OBJS = debug.o strcscmp.o zmalloc.o error.o warning.o LIB = ../util.a @@ -13,4 +15,4 @@ clean:; $(RM) $(LIB) *.o $(LIB): $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -.c.o:; $(CC) $(CFLAGS) -o $@ -c $< +.c.o:; $(CC) $(M_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< debian/patches/0002-set-_FILE_OFFSET_BITS-64-for-blkio-library-and-remov.patch0000644000000000000000000000517011635126062023221 0ustar From bbfde6fb367238b0b20f9b46db3b63936d55aedf Mon Sep 17 00:00:00 2001 From: Philip Blundell Date: Sun, 16 Dec 2001 13:53:51 +0000 Subject: set _FILE_OFFSET_BITS=64 for blkio library and remove "my_llseek" hack Bug-Debian: 123365 --- lib/blkio/Makefile | 2 +- lib/blkio/open.c | 1 + lib/blkio/read.c | 10 ++++++++++ lib/blkio/write.c | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletions(-) diff --git a/lib/blkio/Makefile b/lib/blkio/Makefile index 8423fcc..f335ac6 100644 --- a/lib/blkio/Makefile +++ b/lib/blkio/Makefile @@ -2,7 +2,7 @@ AR = ar CC = cc ARFLAGS = rc CFLAGS = -O2 -Wall -g -M_CPPFLAGS = -DUNIX -I.. +M_CPPFLAGS = -DUNIX -I.. -D_FILE_OFFSET_BITS=64 CPPFLAGS = OBJS = close.o getgeo.o open.o read.o setblocksz.o setgeo.o write.o diff --git a/lib/blkio/open.c b/lib/blkio/open.c index a533420..21fc7b1 100644 --- a/lib/blkio/open.c +++ b/lib/blkio/open.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "util/debug.h" #include "util/error.h" diff --git a/lib/blkio/read.c b/lib/blkio/read.c index a3ff0d3..7cc6961 100644 --- a/lib/blkio/read.c +++ b/lib/blkio/read.c @@ -7,6 +7,8 @@ * * Read data from device on RiscOS architecture */ +#include + #include "util/debug.h" #include "util/error.h" #include "blkio.h" @@ -64,6 +66,12 @@ static u_int read_block(blkio_t *blkio, void *data, blk_t block, u_int nr_blocks #include #include +#if _FILE_OFFSET_BITS == 64 + +#define my_llseek lseek + +#else + #undef SYS__llseek #define SYS__llseek (__NR__llseek - __NR_SYSCALL_BASE) @@ -82,6 +90,8 @@ static loff_t my_llseek(int fd, loff_t off, int whence) return off; } +#endif + static u_int read_block(blkio_t *blkio, void *data, blk_t block, u_int nr_blocks) { u_int len, res = 0; diff --git a/lib/blkio/write.c b/lib/blkio/write.c index 9e4532c..7bab35e 100644 --- a/lib/blkio/write.c +++ b/lib/blkio/write.c @@ -7,6 +7,8 @@ * * Write data to device on RiscOS architecture */ +#include + #include "util/debug.h" #include "util/error.h" #include "blkio.h" @@ -64,6 +66,12 @@ static u_int write_block(blkio_t *blkio, const void *data, blk_t block, u_int nr #include #include +#if _FILE_OFFSET_BITS == 64 + +#define my_llseek lseek + +#else + #undef SYS__llseek #define SYS__llseek (__NR__llseek - __NR_SYSCALL_BASE) @@ -82,6 +90,8 @@ static loff_t my_llseek(int fd, loff_t off, int whence) return off; } +#endif + static u_int write_block(blkio_t *blkio, const void *data, blk_t block, u_int nr_blocks) { u_int len, res = 0; debian/patches/0007-fix-lintian-warning-spelling-error-in-binary.patch0000644000000000000000000000144211635126062022742 0ustar From c235e427c2dd78758292b73c212573fd70c3ed04 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sun, 3 Jan 2010 16:00:02 +0000 Subject: fix lintian warning: spelling-error-in-binary --- fdisk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fdisk.c b/fdisk.c index 1a81f72..eb86157 100644 --- a/fdisk.c +++ b/fdisk.c @@ -676,7 +676,7 @@ show_main_menu (void) " n add a new partition\n" " p print the partition table\n" " q quit without saving changes\n" - " r reopen partition, specifing type\n" + " r reopen partition, specifying type\n" " t change a partition's system id\n" " u change display/entry units\n" // " v verify the partition table\n" debian/patches/series0000644000000000000000000000071211635126061012033 0ustar 0001-fix-usage-of-preprocessor-and-compilation-variables-.patch 0002-set-_FILE_OFFSET_BITS-64-for-blkio-library-and-remov.patch 0003-avoid-use-of-kernel-headers-in-fdisk.c-was-breaking-.patch 0004-fix-uninitialised-variable-in-RISCiX-partition-reade.patch 0005-patches-for-LBA-and-others.patch 0006-fix-compiler-warnings.patch 0007-fix-lintian-warning-spelling-error-in-binary.patch 0008-fix-more-compiler-warnings.patch 0009-port-this-to-GNU-kFreeBSD.patch debian/patches/0008-fix-more-compiler-warnings.patch0000644000000000000000000000513011635126062017410 0ustar From a7f86d31409a5b543786a04c9752b770e45c0995 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sat, 2 Oct 2010 18:45:24 +0000 Subject: fix more compiler warnings format strings, unused variables --- fdisk.c | 16 ++++++++++------ lib/blkio/setgeo.c | 5 ++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fdisk.c b/fdisk.c index eb86157..1220767 100644 --- a/fdisk.c +++ b/fdisk.c @@ -513,25 +513,27 @@ list_table(list_t list_type) continue; if (list_type == LIST_NORMAL) { - printf("%*s%-2d %c%9d%9d%9d%11lld%c %4x %s\n", + printf("%*s%-2d %c%9d%9d%9d%11llu%c %4x %s\n", w - 1, device, info.kern_part_no, ' ', sectors_to_units(calculate(part, info.chs_start.head, info.chs_start.sector, info.chs_start.cylinder)), sectors_to_units(info.blk_start), sectors_to_units(info.blk_end + (info.blk_end & 1 ? 0 : 1)), - (info.blk_end - info.blk_start + 1) / 2, + (unsigned long long)((info.blk_end - info.blk_start + 1) / 2), (info.blk_end - info.blk_start + 1) & 1 ? '+' : ' ', info.type, part_typename(part, info.type)); // check_consistency (part, p); } else { - printf("%2d %02x%4d%4d%5d%4d%4d%5d%12lld%12lld %03x\n", + printf("%2d %02x%4d%4d%5d%4d%4d%5d%12llu%12llu %03x\n", info.kern_part_no, 0, info.chs_start.head, info.chs_start.sector, info.chs_start.cylinder, info.chs_end.head, info.chs_end.sector, - info.chs_end.cylinder, info.blk_start, - info.blk_end - info.blk_start + 1, info.type); + info.chs_end.cylinder, + (unsigned long long)info.blk_start, + (unsigned long long)(info.blk_end - info.blk_start + 1), + info.type); // if (info.type != ptyp_none) // check_consistency (part, p); } @@ -567,7 +569,9 @@ print_part_size(const char *device) while(part_getpartinfo(part, i, &info)) { if (info.kern_part_no == partition) { - printf("%lld\n", (info.blk_end - info.blk_start + 1) / 2); + printf("%llu\n", + (unsigned long long)((info.blk_end - + info.blk_start + 1) / 2)); ret = pps_ret_ok; break; } diff --git a/lib/blkio/setgeo.c b/lib/blkio/setgeo.c index bef02a9..05fc89b 100644 --- a/lib/blkio/setgeo.c +++ b/lib/blkio/setgeo.c @@ -23,7 +23,10 @@ */ u_int blkio_setgeometry (blkio_t *blkio, const geometry_t *geo) { - u_int log2secsize, sectors, ret = 0; + u_int ret = 0; +#if defined(RISCOS) + u_int log2secsize, sectors; +#endif assert (blkio != NULL); assert (geo != NULL); debian/patches/0004-fix-uninitialised-variable-in-RISCiX-partition-reade.patch0000644000000000000000000000176311635126062024170 0ustar From 1d3ff34d535c49716ab9a208dcdfeeb1b01c7cc2 Mon Sep 17 00:00:00 2001 From: Philip Blundell Date: Tue, 20 Aug 2002 23:47:04 +0100 Subject: fix uninitialised variable in RISCiX partition reader Bug-Debian: 157697 --- lib/scheme/riscix.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/scheme/riscix.c b/lib/scheme/riscix.c index f130c30..0f50630 100644 --- a/lib/scheme/riscix.c +++ b/lib/scheme/riscix.c @@ -62,9 +62,6 @@ riscix_detect(part_t *part) if (calc_csum != disc_csum) break; - part->data.riscix.disc_record = *disc_record; - part->data.riscix.boot_checksum = sector[511]; - /* * Check that we do not have a sector filled with zero */ @@ -72,6 +69,9 @@ riscix_detect(part_t *part) if (disc_record->d.disc_size == 0 && disc_record->d.disc_size_high == 0) break; + part->data.riscix.disc_record = *disc_record; + part->data.riscix.boot_checksum = sector[511]; + ret = 1; } while (0); debian/patches/0005-patches-for-LBA-and-others.patch0000644000000000000000000002327011635126062017077 0ustar From c5e3dc2887336af13728a636a0aebe3ccb288e46 Mon Sep 17 00:00:00 2001 From: Peter Naulls Date: Tue, 30 Mar 2004 22:52:11 +0100 Subject: patches for LBA and others This patch fixes a number of issues with acorn-fdisk that make it otherwise unsuable in practice. * Adds LBA support, and related additions to ensure fields are * 64-bit where required * Corrects some prompting behaviour * Improves some debugging with function names * Remove an assertion that is no longer valid under LBA, and * therefore allow writing partitions to work again. Bug-Debian: 241128 --- fdisk.c | 16 ++++++++-------- lib/blkio/blkio.h | 2 +- lib/blkio/open.c | 22 +++++++++++++++++++--- lib/part/allocate.c | 2 +- lib/part/create.c | 2 +- lib/part/getpinfo.c | 2 +- lib/part/types.c | 6 +++++- lib/scheme/linux.c | 27 +++++++++++++++++++-------- 8 files changed, 55 insertions(+), 24 deletions(-) diff --git a/fdisk.c b/fdisk.c index b42d30d..95c5830 100644 --- a/fdisk.c +++ b/fdisk.c @@ -267,7 +267,7 @@ delete_partition(void) return; } - if (!part_validops(part, part_no, &info) & VALIDOPS_DELETE) { + if (!(part_validops(part, part_no, &info) & VALIDOPS_DELETE)) { printf("Partition %d cannot be deleted.\n", info.kern_part_no); return; @@ -282,8 +282,8 @@ delete_partition(void) struct regions { struct { - u_int start; - u_int end; + u_int64_t start; + u_int64_t end; } region[16]; u_int nr; }; @@ -438,7 +438,7 @@ change_type(void) return; } - if (!part_validops(part, part_no, &info) & VALIDOPS_UPDATE) { + if (!(part_validops(part, part_no, &info) & VALIDOPS_UPDATE)) { printf("Partition %d cannot be altered.\n", info.kern_part_no); return; } @@ -502,7 +502,7 @@ list_table(list_t list_type) if (w < 6) w = 6; - printf("%*s Boot Begin Start End Blocks Id System\n", + printf("%*s Boot Begin Start End Blocks Id System\n", w, "Device"); } else printf("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n"); @@ -513,7 +513,7 @@ list_table(list_t list_type) continue; if (list_type == LIST_NORMAL) { - printf("%*s%-2d %c%9d%9d%9d%9d%c %3x %s\n", + printf("%*s%-2d %c%9d%9d%9d%11lld%c %4x %s\n", w - 1, device, info.kern_part_no, ' ', sectors_to_units(calculate(part, info.chs_start.head, info.chs_start.sector, @@ -526,7 +526,7 @@ list_table(list_t list_type) part_typename(part, info.type)); // check_consistency (part, p); } else { - printf("%2d %02x%4d%4d%5d%4d%4d%5d%8d%8d %03x\n", + printf("%2d %02x%4d%4d%5d%4d%4d%5d%12lld%12lld %03x\n", info.kern_part_no, 0, info.chs_start.head, info.chs_start.sector, info.chs_start.cylinder, info.chs_end.head, info.chs_end.sector, @@ -567,7 +567,7 @@ print_part_size(const char *device) while(part_getpartinfo(part, i, &info)) { if (info.kern_part_no == partition) { - printf("%d\n", (info.blk_end - info.blk_start + 1) / 2); + printf("%lld\n", (info.blk_end - info.blk_start + 1) / 2); ret = pps_ret_ok; break; } diff --git a/lib/blkio/blkio.h b/lib/blkio/blkio.h index 1bbac90..c36532b 100644 --- a/lib/blkio/blkio.h +++ b/lib/blkio/blkio.h @@ -12,7 +12,7 @@ #include "util/types.h" -typedef u_int blk_t; +typedef u_int64_t blk_t; typedef struct { u_int cylinders; diff --git a/lib/blkio/open.c b/lib/blkio/open.c index 21fc7b1..83e4894 100644 --- a/lib/blkio/open.c +++ b/lib/blkio/open.c @@ -144,7 +144,8 @@ static int split_fs_name (const char *dev_name, char *fs_name, char *drive_name) static void set_disc_geometry (blkio_t *blkio, geometry_t *geo) { - u_int log2secsize, sectors, update_disc_record = 0; + u_int64 sectors; + u_int log2secsize, update_disc_record = 0; log2secsize = blkio->disc_record->d.log2secsize; sectors = (blkio->disc_record->d.disc_size_high << (32 - log2secsize)) | @@ -220,7 +221,7 @@ static void set_disc_geometry (blkio_t *blkio, geometry_t *geo) */ blkio_t *blkio_open (const char *dev_name) { - /* On RiscOS, dev_name is something like 'ADFS::4....' */ + /* On RISC OS, dev_name is something like 'ADFS::4....' */ blkio_t *blkio = NULL; char fs_name[MAX_FS_NAME], drive_name[MAX_DRIVE_NAME]; @@ -307,9 +308,13 @@ blkio_t *blkio_open (const char *dev_name) #include #include #include +#include + +typedef uint64_t u64; #ifdef linux #include +#include #endif /* Function: blkio_t *blkio_open (const char *dev_name) @@ -319,7 +324,7 @@ blkio_t *blkio_open (const char *dev_name) */ blkio_t *blkio_open (const char *dev_name) { - /* On RiscOS, dev_name is something like 'ADFS::4....' */ + /* On RISC OS, dev_name is something like 'ADFS::4....' */ blkio_t *blkio = NULL; assert (dev_name != NULL); @@ -347,11 +352,22 @@ blkio_t *blkio_open (const char *dev_name) } if (!ioctl(blkio->fd, HDIO_GETGEO, &geometry)) { + uint64_t length; + int sector_size; + blkio->geometry.cylinders = geometry.cylinders; blkio->geometry.heads = geometry.heads; blkio->geometry.sectors = geometry.sectors; blkio->geometry.sector_size = 512; blkio->geometry.log2secsize = 9; + + if (!ioctl(blkio->fd, BLKGETSIZE64, &length) && + !ioctl(blkio->fd, BLKSSZGET, §or_size)) { + dbg_printf ("-length: %lld sector_size: %d", length, sector_size); + + blkio->geometry.cylinders = (length / sector_size) / (geometry.heads * geometry.sectors); + } + } else { blkio->geometry.cylinders = 1024; blkio->geometry.heads = 16; diff --git a/lib/part/allocate.c b/lib/part/allocate.c index 075130a..82731df 100644 --- a/lib/part/allocate.c +++ b/lib/part/allocate.c @@ -58,7 +58,7 @@ u_int part_allocate(part_t *part, partinfo_t *pinfo) } } } else if (!is_error_set()) - set_error("invalid partition number %d", parn); + set_error("part_allocate: invalid partition number %d", parn); } while (0); dbg_level_down(); diff --git a/lib/part/create.c b/lib/part/create.c index d49bb1f..783f9bc 100644 --- a/lib/part/create.c +++ b/lib/part/create.c @@ -76,7 +76,7 @@ u_int part_create(part_t *part, u_int parn, const partinfo_t *pinfo) } } } else if (!is_error_set()) - set_error("invalid partition number %d", parn); + set_error("part_create: invalid partition number %d", parn); } while (0); dbg_level_down(); diff --git a/lib/part/getpinfo.c b/lib/part/getpinfo.c index c9ce57e..8beacd6 100644 --- a/lib/part/getpinfo.c +++ b/lib/part/getpinfo.c @@ -35,7 +35,7 @@ u_int part_getpartinfo(part_t *part, u_int parn, partinfo_t *pinfo) memset (pinfo, 0, sizeof (*pinfo)); ret = 1; } else - set_error("invalid partition number %d", parn); + set_error("part_getpinfo: invalid partition number %d", parn); dbg_level_down(); if (ret) diff --git a/lib/part/types.c b/lib/part/types.c index 570bf47..1ff854b 100644 --- a/lib/part/types.c +++ b/lib/part/types.c @@ -65,7 +65,6 @@ static const struct { { ptyp_pt_oldmap, "Filecore OldMap" }, { ptyp_pt_backup, "PowerTec Backup" }, { ptyp_pt_empty, "Empty" }, - { ptyp_unknown, "Unknown" }, { ptyp_none, NULL } }; @@ -81,6 +80,11 @@ const char *part_typename(part_t *part, ptyp_t type) const char *name; u_int i; + if (type == ptyp_reserved) + return "Reserved/Free"; + if (type == ptyp_unknown) + return "Unknown"; + for (i = 0; part_types[i].name; i++) if (part_types[i].type == type) break; diff --git a/lib/scheme/linux.c b/lib/scheme/linux.c index 30423ab..426f2fb 100644 --- a/lib/scheme/linux.c +++ b/lib/scheme/linux.c @@ -254,15 +254,24 @@ fcl_writeinfo(part_t *part) */ if (part->nr_partitions > 2 && part->partinfo[2]) { u_int start_cyl; + geometry_t geom; + + part_getgeometry(part, &geom); start_cyl = part->partinfo[2]->info.blk_start / - (disc_record->d.heads * disc_record->d.secspertrack); + (disc_record->d.heads * disc_record->d.secspertrack); + + /* The following assertion used to be here. However, because of + differences in representation of C/H/S between Linux and RISC OS + the comparison is non-trivial to do in all cases. + + The check is really only against bugs in the program, and it + has been known to work properly for a long time. + + assert(start_cyl * disc_record->d.secspertrack / geom.sectors == + part->partinfo[2]->info.chs_start.cylinder); + */ - /* - * This should always be true. If it's incorrect, then you've - * been playing, and I'm confused. - */ - assert(start_cyl == part->partinfo[2]->info.chs_start.cylinder); sector.sector[508] = 9; sector.sector[509] = start_cyl & 255; sector.sector[510] = start_cyl >> 8; @@ -330,6 +339,8 @@ fcl_writeinfo(part_t *part) } ret = 1; #endif + } else { + ret = 1; } } while (0); @@ -405,7 +416,7 @@ fcl_validate_change(part_t *part, u_int parn, const partinfo_t *pold, const part if (pnew) { if (pnew->type != ptyp_linux_native && pnew->type != ptyp_linux_swap) { - set_error("invalid partition type"); + set_error("fcl_validate_change: invalid partition type"); break; } @@ -453,7 +464,7 @@ fcl_validate_creation(part_t *part, u_int parn, const partinfo_t *pold, const pa if (pnew) { if (pnew->type != ptyp_linux_native && pnew->type != ptyp_linux_swap) { - set_error("invalid partition type"); + set_error("fcl_validate_create: invalid partition type"); break; } debian/acorn-fdisk.80000644000000000000000000001015311635126061011460 0ustar .\" Copyright (c) 2009, 2010 .\" Thorsten Glaser .\" .\" Provided that these terms and disclaimer and all copyright notices .\" are retained or reproduced in an accompanying document, permission .\" is granted to deal in this work without restriction, including un- .\" limited rights to use, publicly perform, distribute, sell, modify, .\" merge, give away, or sublicence. .\" .\" This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to .\" the utmost extent permitted by applicable law, neither express nor .\" implied; without malicious intent or gross negligence. In no event .\" may a licensor, author or contributor be held liable for indirect, .\" direct, other damage, loss, or other issues arising in any way out .\" of dealing in the work, even if advised of the possibility of such .\" damage or existence of a defect, except proven that it results out .\" of said person's immediate fault when using the work as intended. .\"- .Dd October 2, 2010 .Dt FDISK 8 .Os .Sh NAME .Nm acorn\-fdisk .Nd partition editor for Acorn/RISC OS machines .Sh SYNOPSIS .Nm .Fl h \*(Ba \-help \*(Ba .Fl v \*(Ba Fl \-version .Pp .Nm .Oo .Fl t Ar scheme \*(Ba .Fl \-type Ar scheme .Oc .Fl l \*(Ba Fl \-list .Op Ar device ... .Pp .Nm .Oo .Fl t Ar scheme \*(Ba .Fl \-type Ar scheme .Oc .Fl s \*(Ba Fl \-size .Ar partition .Pp .Nm .Oo .Fl t Ar scheme \*(Ba .Fl \-type Ar scheme .Oc .Op Ar device .Sh DESCRIPTION The .Nm utility allows one to display or interactively edit partition tables for Acorn/RISC OS machines in various formats. Using the .Dv PC/BIOS format, standard IBM PC (i386) partition tables can also be accessed. When no optional .Ar device is given, it defaults to .Pa /dev/hda or .Pa /dev/sda . .Pp The options are as follows: .Bl -tag -width xlxxxxxlist .It Fl h \*(Ba \-help Display a short usage and exit immediately. .It Fl l \*(Ba Fl \-list Display the partition table(s) of all .Ar device Ns s . .It Fl s \*(Ba Fl \-size Display the size of .Ar partition . .It Fl t \*(Ba Fl \-type Select the partitioning scheme to use. Valid schemes are: .Bl -tag -width FilecorexRISCiX .It EESOX Eesox SCSI on the Acorn machines. .It ICSIDEFS ICS IDE. .It Filecore/Linux Linux on Filecore. This uses the non-ADFS descriptor to point to the start of the disc to be partitioned. The first two sectors contain a partition table to identify the Linux partitions contained within. .It PC/BIOS PC/BIOS partitioning scheme. This consists of a partition table in the first sector of the disk which contains both CHS and LBA values for the partitions. There can be up to four entries in the primary partition table. One of these can be an extended partition containing up to four extra partitions. .It PowerTec PowerTec SCSI on the Acorn machines. .It Filecore/RISCiX RiscIX on Filecore. .El .It Fl v \*(Ba Fl \-version Display the version of .Nm and exit immediately. .El .Pp If neither .Fl l \*(Ba Fl \-list or .Fl s \*(Ba Fl \-size are given, the partition table of the given .Ar device will be edited interactively. .Sh EXAMPLES Display the default device's partition table on a PC: .Bd -ragged -offset indent .Nm .Fl \-type Ar PC/BIOS .Fl l .Ed .Pp Display the PC partition table of .Pa /dev/sda : .Bd -ragged -offset indent .Nm .Fl \-type Ar PC/BIOS .Fl \-list Ar /dev/sda .Ed .Pp Display the size in blocks of the partition .Pa /dev/sda1 : .Bd -ragged -offset indent .Nm .Fl \-type Ar PC/BIOS .Fl \-size Ar /dev/sda1 .Ed .Pp Edit the MBR partition table interactively: .Bd -ragged -offset indent .Nm .Fl \-type Ar PC/BIOS .Ed .Pp Display the partition table of an MBR backed up to a file: .Bd -ragged -offset indent .Nm .Fl t Ar PC/BIOS .Fl l Ar mbrdump.bin .Ed .Pp Display the size of the first partition on a device where the MBR would be restored from the backup file .Pa mbrdump.bin : .Bd -ragged -offset indent .Nm .Fl t Ar PC/BIOS .Fl s Ar mbrdump.bin1 .Ed .Sh AUTHORS .Nm arm\-fdisk was written by .An Russell King Aq rmk@arm.uk.linux.org based on util-linux .Nm fdisk , which was written at least partially by .An A. V. Le Blanc Aq LeBlanc@mcc.ac.uk . .Pp This manual page was written for the Debian system by .An Thorsten Glaser Aq tg@debian.org but may be used by others. debian/manpages0000644000000000000000000000002511635126061010702 0ustar debian/acorn-fdisk.8 debian/README.source0000644000000000000000000000054011635126061011345 0ustar Still to do: - Update Standards-Version and go through upgrading-checklist (probably very time consuming) - Test on some real Acorn RISC Machine (even though, with -t PC/BIOS, this can replace util-linux fdisk, which is testing to a certain degree as well) Notes: - Upstream is probably dead. Just develop in here. 2010-10-02 tg@debian.org