diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-22 05:03:27 +0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 09:49:51 +0400 |
commit | 48245cc0708d49d1d0566b9fa617ad6c5f4c6934 (patch) | |
tree | b396fd2d1ab185aab20894570e7e84bd4f656355 /drivers/lguest/lguest_user.c | |
parent | 3c6b5bfa3cf3b4057788e08482a468cc3bc00780 (diff) | |
download | linux-48245cc0708d49d1d0566b9fa617ad6c5f4c6934.tar.xz |
Remove fixed limit on number of guests, and lguests array.
Back when we had all the Guest state in the switcher, we had a fixed
array of them. This is no longer necessary.
If we switch the network code to using random_ether_addr (46 bits is
enough to avoid clashes), we can get rid of the concept of "guest id"
altogether.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lguest_user.c')
-rw-r--r-- | drivers/lguest/lguest_user.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index 816d4d12a801..5632ed82798a 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c @@ -167,11 +167,11 @@ static int initialize(struct file *file, const u32 __user *input) /* "struct lguest" contains everything we (the Host) know about a * Guest. */ struct lguest *lg; - int err, i; + int err; u32 args[5]; - /* We grab the Big Lguest lock, which protects the global array - * "lguests" and multiple simultaneous initializations. */ + /* We grab the Big Lguest lock, which protects against multiple + * simultaneous initializations. */ mutex_lock(&lguest_lock); /* You can't initialize twice! Close the device and start again... */ if (file->private_data) { @@ -184,18 +184,13 @@ static int initialize(struct file *file, const u32 __user *input) goto unlock; } - /* Find an unused guest. */ - i = find_free_guest(); - if (i < 0) { - err = -ENOSPC; + lg = kzalloc(sizeof(*lg), GFP_KERNEL); + if (!lg) { + err = -ENOMEM; goto unlock; } - /* OK, we have an index into the "lguest" array: "lg" is a convenient - * pointer. */ - lg = &lguests[i]; /* Populate the easy fields of our "struct lguest" */ - lg->guestid = i; lg->mem_base = (void __user *)(long)args[0]; lg->pfn_limit = args[1]; lg->page_offset = args[4]; |