From 89bb63265284a87bff987ece3afb77f8400cf5a2 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 5 Feb 2000 12:48:25 +0000 Subject: 2000-02-05 Roland McGrath * linux-src (many files): Merge Linux 2.2.13 and 2.2.14 code. * glue-include/linux/mm.h (PAGE_SIZE, num_physpages): New macros. (__get_free_pages): New inline function. --- pfinet/glue-include/linux/mm.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'pfinet') diff --git a/pfinet/glue-include/linux/mm.h b/pfinet/glue-include/linux/mm.h index a6f28e00..546776e8 100644 --- a/pfinet/glue-include/linux/mm.h +++ b/pfinet/glue-include/linux/mm.h @@ -15,4 +15,24 @@ #define GFP_BUFFER 0 #define __GFP_WAIT 0 +#include +#include +#include + +#define PAGE_SIZE (1 << PAGE_SHIFT) + +/* The one use of this is by net/ipv4/tcp.c::tcp_init, which + uses the power of two above `num_physpages >> (20 - PAGE_SHIFT)' + as a starting point and halves from there the number of pages + it tries to allocate for the hash table of TCP connections. */ +#define num_physpages (64 << 20 >> PAGE_SHIFT) /* XXX calculate for 32MB */ + +static inline uintptr_t +__get_free_pages (int gfp_mask, unsigned long int order) +{ + void *ptr = mmap (0, PAGE_SIZE << order, + PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); + return ptr == MAP_FAILED ? 0 : (uintptr_t) ptr; +} + #endif -- cgit v1.2.3