Fix build breakages on ia64 introduced some commits ago.

This commit is contained in:
Marcel Moolenaar 2010-06-13 23:37:16 +00:00
parent c10f5c0eb1
commit 97e9dcb987
2 changed files with 37 additions and 36 deletions

View file

@ -79,7 +79,6 @@ static struct chunk *chunk_info[CHUNK_INFO_ENTRIES];
static int current_chunk;
static void diskPartitionNonInteractive(Device *dev);
static u_char * bootalloc(char *name, size_t *size);
static void
record_chunks(Disk *d)
@ -217,6 +216,41 @@ print_command_summary(void)
move(0, 0);
}
#if !defined(__ia64__)
static u_char *
bootalloc(char *name, size_t *size)
{
char buf[FILENAME_MAX];
struct stat sb;
snprintf(buf, sizeof buf, "/boot/%s", name);
if (stat(buf, &sb) != -1) {
int fd;
fd = open(buf, O_RDONLY);
if (fd != -1) {
u_char *cp;
cp = malloc(sb.st_size);
if (read(fd, cp, sb.st_size) != sb.st_size) {
free(cp);
close(fd);
msgDebug("bootalloc: couldn't read %ld bytes from %s\n", (long)sb.st_size, buf);
return NULL;
}
close(fd);
if (size != NULL)
*size = sb.st_size;
return cp;
}
msgDebug("bootalloc: couldn't open %s\n", buf);
}
else
msgDebug("bootalloc: can't stat %s\n", buf);
return NULL;
}
#endif
#ifdef PC98
static void
getBootMgr(char *dname, u_char **bootipl, size_t *bootipl_size,
@ -732,39 +766,6 @@ diskPartition(Device *dev)
}
#endif /* WITH_SLICES */
static u_char *
bootalloc(char *name, size_t *size)
{
char buf[FILENAME_MAX];
struct stat sb;
snprintf(buf, sizeof buf, "/boot/%s", name);
if (stat(buf, &sb) != -1) {
int fd;
fd = open(buf, O_RDONLY);
if (fd != -1) {
u_char *cp;
cp = malloc(sb.st_size);
if (read(fd, cp, sb.st_size) != sb.st_size) {
free(cp);
close(fd);
msgDebug("bootalloc: couldn't read %ld bytes from %s\n", (long)sb.st_size, buf);
return NULL;
}
close(fd);
if (size != NULL)
*size = sb.st_size;
return cp;
}
msgDebug("bootalloc: couldn't open %s\n", buf);
}
else
msgDebug("bootalloc: can't stat %s\n", buf);
return NULL;
}
#ifdef WITH_SLICES
static int
partitionHook(dialogMenuItem *selected)
@ -874,7 +875,9 @@ diskPartitionWrite(dialogMenuItem *self)
msgDebug("diskPartitionWrite: Examining %d devices\n", deviceCount(devs));
for (i = 0; devs[i]; i++) {
Disk *d = (Disk *)devs[i]->private;
#if !defined(__ia64__)
static u_char *boot1;
#endif
#if defined(__i386__) || defined(__amd64__)
static u_char *boot2;
#endif

View file

@ -1191,9 +1191,7 @@ installFilesystems(dialogMenuItem *self)
}
#if defined(__ia64__)
else if (c1->type == efi && c1->private_data) {
char bootdir[FILENAME_MAX];
PartInfo *pi = (PartInfo *)c1->private_data;
char *p;
sprintf(dname, "%s/dev/%s", RunningAsInit ? "/mnt" : "",
c1->name);