Messages in this thread Patch in this message | | | From | Nigel Cunningham <> | Subject | [Suspend2][ 2/9] [Suspend2] Extent allocation routines. | Date | Tue, 27 Jun 2006 02:54:11 +1000 |
| |
Add routines to get and put extents.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
kernel/power/extent.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/kernel/power/extent.c b/kernel/power/extent.c index 4027bb1..2fb6a23 100644 --- a/kernel/power/extent.c +++ b/kernel/power/extent.c @@ -17,3 +17,33 @@ int suspend_extents_allocated = 0; +/* suspend_get_extent + * + * Returns a free extent. May fail, returning NULL instead. + */ +static struct extent *suspend_get_extent(void) +{ + struct extent *result; + + if (!(result = kmalloc(sizeof(struct extent), GFP_ATOMIC))) + return NULL; + + suspend_extents_allocated++; + result->minimum = result->maximum = 0; + result->next = NULL; + + return result; +} + +/* suspend_put_extent. + * + * Frees an extent. Assumes unlinking is done by the caller. + */ +void suspend_put_extent(struct extent *extent) +{ + BUG_ON(!extent); + + kfree(extent); + suspend_extents_allocated--; +} + -- Nigel Cunningham nigel at suspend2 dot net - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |