summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Grundler <grundler@parisc-linux.org>2005-01-28 20:21:36 +0000
committerGrant Grundler <grundler@parisc-linux.org>2005-01-28 20:21:36 +0000
commit21e645db1d0ccfdb24ad577343d63a33a843b49c (patch)
tree790f094da588c060e6e57d22abfc227346783506
parentd6d50485381dc37cf87ef760714b8bdf242ed440 (diff)
downloadpalo-21e645db1d0ccfdb24ad577343d63a33a843b49c.tar.gz
palo v1.7 - fixed "formatting as ext1" output on updates and improvedv1.7
error reporting
-rw-r--r--debian/changelog8
-rw-r--r--lib/common.h2
-rw-r--r--palo/error.c6
-rw-r--r--palo/palo.c29
4 files changed, 30 insertions, 15 deletions
diff --git a/debian/changelog b/debian/changelog
index c48aa1c..86a7488 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+
+palo (1.7) unstable; urgency=low
+
+ * on updates, was reporting "doing a format as ext1".
+ Fixed the message and improved the error handling.
+
+ -- Grant Grundler <grundler@parisc-linux.org> Fri, 28 Jan 2005
+
palo (1.6) unstable; urgency=low
* some fail/restart changes didn't make it in 1.5 by mistake
diff --git a/lib/common.h b/lib/common.h
index 750e5d8..b17c3dc 100644
--- a/lib/common.h
+++ b/lib/common.h
@@ -11,7 +11,7 @@
#include <asm/byteorder.h>
#include <linux/genhd.h>
-#define PALOVERSION "1.5"
+#define PALOVERSION "1.7"
/* size of I/O block used in HP firmware */
#define FW_BLOCKSIZE 2048
diff --git a/palo/error.c b/palo/error.c
index dcdd922..f430ba7 100644
--- a/palo/error.c
+++ b/palo/error.c
@@ -89,7 +89,11 @@ static char *errormessages[] = {
"or a ramdisk.\n",
/* 19 */
- "mke2fs failed, exit code %d."
+ "mke2fs failed, exit code %d.",
+
+ /* 20 */
+ "Cannot update an uninitialized ext2/3 formatted partition.\n"
+
};
#define NMESSAGES (sizeof errormessages / sizeof errormessages[0])
diff --git a/palo/palo.c b/palo/palo.c
index a447864..6af017a 100644
--- a/palo/palo.c
+++ b/palo/palo.c
@@ -440,7 +440,7 @@ do_cdrom(int media, int kernel32, int kernel64,
* to cover the first four blocks of the filesystem */
#define EXT2_OFFSET (4*EXT2_BLOCKSIZE)
-void
+int
do_formatted(int init, int media, const char *medianame, int partition,
int f0start, int f0length, int bootloaderfd, int do_format,
const char *commandline)
@@ -468,6 +468,8 @@ do_formatted(int init, int media, const char *medianame, int partition,
int fd, i;
char cmd[512];
+ printf("Initializing %s as ext%d\n", partitionname, do_format);
+
if (verbose)
printf("f0 partition starts %d, hole %d-%d, end %d\n",
f0start, holestart, holestart + EXT2_HOLE*EXT2_BLOCKSIZE,
@@ -524,6 +526,12 @@ do_formatted(int init, int media, const char *medianame, int partition,
printf("Updating formatted ver=%d, start=%d\n",
f.version, f.ipl_addr);
+ if ((f.version < 4) || (!f.flags & PFLAG_EXT2)) {
+ printf("Can not update %s. Please initialize first.\n",
+ partitionname);
+ return -1;
+ }
+
if(commandline)
strncpy(f.cmdline, commandline, sizeof(f.cmdline));
@@ -532,6 +540,7 @@ do_formatted(int init, int media, const char *medianame, int partition,
STRUCTWRITE(media, f, 0);
}
+ return 0;
}
void
@@ -916,24 +925,18 @@ main(int argc, char *argv[])
printf("F0 partition start sector %d length %d\n",
ptab[f0].start, ptab[f0].length);
}
- if (!init) {
- STRUCTREAD(media, f, 0);
- if (f.version >= 4 && (f.flags & PFLAG_EXT2))
- /* need to update formatted partition */
- format_as = 1;
- }
if (format_as) {
/* if we're going to be a formatted partition, we can't
* load anything into it, so check we haven't been asked
* to */
- if(kernel32 != -1 || kernel64 != -1
- || ramdisk != -1)
- error(18);
- printf("OK we're doing a format as ext%d\n", format_as);
- do_formatted(init, media, medianame, f0 + 1,
+ if(kernel32 != -1 || kernel64 != -1 || ramdisk != -1)
+ error(18);
+
+ if (do_formatted(init, media, medianame, f0 + 1,
ptab[f0].start * 512, ptab[f0].length * 512,
- bootloader, format_as, commandline);
+ bootloader, format_as, commandline))
+ error(20);
} else
do_randomaccess(init, media, kernel32, kernel64, commandline,
bootloader, ramdisk, ptab[f0].start * 512,