summaryrefslogtreecommitdiff
path: root/serverboot/default_pager.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-05-15 23:13:32 +0000
committerRoland McGrath <roland@gnu.org>1999-05-15 23:13:32 +0000
commit4bb190f61580f92b21a6198ba164366beae6ee7e (patch)
tree36d5b1d7bbaea27d0db6aa72def6cbceb925b25b /serverboot/default_pager.c
parent27538ebfd1a8cf910dbc4155abfd009e1ac318d2 (diff)
1999-05-15 Roland McGrath <roland@baalperazim.frob.com>
* default_pager.c (new_partition): Check if requested partition is already in our list, and refuse it.
Diffstat (limited to 'serverboot/default_pager.c')
-rw-r--r--serverboot/default_pager.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/serverboot/default_pager.c b/serverboot/default_pager.c
index 8fb8dfe1..66ff94a0 100644
--- a/serverboot/default_pager.c
+++ b/serverboot/default_pager.c
@@ -171,6 +171,24 @@ new_partition (const char *name, struct file_direct *fdp,
vm_offset_t raddr;
mach_msg_type_number_t rsize;
int rc;
+ unsigned int id = part_id(name);
+
+ mutex_lock(&all_partitions.lock);
+ {
+ unsigned int i;
+ for (i = 0; i < all_partitions.n_partitions; i++)
+ {
+ part = partition_of(i);
+ if (part && part->id == id)
+ {
+ printf ("(default pager): Already paging to partition %s!\n",
+ name);
+ mutex_unlock(&all_partitions.lock);
+ return 0;
+ }
+ }
+ }
+ mutex_unlock(&all_partitions.lock);
size = atop(fdp->fd_size * fdp->fd_bsize);
bmsize = howmany(size, NB_BM) * sizeof(bm_entry_t);
@@ -179,7 +197,7 @@ new_partition (const char *name, struct file_direct *fdp,
mutex_init(&part->p_lock);
part->total_size = size;
part->free = size;
- part->id = part_id(name);
+ part->id = id;
part->bitmap = (bm_entry_t *)kalloc(bmsize);
part->going_away= FALSE;
part->file = fdp;