summaryrefslogtreecommitdiff
path: root/serverboot/default_pager.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-07-20 19:25:11 +0000
committerRoland McGrath <roland@gnu.org>1999-07-20 19:25:11 +0000
commit25d6df68ca90f17af74db6e8e6c31df34998b995 (patch)
treedefe19c0d3042dbeecc46932f2082552b6f34cf1 /serverboot/default_pager.c
parent7e8cd9a7d67ff7cc6f38095f09db93cf9c5e3641 (diff)
1999-07-20 Roland McGrath <roland@baalperazim.frob.com>
* default_pager.c (new_partition): When reading Linux signature page, handle pager_read_file_direct returning sub-page blocks.
Diffstat (limited to 'serverboot/default_pager.c')
-rw-r--r--serverboot/default_pager.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/serverboot/default_pager.c b/serverboot/default_pager.c
index bfce88b1..d2de5cdd 100644
--- a/serverboot/default_pager.c
+++ b/serverboot/default_pager.c
@@ -220,9 +220,25 @@ new_partition (const char *name, struct file_direct *fdp,
if (rc)
panic("(default pager): cannot read first page of %s! rc=%#x\n",
name, rc);
- if (rsize != LINUX_PAGE_SIZE)
- panic("(default pager): bad read on first page of %s! size=%u\n",
- name, rsize);
+ while (rsize < LINUX_PAGE_SIZE)
+ {
+ /* Filesystem block size is smaller than page size,
+ so we must do several reads to get the whole page. */
+ vm_address_t baddr, bsize;
+ rc = page_read_file_direct(part->file,
+ rsize, LINUX_PAGE_SIZE-rsize,
+ &baddr,
+ &bsize);
+ if (rc)
+ panic("(default pager): "
+ "cannot read first page of %s! rc=%#x at %#x\n",
+ name, rc, rsize);
+
+ memcpy ((char *) raddr + rsize, (void *) baddr, bsize);
+ rsize += bsize;
+ vm_deallocate (mach_task_self (), baddr, bsize);
+ }
+
if (!memcmp("SWAP-SPACE", (char *) raddr + LINUX_PAGE_SIZE-10, 10))
{
/* The partition's first page has a Linux swap signature.