diff options
author | Roland McGrath <roland@gnu.org> | 1999-07-20 19:25:11 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1999-07-20 19:25:11 +0000 |
commit | 50fde35cc07ce37cb8e7a68f8d919b631cc89b97 (patch) | |
tree | dc24009f70dab6d9980157149ef3f78639986cff /serverboot/default_pager.c | |
parent | e529ce98486b413cca7b16e7f7a51642b60f0a6f (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.c | 22 |
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. |