source: svn/trunk/newcon3bcm2_21bu/toolchain/mipsel-linux-uclibc/include/linux/swap.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#ifndef _LINUX_SWAP_H
2#define _LINUX_SWAP_H
3
4#include <linux/linkage.h>
5#include <linux/mmzone.h>
6#include <linux/sched.h>
7#include <asm/atomic.h>
8#include <asm/page.h>
9
10#define SWAP_FLAG_PREFER        0x8000  /* set if swap priority specified */
11#define SWAP_FLAG_PRIO_MASK     0x7fff
12#define SWAP_FLAG_PRIO_SHIFT    0
13
14static inline int current_is_kswapd(void)
15{
16        return current->flags & PF_KSWAPD;
17}
18
19/*
20 * MAX_SWAPFILES defines the maximum number of swaptypes: things which can
21 * be swapped to.  The swap type and the offset into that swap type are
22 * encoded into pte's and into pgoff_t's in the swapcache.  Using five bits
23 * for the type means that the maximum number of swapcache pages is 27 bits
24 * on 32-bit-pgoff_t architectures.  And that assumes that the architecture packs
25 * the type/offset into the pte as 5/27 as well.
26 */
27#define MAX_SWAPFILES_SHIFT     5
28#define MAX_SWAPFILES           (1 << MAX_SWAPFILES_SHIFT)
29
30/*
31 * Magic header for a swap area. The first part of the union is
32 * what the swap magic looks like for the old (limited to 128MB)
33 * swap area format, the second part of the union adds - in the
34 * old reserved area - some extra information. Note that the first
35 * kilobyte is reserved for boot loader or disk label stuff...
36 *
37 * Having the magic at the end of the PAGE_SIZE makes detecting swap
38 * areas somewhat tricky on machines that support multiple page sizes.
39 * For 2.5 we'll probably want to move the magic to just beyond the
40 * bootbits...
41 */
42union swap_header {
43        struct {
44                char reserved[PAGE_SIZE - 10];
45                char magic[10];                 /* SWAP-SPACE or SWAPSPACE2 */
46        } magic;
47        struct {
48                char         bootbits[1024];    /* Space for disklabel etc. */
49                unsigned int version;
50                unsigned int last_page;
51                unsigned int nr_badpages;
52                unsigned int padding[125];
53                unsigned int badpages[1];
54        } info;
55};
56
57 /* A swap entry has to fit into a "unsigned long", as
58  * the entry is hidden in the "index" field of the
59  * swapper address space.
60  */
61typedef struct {
62        unsigned long val;
63} swp_entry_t;
64
65/*
66 * current->reclaim_state points to one of these when a task is running
67 * memory reclaim
68 */
69struct reclaim_state {
70        unsigned long reclaimed_slab;
71};
72
73#endif /* _LINUX_SWAP_H */
Note: See TracBrowser for help on using the repository browser.