aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIgor Mammedov <niallain@gmail.com>2008-04-28 19:08:21 -0400
committerSteve French <sfrench@us.ibm.com>2008-04-28 19:08:21 -0400
commite9f20d6f03e8df393b001dab6dc5226c2a5daf57 (patch)
tree73e94fa5e4f83576c97e36187b809c5aad2ade30 /include/linux
parentbf62fd887cab230f5952b611bde25e8e15acb454 (diff)
parente31a94ed371c70855eb30b77c490d6d85dd4da26 (diff)
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bitmap.h6
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/cache.h4
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/cpumask.h22
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/dmi.h1
-rw-r--r--include/linux/fb.h44
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/gfp.h44
-rw-r--r--include/linux/hid.h4
-rw-r--r--include/linux/hugetlb.h46
-rw-r--r--include/linux/i2o.h5
-rw-r--r--include/linux/init_task.h3
-rw-r--r--include/linux/kprobes.h34
-rw-r--r--include/linux/list.h9
-rw-r--r--include/linux/memory_hotplug.h33
-rw-r--r--include/linux/mempolicy.h156
-rw-r--r--include/linux/mm.h57
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/mmzone.h183
-rw-r--r--include/linux/msdos_fs.h10
-rw-r--r--include/linux/ncp_fs.h7
-rw-r--r--include/linux/nodemask.h22
-rw-r--r--include/linux/notifier.h1
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/page-flags.h319
-rw-r--r--include/linux/prctl.h9
-rw-r--r--include/linux/quota.h21
-rw-r--r--include/linux/quotaops.h137
-rw-r--r--include/linux/raid/raid5.h7
-rw-r--r--include/linux/reiserfs_fs.h1
-rw-r--r--include/linux/sched.h3
-rw-r--r--include/linux/securebits.h25
-rw-r--r--include/linux/security.h912
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/suspend.h15
-rw-r--r--include/linux/swap.h4
-rw-r--r--include/linux/synclink.h4
-rw-r--r--include/linux/vmalloc.h5
-rw-r--r--include/linux/vmstat.h6
42 files changed, 1300 insertions, 887 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 1dbe074f1c64..43b406def35f 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -46,6 +46,8 @@
46 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 46 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
47 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 47 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
48 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) 48 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
49 * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap
50 * bitmap_fold(dst, orig, sz, nbits) dst bits = orig bits mod sz
49 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf 51 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
50 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf 52 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
51 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 53 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
@@ -121,6 +123,10 @@ extern void bitmap_remap(unsigned long *dst, const unsigned long *src,
121 const unsigned long *old, const unsigned long *new, int bits); 123 const unsigned long *old, const unsigned long *new, int bits);
122extern int bitmap_bitremap(int oldbit, 124extern int bitmap_bitremap(int oldbit,
123 const unsigned long *old, const unsigned long *new, int bits); 125 const unsigned long *old, const unsigned long *new, int bits);
126extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
127 const unsigned long *relmap, int bits);
128extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
129 int sz, int bits);
124extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 130extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
125extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 131extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
126extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 132extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 4e4e340592fb..6a5dbdc8a7dc 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -101,6 +101,8 @@ extern void reserve_bootmem_node(pg_data_t *pgdat,
101extern void free_bootmem_node(pg_data_t *pgdat, 101extern void free_bootmem_node(pg_data_t *pgdat,
102 unsigned long addr, 102 unsigned long addr,
103 unsigned long size); 103 unsigned long size);
104extern void *alloc_bootmem_section(unsigned long size,
105 unsigned long section_nr);
104 106
105#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 107#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
106#define alloc_bootmem_node(pgdat, x) \ 108#define alloc_bootmem_node(pgdat, x) \
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4552504c0228..97e24881c4c6 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -60,4 +60,8 @@
60#endif 60#endif
61#endif 61#endif
62 62
63#ifndef CONFIG_ARCH_HAS_CACHE_LINE_SIZE
64#define cache_line_size() L1_CACHE_BYTES
65#endif
66
63#endif /* __LINUX_CACHE_H */ 67#endif /* __LINUX_CACHE_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 7d50ff6d269f..eaab759b1460 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -155,6 +155,7 @@ typedef struct kernel_cap_struct {
155 * Add any capability from current's capability bounding set 155 * Add any capability from current's capability bounding set
156 * to the current process' inheritable set 156 * to the current process' inheritable set
157 * Allow taking bits out of capability bounding set 157 * Allow taking bits out of capability bounding set
158 * Allow modification of the securebits for a process
158 */ 159 */
159 160
160#define CAP_SETPCAP 8 161#define CAP_SETPCAP 8
@@ -490,8 +491,6 @@ extern const kernel_cap_t __cap_init_eff_set;
490int capable(int cap); 491int capable(int cap);
491int __capable(struct task_struct *t, int cap); 492int __capable(struct task_struct *t, int cap);
492 493
493extern long cap_prctl_drop(unsigned long cap);
494
495#endif /* __KERNEL__ */ 494#endif /* __KERNEL__ */
496 495
497#endif /* !_LINUX_CAPABILITY_H */ 496#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 259c8051155d..9650806fe2ea 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -14,6 +14,8 @@
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c 15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
16 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c. 16 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c.
17 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
17 * 19 *
18 * The available cpumask operations are: 20 * The available cpumask operations are:
19 * 21 *
@@ -53,7 +55,9 @@
53 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing 55 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
54 * int cpulist_parse(buf, map) Parse ascii string as cpulist 56 * int cpulist_parse(buf, map) Parse ascii string as cpulist
55 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 57 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
56 * int cpus_remap(dst, src, old, new) *dst = map(old, new)(src) 58 * void cpus_remap(dst, src, old, new) *dst = map(old, new)(src)
59 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
60 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
57 * 61 *
58 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask 62 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask
59 * 63 *
@@ -330,6 +334,22 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
330 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); 334 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
331} 335}
332 336
337#define cpus_onto(dst, orig, relmap) \
338 __cpus_onto(&(dst), &(orig), &(relmap), NR_CPUS)
339static inline void __cpus_onto(cpumask_t *dstp, const cpumask_t *origp,
340 const cpumask_t *relmapp, int nbits)
341{
342 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
343}
344
345#define cpus_fold(dst, orig, sz) \
346 __cpus_fold(&(dst), &(orig), sz, NR_CPUS)
347static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
348 int sz, int nbits)
349{
350 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
351}
352
333#if NR_CPUS > 1 353#if NR_CPUS > 1
334#define for_each_cpu_mask(cpu, mask) \ 354#define for_each_cpu_mask(cpu, mask) \
335 for ((cpu) = first_cpu(mask); \ 355 for ((cpu) = first_cpu(mask); \
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 726761e24003..038578362b47 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -26,7 +26,7 @@ extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed) 26#define cpuset_current_mems_allowed (current->mems_allowed)
27void cpuset_init_current_mems_allowed(void); 27void cpuset_init_current_mems_allowed(void);
28void cpuset_update_task_memory_state(void); 28void cpuset_update_task_memory_state(void);
29int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 29int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
30 30
31extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask); 31extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask);
32extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask); 32extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask);
@@ -103,7 +103,7 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
103static inline void cpuset_init_current_mems_allowed(void) {} 103static inline void cpuset_init_current_mems_allowed(void) {}
104static inline void cpuset_update_task_memory_state(void) {} 104static inline void cpuset_update_task_memory_state(void) {}
105 105
106static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 106static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
107{ 107{
108 return 1; 108 return 1;
109} 109}
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 325acdf5c462..2a063b64133f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -90,6 +90,7 @@ static inline int dmi_check_system(const struct dmi_system_id *list) { return 0;
90static inline const char * dmi_get_system_info(int field) { return NULL; } 90static inline const char * dmi_get_system_info(int field) { return NULL; }
91static inline const struct dmi_device * dmi_find_device(int type, const char *name, 91static inline const struct dmi_device * dmi_find_device(int type, const char *name,
92 const struct dmi_device *from) { return NULL; } 92 const struct dmi_device *from) { return NULL; }
93static inline void dmi_scan_machine(void) { return; }
93static inline int dmi_get_year(int year) { return 0; } 94static inline int dmi_get_year(int year) { return 0; }
94static inline int dmi_name_in_vendors(const char *s) { return 0; } 95static inline int dmi_name_in_vendors(const char *s) { return 0; }
95#define dmi_available 0 96#define dmi_available 0
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 58c57a33e5dd..72295b099228 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -791,6 +791,17 @@ struct fb_tile_ops {
791 */ 791 */
792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000 792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
793 793
794/*
795 * Host and GPU endianness differ.
796 */
797#define FBINFO_FOREIGN_ENDIAN 0x100000
798/*
799 * Big endian math. This is the same flags as above, but with different
800 * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag
801 * and host endianness. Drivers should not use this flag.
802 */
803#define FBINFO_BE_MATH 0x100000
804
794struct fb_info { 805struct fb_info {
795 int node; 806 int node;
796 int flags; 807 int flags;
@@ -899,15 +910,11 @@ struct fb_info {
899 910
900#endif 911#endif
901 912
902#if defined (__BIG_ENDIAN) 913#define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0)
903#define FB_LEFT_POS(bpp) (32 - bpp) 914#define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \
904#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits)) 915 (val) << (bits))
905#define FB_SHIFT_LOW(val, bits) ((val) << (bits)) 916#define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \
906#else 917 (val) >> (bits))
907#define FB_LEFT_POS(bpp) (0)
908#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
909#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
910#endif
911 918
912 /* 919 /*
913 * `Generic' versions of the frame buffer device operations 920 * `Generic' versions of the frame buffer device operations
@@ -970,6 +977,25 @@ extern void fb_deferred_io_cleanup(struct fb_info *info);
970extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 977extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
971 int datasync); 978 int datasync);
972 979
980static inline bool fb_be_math(struct fb_info *info)
981{
982#ifdef CONFIG_FB_FOREIGN_ENDIAN
983#if defined(CONFIG_FB_BOTH_ENDIAN)
984 return info->flags & FBINFO_BE_MATH;
985#elif defined(CONFIG_FB_BIG_ENDIAN)
986 return true;
987#elif defined(CONFIG_FB_LITTLE_ENDIAN)
988 return false;
989#endif /* CONFIG_FB_BOTH_ENDIAN */
990#else
991#ifdef __BIG_ENDIAN
992 return true;
993#else
994 return false;
995#endif /* __BIG_ENDIAN */
996#endif /* CONFIG_FB_FOREIGN_ENDIAN */
997}
998
973/* drivers/video/fbsysfs.c */ 999/* drivers/video/fbsysfs.c */
974extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 1000extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
975extern void framebuffer_release(struct fb_info *info); 1001extern void framebuffer_release(struct fb_info *info);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d6d7c52055c6..2c925747bc49 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -474,8 +474,8 @@ struct address_space_operations {
474 int (*releasepage) (struct page *, gfp_t); 474 int (*releasepage) (struct page *, gfp_t);
475 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 475 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
476 loff_t offset, unsigned long nr_segs); 476 loff_t offset, unsigned long nr_segs);
477 struct page* (*get_xip_page)(struct address_space *, sector_t, 477 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
478 int); 478 void **, unsigned long *);
479 /* migrate the contents of a page to the specified target */ 479 /* migrate the contents of a page to the specified target */
480 int (*migratepage) (struct address_space *, 480 int (*migratepage) (struct address_space *,
481 struct page *, struct page *); 481 struct page *, struct page *);
@@ -1178,7 +1178,8 @@ struct block_device_operations {
1178 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 1178 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
1179 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); 1179 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
1180 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 1180 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
1181 int (*direct_access) (struct block_device *, sector_t, unsigned long *); 1181 int (*direct_access) (struct block_device *, sector_t,
1182 void **, unsigned long *);
1182 int (*media_changed) (struct gendisk *); 1183 int (*media_changed) (struct gendisk *);
1183 int (*revalidate_disk) (struct gendisk *); 1184 int (*revalidate_disk) (struct gendisk *);
1184 int (*getgeo)(struct block_device *, struct hd_geometry *); 1185 int (*getgeo)(struct block_device *, struct hd_geometry *);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 164be9da3c1b..c37653b6843f 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -119,35 +119,22 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
119 119
120static inline enum zone_type gfp_zone(gfp_t flags) 120static inline enum zone_type gfp_zone(gfp_t flags)
121{ 121{
122 int base = 0;
123
124#ifdef CONFIG_NUMA
125 if (flags & __GFP_THISNODE)
126 base = MAX_NR_ZONES;
127#endif
128
129#ifdef CONFIG_ZONE_DMA 122#ifdef CONFIG_ZONE_DMA
130 if (flags & __GFP_DMA) 123 if (flags & __GFP_DMA)
131 return base + ZONE_DMA; 124 return ZONE_DMA;
132#endif 125#endif
133#ifdef CONFIG_ZONE_DMA32 126#ifdef CONFIG_ZONE_DMA32
134 if (flags & __GFP_DMA32) 127 if (flags & __GFP_DMA32)
135 return base + ZONE_DMA32; 128 return ZONE_DMA32;
136#endif 129#endif
137 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == 130 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
138 (__GFP_HIGHMEM | __GFP_MOVABLE)) 131 (__GFP_HIGHMEM | __GFP_MOVABLE))
139 return base + ZONE_MOVABLE; 132 return ZONE_MOVABLE;
140#ifdef CONFIG_HIGHMEM 133#ifdef CONFIG_HIGHMEM
141 if (flags & __GFP_HIGHMEM) 134 if (flags & __GFP_HIGHMEM)
142 return base + ZONE_HIGHMEM; 135 return ZONE_HIGHMEM;
143#endif 136#endif
144 return base + ZONE_NORMAL; 137 return ZONE_NORMAL;
145}
146
147static inline gfp_t set_migrateflags(gfp_t gfp, gfp_t migrate_flags)
148{
149 BUG_ON((gfp & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
150 return (gfp & ~(GFP_MOVABLE_MASK)) | migrate_flags;
151} 138}
152 139
153/* 140/*
@@ -157,13 +144,27 @@ static inline gfp_t set_migrateflags(gfp_t gfp, gfp_t migrate_flags)
157 * virtual kernel addresses to the allocated page(s). 144 * virtual kernel addresses to the allocated page(s).
158 */ 145 */
159 146
147static inline int gfp_zonelist(gfp_t flags)
148{
149 if (NUMA_BUILD && unlikely(flags & __GFP_THISNODE))
150 return 1;
151
152 return 0;
153}
154
160/* 155/*
161 * We get the zone list from the current node and the gfp_mask. 156 * We get the zone list from the current node and the gfp_mask.
162 * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. 157 * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones.
158 * There are two zonelists per node, one for all zones with memory and
159 * one containing just zones from the node the zonelist belongs to.
163 * 160 *
164 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets 161 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets
165 * optimized to &contig_page_data at compile-time. 162 * optimized to &contig_page_data at compile-time.
166 */ 163 */
164static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
165{
166 return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
167}
167 168
168#ifndef HAVE_ARCH_FREE_PAGE 169#ifndef HAVE_ARCH_FREE_PAGE
169static inline void arch_free_page(struct page *page, int order) { } 170static inline void arch_free_page(struct page *page, int order) { }
@@ -174,6 +175,10 @@ static inline void arch_alloc_page(struct page *page, int order) { }
174 175
175extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *); 176extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *);
176 177
178extern struct page *
179__alloc_pages_nodemask(gfp_t, unsigned int,
180 struct zonelist *, nodemask_t *nodemask);
181
177static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 182static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
178 unsigned int order) 183 unsigned int order)
179{ 184{
@@ -184,8 +189,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
184 if (nid < 0) 189 if (nid < 0)
185 nid = numa_node_id(); 190 nid = numa_node_id();
186 191
187 return __alloc_pages(gfp_mask, order, 192 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
188 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
189} 193}
190 194
191#ifdef CONFIG_NUMA 195#ifdef CONFIG_NUMA
diff --git a/include/linux/hid.h b/include/linux/hid.h
index d951ec411241..4ce3b7a979ba 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -498,13 +498,13 @@ struct hid_parser {
498 498
499struct hid_class_descriptor { 499struct hid_class_descriptor {
500 __u8 bDescriptorType; 500 __u8 bDescriptorType;
501 __u16 wDescriptorLength; 501 __le16 wDescriptorLength;
502} __attribute__ ((packed)); 502} __attribute__ ((packed));
503 503
504struct hid_descriptor { 504struct hid_descriptor {
505 __u8 bLength; 505 __u8 bLength;
506 __u8 bDescriptorType; 506 __u8 bDescriptorType;
507 __u16 bcdHID; 507 __le16 bcdHID;
508 __u8 bCountryCode; 508 __u8 bCountryCode;
509 __u8 bNumDescriptors; 509 __u8 bNumDescriptors;
510 510
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index addca4cd4f11..a79e80b689d8 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -8,6 +8,7 @@
8#include <linux/mempolicy.h> 8#include <linux/mempolicy.h>
9#include <linux/shm.h> 9#include <linux/shm.h>
10#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
11#include <asm/hugetlb.h>
11 12
12struct ctl_table; 13struct ctl_table;
13 14
@@ -51,51 +52,6 @@ int pmd_huge(pmd_t pmd);
51void hugetlb_change_protection(struct vm_area_struct *vma, 52void hugetlb_change_protection(struct vm_area_struct *vma,
52 unsigned long address, unsigned long end, pgprot_t newprot); 53 unsigned long address, unsigned long end, pgprot_t newprot);
53 54
54#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
55#define is_hugepage_only_range(mm, addr, len) 0
56#endif
57
58#ifndef ARCH_HAS_HUGETLB_FREE_PGD_RANGE
59#define hugetlb_free_pgd_range free_pgd_range
60#else
61void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
62 unsigned long end, unsigned long floor,
63 unsigned long ceiling);
64#endif
65
66#ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE
67/*
68 * If the arch doesn't supply something else, assume that hugepage
69 * size aligned regions are ok without further preparation.
70 */
71static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
72{
73 if (len & ~HPAGE_MASK)
74 return -EINVAL;
75 if (addr & ~HPAGE_MASK)
76 return -EINVAL;
77 return 0;
78}
79#else
80int prepare_hugepage_range(unsigned long addr, unsigned long len);
81#endif
82
83#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
84#define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte)
85#define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep)
86#else
87void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
88 pte_t *ptep, pte_t pte);
89pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
90 pte_t *ptep);
91#endif
92
93#ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK
94#define hugetlb_prefault_arch_hook(mm) do { } while (0)
95#else
96void hugetlb_prefault_arch_hook(struct mm_struct *mm);
97#endif
98
99#else /* !CONFIG_HUGETLB_PAGE */ 55#else /* !CONFIG_HUGETLB_PAGE */
100 56
101static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 57static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index e92170dda245..f65e58a1d925 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -613,14 +613,9 @@ struct i2o_sys_tbl {
613extern struct list_head i2o_controllers; 613extern struct list_head i2o_controllers;
614 614
615/* Message functions */ 615/* Message functions */
616static inline struct i2o_message *i2o_msg_get(struct i2o_controller *);
617extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int); 616extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int);
618static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *);
619static inline int i2o_msg_post_wait(struct i2o_controller *,
620 struct i2o_message *, unsigned long);
621extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *, 617extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *,
622 unsigned long, struct i2o_dma *); 618 unsigned long, struct i2o_dma *);
623static inline void i2o_flush_reply(struct i2o_controller *, u32);
624 619
625/* IOP functions */ 620/* IOP functions */
626extern int i2o_status_get(struct i2o_controller *); 621extern int i2o_status_get(struct i2o_controller *);
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 37a6f5bc4a92..bf6b8a61f8db 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -9,6 +9,7 @@
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
11#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
12#include <linux/securebits.h>
12#include <net/net_namespace.h> 13#include <net/net_namespace.h>
13 14
14#define INIT_FDTABLE \ 15#define INIT_FDTABLE \
@@ -172,7 +173,7 @@ extern struct group_info init_groups;
172 .cap_inheritable = CAP_INIT_INH_SET, \ 173 .cap_inheritable = CAP_INIT_INH_SET, \
173 .cap_permitted = CAP_FULL_SET, \ 174 .cap_permitted = CAP_FULL_SET, \
174 .cap_bset = CAP_INIT_BSET, \ 175 .cap_bset = CAP_INIT_BSET, \
175 .keep_capabilities = 0, \ 176 .securebits = SECUREBITS_DEFAULT, \
176 .user = INIT_USER, \ 177 .user = INIT_USER, \
177 .comm = "swapper", \ 178 .comm = "swapper", \
178 .thread = INIT_THREAD, \ 179 .thread = INIT_THREAD, \
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 0f28486f6360..1036631ff4fa 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -173,6 +173,13 @@ struct kretprobe_blackpoint {
173 const char *name; 173 const char *name;
174 void *addr; 174 void *addr;
175}; 175};
176
177struct kprobe_blackpoint {
178 const char *name;
179 unsigned long start_addr;
180 unsigned long range;
181};
182
176extern struct kretprobe_blackpoint kretprobe_blacklist[]; 183extern struct kretprobe_blackpoint kretprobe_blacklist[];
177 184
178static inline void kretprobe_assert(struct kretprobe_instance *ri, 185static inline void kretprobe_assert(struct kretprobe_instance *ri,
@@ -227,15 +234,21 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
227 234
228int register_kprobe(struct kprobe *p); 235int register_kprobe(struct kprobe *p);
229void unregister_kprobe(struct kprobe *p); 236void unregister_kprobe(struct kprobe *p);
237int register_kprobes(struct kprobe **kps, int num);
238void unregister_kprobes(struct kprobe **kps, int num);
230int setjmp_pre_handler(struct kprobe *, struct pt_regs *); 239int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
231int longjmp_break_handler(struct kprobe *, struct pt_regs *); 240int longjmp_break_handler(struct kprobe *, struct pt_regs *);
232int register_jprobe(struct jprobe *p); 241int register_jprobe(struct jprobe *p);
233void unregister_jprobe(struct jprobe *p); 242void unregister_jprobe(struct jprobe *p);
243int register_jprobes(struct jprobe **jps, int num);
244void unregister_jprobes(struct jprobe **jps, int num);
234void jprobe_return(void); 245void jprobe_return(void);
235unsigned long arch_deref_entry_point(void *); 246unsigned long arch_deref_entry_point(void *);
236 247
237int register_kretprobe(struct kretprobe *rp); 248int register_kretprobe(struct kretprobe *rp);
238void unregister_kretprobe(struct kretprobe *rp); 249void unregister_kretprobe(struct kretprobe *rp);
250int register_kretprobes(struct kretprobe **rps, int num);
251void unregister_kretprobes(struct kretprobe **rps, int num);
239 252
240void kprobe_flush_task(struct task_struct *tk); 253void kprobe_flush_task(struct task_struct *tk);
241void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 254void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
@@ -254,16 +267,30 @@ static inline int register_kprobe(struct kprobe *p)
254{ 267{
255 return -ENOSYS; 268 return -ENOSYS;
256} 269}
270static inline int register_kprobes(struct kprobe **kps, int num)
271{
272 return -ENOSYS;
273}
257static inline void unregister_kprobe(struct kprobe *p) 274static inline void unregister_kprobe(struct kprobe *p)
258{ 275{
259} 276}
277static inline void unregister_kprobes(struct kprobe **kps, int num)
278{
279}
260static inline int register_jprobe(struct jprobe *p) 280static inline int register_jprobe(struct jprobe *p)
261{ 281{
262 return -ENOSYS; 282 return -ENOSYS;
263} 283}
284static inline int register_jprobes(struct jprobe **jps, int num)
285{
286 return -ENOSYS;
287}
264static inline void unregister_jprobe(struct jprobe *p) 288static inline void unregister_jprobe(struct jprobe *p)
265{ 289{
266} 290}
291static inline void unregister_jprobes(struct jprobe **jps, int num)
292{
293}
267static inline void jprobe_return(void) 294static inline void jprobe_return(void)
268{ 295{
269} 296}
@@ -271,9 +298,16 @@ static inline int register_kretprobe(struct kretprobe *rp)
271{ 298{
272 return -ENOSYS; 299 return -ENOSYS;
273} 300}
301static inline int register_kretprobes(struct kretprobe **rps, int num)
302{
303 return -ENOSYS;
304}
274static inline void unregister_kretprobe(struct kretprobe *rp) 305static inline void unregister_kretprobe(struct kretprobe *rp)
275{ 306{
276} 307}
308static inline void unregister_kretprobes(struct kretprobe **rps, int num)
309{
310}
277static inline void kprobe_flush_task(struct task_struct *tk) 311static inline void kprobe_flush_task(struct task_struct *tk)
278{ 312{
279} 313}
diff --git a/include/linux/list.h b/include/linux/list.h
index dac16f99c701..b4a939b6b625 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -319,6 +319,15 @@ static inline int list_empty_careful(const struct list_head *head)
319 return (next == head) && (next == head->prev); 319 return (next == head) && (next == head->prev);
320} 320}
321 321
322/**
323 * list_is_singular - tests whether a list has just one entry.
324 * @head: the list to test.
325 */
326static inline int list_is_singular(const struct list_head *head)
327{
328 return !list_empty(head) && (head->next == head->prev);
329}
330
322static inline void __list_splice(struct list_head *list, 331static inline void __list_splice(struct list_head *list,
323 struct list_head *head) 332 struct list_head *head)
324{ 333{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 8fee7a45736b..73e358612eaf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -8,8 +8,18 @@
8struct page; 8struct page;
9struct zone; 9struct zone;
10struct pglist_data; 10struct pglist_data;
11struct mem_section;
11 12
12#ifdef CONFIG_MEMORY_HOTPLUG 13#ifdef CONFIG_MEMORY_HOTPLUG
14
15/*
16 * Magic number for free bootmem.
17 * The normal smallest mapcount is -1. Here is smaller value than it.
18 */
19#define SECTION_INFO 0xfffffffe
20#define MIX_INFO 0xfffffffd
21#define NODE_INFO 0xfffffffc
22
13/* 23/*
14 * pgdat resizing functions 24 * pgdat resizing functions
15 */ 25 */
@@ -64,9 +74,11 @@ extern int offline_pages(unsigned long, unsigned long, unsigned long);
64/* reasonably generic interface to expand the physical pages in a zone */ 74/* reasonably generic interface to expand the physical pages in a zone */
65extern int __add_pages(struct zone *zone, unsigned long start_pfn, 75extern int __add_pages(struct zone *zone, unsigned long start_pfn,
66 unsigned long nr_pages); 76 unsigned long nr_pages);
77extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
78 unsigned long nr_pages);
67 79
68/* 80/*
69 * Walk thorugh all memory which is registered as resource. 81 * Walk through all memory which is registered as resource.
70 * arg is (start_pfn, nr_pages, private_arg_pointer) 82 * arg is (start_pfn, nr_pages, private_arg_pointer)
71 */ 83 */
72extern int walk_memory_resource(unsigned long start_pfn, 84extern int walk_memory_resource(unsigned long start_pfn,
@@ -142,6 +154,18 @@ static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
142#endif /* CONFIG_NUMA */ 154#endif /* CONFIG_NUMA */
143#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ 155#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
144 156
157#ifdef CONFIG_SPARSEMEM_VMEMMAP
158static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
159{
160}
161static inline void put_page_bootmem(struct page *page)
162{
163}
164#else
165extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
166extern void put_page_bootmem(struct page *page);
167#endif
168
145#else /* ! CONFIG_MEMORY_HOTPLUG */ 169#else /* ! CONFIG_MEMORY_HOTPLUG */
146/* 170/*
147 * Stub functions for when hotplug is off 171 * Stub functions for when hotplug is off
@@ -169,6 +193,10 @@ static inline int mhp_notimplemented(const char *func)
169 return -ENOSYS; 193 return -ENOSYS;
170} 194}
171 195
196static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
197{
198}
199
172#endif /* ! CONFIG_MEMORY_HOTPLUG */ 200#endif /* ! CONFIG_MEMORY_HOTPLUG */
173 201
174extern int add_memory(int nid, u64 start, u64 size); 202extern int add_memory(int nid, u64 start, u64 size);
@@ -176,5 +204,8 @@ extern int arch_add_memory(int nid, u64 start, u64 size);
176extern int remove_memory(u64 start, u64 size); 204extern int remove_memory(u64 start, u64 size);
177extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 205extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
178 int nr_pages); 206 int nr_pages);
207extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
208extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
209 unsigned long pnum);
179 210
180#endif /* __LINUX_MEMORY_HOTPLUG_H */ 211#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 59c4865bc85f..3a39570b81b8 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -8,15 +8,32 @@
8 * Copyright 2003,2004 Andi Kleen SuSE Labs 8 * Copyright 2003,2004 Andi Kleen SuSE Labs
9 */ 9 */
10 10
11/*
12 * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are
13 * passed by the user to either set_mempolicy() or mbind() in an 'int' actual.
14 * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags.
15 */
16
11/* Policies */ 17/* Policies */
12#define MPOL_DEFAULT 0 18enum {
13#define MPOL_PREFERRED 1 19 MPOL_DEFAULT,
14#define MPOL_BIND 2 20 MPOL_PREFERRED,
15#define MPOL_INTERLEAVE 3 21 MPOL_BIND,
22 MPOL_INTERLEAVE,
23 MPOL_MAX, /* always last member of enum */
24};
16 25
17#define MPOL_MAX MPOL_INTERLEAVE 26/* Flags for set_mempolicy */
27#define MPOL_F_STATIC_NODES (1 << 15)
28#define MPOL_F_RELATIVE_NODES (1 << 14)
18 29
19/* Flags for get_mem_policy */ 30/*
31 * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to
32 * either set_mempolicy() or mbind().
33 */
34#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES)
35
36/* Flags for get_mempolicy */
20#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ 37#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */
21#define MPOL_F_ADDR (1<<1) /* look up vma using address */ 38#define MPOL_F_ADDR (1<<1) /* look up vma using address */
22#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ 39#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */
@@ -27,6 +44,14 @@
27#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ 44#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
28#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */ 45#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
29 46
47/*
48 * Internal flags that share the struct mempolicy flags word with
49 * "mode flags". These flags are allocated from bit 0 up, as they
50 * are never OR'ed into the mode in mempolicy API arguments.
51 */
52#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
53#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
54
30#ifdef __KERNEL__ 55#ifdef __KERNEL__
31 56
32#include <linux/mmzone.h> 57#include <linux/mmzone.h>
@@ -35,7 +60,6 @@
35#include <linux/spinlock.h> 60#include <linux/spinlock.h>
36#include <linux/nodemask.h> 61#include <linux/nodemask.h>
37 62
38struct vm_area_struct;
39struct mm_struct; 63struct mm_struct;
40 64
41#ifdef CONFIG_NUMA 65#ifdef CONFIG_NUMA
@@ -54,22 +78,27 @@ struct mm_struct;
54 * mmap_sem. 78 * mmap_sem.
55 * 79 *
56 * Freeing policy: 80 * Freeing policy:
57 * When policy is MPOL_BIND v.zonelist is kmalloc'ed and must be kfree'd. 81 * Mempolicy objects are reference counted. A mempolicy will be freed when
58 * All other policies don't have any external state. mpol_free() handles this. 82 * mpol_put() decrements the reference count to zero.
59 * 83 *
60 * Copying policy objects: 84 * Duplicating policy objects:
61 * For MPOL_BIND the zonelist must be always duplicated. mpol_clone() does this. 85 * mpol_dup() allocates a new mempolicy and copies the specified mempolicy
86 * to the new storage. The reference count of the new object is initialized
87 * to 1, representing the caller of mpol_dup().
62 */ 88 */
63struct mempolicy { 89struct mempolicy {
64 atomic_t refcnt; 90 atomic_t refcnt;
65 short policy; /* See MPOL_* above */ 91 unsigned short mode; /* See MPOL_* above */
92 unsigned short flags; /* See set_mempolicy() MPOL_F_* above */
66 union { 93 union {
67 struct zonelist *zonelist; /* bind */
68 short preferred_node; /* preferred */ 94 short preferred_node; /* preferred */
69 nodemask_t nodes; /* interleave */ 95 nodemask_t nodes; /* interleave/bind */
70 /* undefined for default */ 96 /* undefined for default */
71 } v; 97 } v;
72 nodemask_t cpuset_mems_allowed; /* mempolicy relative to these nodes */ 98 union {
99 nodemask_t cpuset_mems_allowed; /* relative to these nodes */
100 nodemask_t user_nodemask; /* nodemask passed by user */
101 } w;
73}; 102};
74 103
75/* 104/*
@@ -77,18 +106,43 @@ struct mempolicy {
77 * The default fast path of a NULL MPOL_DEFAULT policy is always inlined. 106 * The default fast path of a NULL MPOL_DEFAULT policy is always inlined.
78 */ 107 */
79 108
80extern void __mpol_free(struct mempolicy *pol); 109extern void __mpol_put(struct mempolicy *pol);
81static inline void mpol_free(struct mempolicy *pol) 110static inline void mpol_put(struct mempolicy *pol)
82{ 111{
83 if (pol) 112 if (pol)
84 __mpol_free(pol); 113 __mpol_put(pol);
85} 114}
86 115
87extern struct mempolicy *__mpol_copy(struct mempolicy *pol); 116/*
88static inline struct mempolicy *mpol_copy(struct mempolicy *pol) 117 * Does mempolicy pol need explicit unref after use?
118 * Currently only needed for shared policies.
119 */
120static inline int mpol_needs_cond_ref(struct mempolicy *pol)
121{
122 return (pol && (pol->flags & MPOL_F_SHARED));
123}
124
125static inline void mpol_cond_put(struct mempolicy *pol)
126{
127 if (mpol_needs_cond_ref(pol))
128 __mpol_put(pol);
129}
130
131extern struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
132 struct mempolicy *frompol);
133static inline struct mempolicy *mpol_cond_copy(struct mempolicy *tompol,
134 struct mempolicy *frompol)
135{
136 if (!frompol)
137 return frompol;
138 return __mpol_cond_copy(tompol, frompol);
139}
140
141extern struct mempolicy *__mpol_dup(struct mempolicy *pol);
142static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
89{ 143{
90 if (pol) 144 if (pol)
91 pol = __mpol_copy(pol); 145 pol = __mpol_dup(pol);
92 return pol; 146 return pol;
93} 147}
94 148
@@ -108,11 +162,6 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
108 return 1; 162 return 1;
109 return __mpol_equal(a, b); 163 return __mpol_equal(a, b);
110} 164}
111#define vma_mpol_equal(a,b) mpol_equal(vma_policy(a), vma_policy(b))
112
113/* Could later add inheritance of the process policy here. */
114
115#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL)
116 165
117/* 166/*
118 * Tree of shared policies for a shared memory region. 167 * Tree of shared policies for a shared memory region.
@@ -133,8 +182,7 @@ struct shared_policy {
133 spinlock_t lock; 182 spinlock_t lock;
134}; 183};
135 184
136void mpol_shared_policy_init(struct shared_policy *info, int policy, 185void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
137 nodemask_t *nodes);
138int mpol_set_shared_policy(struct shared_policy *info, 186int mpol_set_shared_policy(struct shared_policy *info,
139 struct vm_area_struct *vma, 187 struct vm_area_struct *vma,
140 struct mempolicy *new); 188 struct mempolicy *new);
@@ -149,9 +197,9 @@ extern void mpol_rebind_task(struct task_struct *tsk,
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 197extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150extern void mpol_fix_fork_child_flag(struct task_struct *p); 198extern void mpol_fix_fork_child_flag(struct task_struct *p);
151 199
152extern struct mempolicy default_policy;
153extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 200extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
154 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol); 201 unsigned long addr, gfp_t gfp_flags,
202 struct mempolicy **mpol, nodemask_t **nodemask);
155extern unsigned slab_node(struct mempolicy *policy); 203extern unsigned slab_node(struct mempolicy *policy);
156 204
157extern enum zone_type policy_zone; 205extern enum zone_type policy_zone;
@@ -165,6 +213,13 @@ static inline void check_highest_zone(enum zone_type k)
165int do_migrate_pages(struct mm_struct *mm, 213int do_migrate_pages(struct mm_struct *mm,
166 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags); 214 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
167 215
216
217#ifdef CONFIG_TMPFS
218extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context);
219
220extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
221 int no_context);
222#endif
168#else 223#else
169 224
170struct mempolicy {}; 225struct mempolicy {};
@@ -173,19 +228,26 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
173{ 228{
174 return 1; 229 return 1;
175} 230}
176#define vma_mpol_equal(a,b) 1
177 231
178#define mpol_set_vma_default(vma) do {} while(0) 232static inline void mpol_put(struct mempolicy *p)
233{
234}
235
236static inline void mpol_cond_put(struct mempolicy *pol)
237{
238}
179 239
180static inline void mpol_free(struct mempolicy *p) 240static inline struct mempolicy *mpol_cond_copy(struct mempolicy *to,
241 struct mempolicy *from)
181{ 242{
243 return from;
182} 244}
183 245
184static inline void mpol_get(struct mempolicy *pol) 246static inline void mpol_get(struct mempolicy *pol)
185{ 247{
186} 248}
187 249
188static inline struct mempolicy *mpol_copy(struct mempolicy *old) 250static inline struct mempolicy *mpol_dup(struct mempolicy *old)
189{ 251{
190 return NULL; 252 return NULL;
191} 253}
@@ -199,8 +261,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info,
199 return -EINVAL; 261 return -EINVAL;
200} 262}
201 263
202static inline void mpol_shared_policy_init(struct shared_policy *info, 264static inline void mpol_shared_policy_init(struct shared_policy *sp,
203 int policy, nodemask_t *nodes) 265 struct mempolicy *mpol)
204{ 266{
205} 267}
206 268
@@ -239,9 +301,12 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)
239} 301}
240 302
241static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 303static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
242 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol) 304 unsigned long addr, gfp_t gfp_flags,
305 struct mempolicy **mpol, nodemask_t **nodemask)
243{ 306{
244 return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags); 307 *mpol = NULL;
308 *nodemask = NULL;
309 return node_zonelist(0, gfp_flags);
245} 310}
246 311
247static inline int do_migrate_pages(struct mm_struct *mm, 312static inline int do_migrate_pages(struct mm_struct *mm,
@@ -254,6 +319,21 @@ static inline int do_migrate_pages(struct mm_struct *mm,
254static inline void check_highest_zone(int k) 319static inline void check_highest_zone(int k)
255{ 320{
256} 321}
322
323#ifdef CONFIG_TMPFS
324static inline int mpol_parse_str(char *str, struct mempolicy **mpol,
325 int no_context)
326{
327 return 1; /* error */
328}
329
330static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
331 int no_context)
332{
333 return 0;
334}
335#endif
336
257#endif /* CONFIG_NUMA */ 337#endif /* CONFIG_NUMA */
258#endif /* __KERNEL__ */ 338#endif /* __KERNEL__ */
259 339
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 286d31521605..8b7f4a5d4f6a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -107,6 +107,7 @@ extern unsigned int kobjsize(const void *objp);
107#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 107#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */
108 108
109#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 109#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
110#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
110 111
111#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 112#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
112#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 113#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -164,8 +165,6 @@ struct vm_operations_struct {
164 void (*open)(struct vm_area_struct * area); 165 void (*open)(struct vm_area_struct * area);
165 void (*close)(struct vm_area_struct * area); 166 void (*close)(struct vm_area_struct * area);
166 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); 167 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
167 struct page *(*nopage)(struct vm_area_struct *area,
168 unsigned long address, int *type);
169 unsigned long (*nopfn)(struct vm_area_struct *area, 168 unsigned long (*nopfn)(struct vm_area_struct *area,
170 unsigned long address); 169 unsigned long address);
171 170
@@ -173,7 +172,25 @@ struct vm_operations_struct {
173 * writable, if an error is returned it will cause a SIGBUS */ 172 * writable, if an error is returned it will cause a SIGBUS */
174 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); 173 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
175#ifdef CONFIG_NUMA 174#ifdef CONFIG_NUMA
175 /*
176 * set_policy() op must add a reference to any non-NULL @new mempolicy
177 * to hold the policy upon return. Caller should pass NULL @new to
178 * remove a policy and fall back to surrounding context--i.e. do not
179 * install a MPOL_DEFAULT policy, nor the task or system default
180 * mempolicy.
181 */
176 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); 182 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
183
184 /*
185 * get_policy() op must add reference [mpol_get()] to any policy at
186 * (vma,addr) marked as MPOL_SHARED. The shared policy infrastructure
187 * in mm/mempolicy.c will do this automatically.
188 * get_policy() must NOT add a ref if the policy at (vma,addr) is not
189 * marked as MPOL_SHARED. vma policies are protected by the mmap_sem.
190 * If no [shared/vma] mempolicy exists at the addr, get_policy() op
191 * must return NULL--i.e., do not "fallback" to task or system default
192 * policy.
193 */
177 struct mempolicy *(*get_policy)(struct vm_area_struct *vma, 194 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
178 unsigned long addr); 195 unsigned long addr);
179 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, 196 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
@@ -397,11 +414,11 @@ static inline void set_compound_order(struct page *page, unsigned long order)
397 * we have run out of space and have to fall back to an 414 * we have run out of space and have to fall back to an
398 * alternate (slower) way of determining the node. 415 * alternate (slower) way of determining the node.
399 * 416 *
400 * No sparsemem: | NODE | ZONE | ... | FLAGS | 417 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
401 * with space for node: | SECTION | NODE | ZONE | ... | FLAGS | 418 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
402 * no space for node: | SECTION | ZONE | ... | FLAGS | 419 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
403 */ 420 */
404#ifdef CONFIG_SPARSEMEM 421#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
405#define SECTIONS_WIDTH SECTIONS_SHIFT 422#define SECTIONS_WIDTH SECTIONS_SHIFT
406#else 423#else
407#define SECTIONS_WIDTH 0 424#define SECTIONS_WIDTH 0
@@ -409,9 +426,12 @@ static inline void set_compound_order(struct page *page, unsigned long order)
409 426
410#define ZONES_WIDTH ZONES_SHIFT 427#define ZONES_WIDTH ZONES_SHIFT
411 428
412#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED 429#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
413#define NODES_WIDTH NODES_SHIFT 430#define NODES_WIDTH NODES_SHIFT
414#else 431#else
432#ifdef CONFIG_SPARSEMEM_VMEMMAP
433#error "Vmemmap: No space for nodes field in page flags"
434#endif
415#define NODES_WIDTH 0 435#define NODES_WIDTH 0
416#endif 436#endif
417 437
@@ -454,8 +474,8 @@ static inline void set_compound_order(struct page *page, unsigned long order)
454 474
455#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0)) 475#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
456 476
457#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 477#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
458#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 478#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
459#endif 479#endif
460 480
461#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 481#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
@@ -504,10 +524,12 @@ static inline struct zone *page_zone(struct page *page)
504 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 524 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
505} 525}
506 526
527#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
507static inline unsigned long page_to_section(struct page *page) 528static inline unsigned long page_to_section(struct page *page)
508{ 529{
509 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 530 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
510} 531}
532#endif
511 533
512static inline void set_page_zone(struct page *page, enum zone_type zone) 534static inline void set_page_zone(struct page *page, enum zone_type zone)
513{ 535{
@@ -602,9 +624,12 @@ static inline struct address_space *page_mapping(struct page *page)
602 struct address_space *mapping = page->mapping; 624 struct address_space *mapping = page->mapping;
603 625
604 VM_BUG_ON(PageSlab(page)); 626 VM_BUG_ON(PageSlab(page));
627#ifdef CONFIG_SWAP
605 if (unlikely(PageSwapCache(page))) 628 if (unlikely(PageSwapCache(page)))
606 mapping = &swapper_space; 629 mapping = &swapper_space;
607 else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) 630 else
631#endif
632 if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
608 mapping = NULL; 633 mapping = NULL;
609 return mapping; 634 return mapping;
610} 635}
@@ -649,12 +674,6 @@ static inline int page_mapped(struct page *page)
649} 674}
650 675
651/* 676/*
652 * Error return values for the *_nopage functions
653 */
654#define NOPAGE_SIGBUS (NULL)
655#define NOPAGE_OOM ((struct page *) (-1))
656
657/*
658 * Error return values for the *_nopfn functions 677 * Error return values for the *_nopfn functions
659 */ 678 */
660#define NOPFN_SIGBUS ((unsigned long) -1) 679#define NOPFN_SIGBUS ((unsigned long) -1)
@@ -720,7 +739,9 @@ struct zap_details {
720 unsigned long truncate_count; /* Compare vm_truncate_count */ 739 unsigned long truncate_count; /* Compare vm_truncate_count */
721}; 740};
722 741
723struct page *vm_normal_page(struct vm_area_struct *, unsigned long, pte_t); 742struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
743 pte_t pte);
744
724unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 745unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
725 unsigned long size, struct zap_details *); 746 unsigned long size, struct zap_details *);
726unsigned long unmap_vmas(struct mmu_gather **tlb, 747unsigned long unmap_vmas(struct mmu_gather **tlb,
@@ -1149,6 +1170,8 @@ int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
1149int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); 1170int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
1150int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, 1171int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1151 unsigned long pfn); 1172 unsigned long pfn);
1173int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
1174 unsigned long pfn);
1152 1175
1153struct page *follow_page(struct vm_area_struct *, unsigned long address, 1176struct page *follow_page(struct vm_area_struct *, unsigned long address,
1154 unsigned int foll_flags); 1177 unsigned int foll_flags);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index af190ceab971..29adaa781cb6 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -172,6 +172,7 @@ struct mm_struct {
172 atomic_t mm_users; /* How many users with user space? */ 172 atomic_t mm_users; /* How many users with user space? */
173 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 173 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
174 int map_count; /* number of VMAs */ 174 int map_count; /* number of VMAs */
175 int core_waiters;
175 struct rw_semaphore mmap_sem; 176 struct rw_semaphore mmap_sem;
176 spinlock_t page_table_lock; /* Protects page tables and some counters */ 177 spinlock_t page_table_lock; /* Protects page tables and some counters */
177 178
@@ -216,11 +217,10 @@ struct mm_struct {
216 unsigned long flags; /* Must use atomic bitops to access the bits */ 217 unsigned long flags; /* Must use atomic bitops to access the bits */
217 218
218 /* coredumping support */ 219 /* coredumping support */
219 int core_waiters;
220 struct completion *core_startup_done, core_done; 220 struct completion *core_startup_done, core_done;
221 221
222 /* aio bits */ 222 /* aio bits */
223 rwlock_t ioctx_list_lock; 223 rwlock_t ioctx_list_lock; /* aio lock */
224 struct kioctx *ioctx_list; 224 struct kioctx *ioctx_list;
225#ifdef CONFIG_CGROUP_MEM_RES_CTLR 225#ifdef CONFIG_CGROUP_MEM_RES_CTLR
226 struct mem_cgroup *mem_cgroup; 226 struct mem_cgroup *mem_cgroup;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9f274a687c7e..aad98003176f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6#ifndef __GENERATING_BOUNDS_H
6 7
7#include <linux/spinlock.h> 8#include <linux/spinlock.h>
8#include <linux/list.h> 9#include <linux/list.h>
@@ -15,6 +16,7 @@
15#include <linux/seqlock.h> 16#include <linux/seqlock.h>
16#include <linux/nodemask.h> 17#include <linux/nodemask.h>
17#include <linux/pageblock-flags.h> 18#include <linux/pageblock-flags.h>
19#include <linux/bounds.h>
18#include <asm/atomic.h> 20#include <asm/atomic.h>
19#include <asm/page.h> 21#include <asm/page.h>
20 22
@@ -129,6 +131,8 @@ struct per_cpu_pageset {
129#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) 131#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
130#endif 132#endif
131 133
134#endif /* !__GENERATING_BOUNDS.H */
135
132enum zone_type { 136enum zone_type {
133#ifdef CONFIG_ZONE_DMA 137#ifdef CONFIG_ZONE_DMA
134 /* 138 /*
@@ -177,9 +181,11 @@ enum zone_type {
177 ZONE_HIGHMEM, 181 ZONE_HIGHMEM,
178#endif 182#endif
179 ZONE_MOVABLE, 183 ZONE_MOVABLE,
180 MAX_NR_ZONES 184 __MAX_NR_ZONES
181}; 185};
182 186
187#ifndef __GENERATING_BOUNDS_H
188
183/* 189/*
184 * When a memory allocation must conform to specific limitations (such 190 * When a memory allocation must conform to specific limitations (such
185 * as being suitable for DMA) the caller will pass in hints to the 191 * as being suitable for DMA) the caller will pass in hints to the
@@ -188,28 +194,15 @@ enum zone_type {
188 * match the requested limits. See gfp_zone() in include/linux/gfp.h 194 * match the requested limits. See gfp_zone() in include/linux/gfp.h
189 */ 195 */
190 196
191/* 197#if MAX_NR_ZONES < 2
192 * Count the active zones. Note that the use of defined(X) outside
193 * #if and family is not necessarily defined so ensure we cannot use
194 * it later. Use __ZONE_COUNT to work out how many shift bits we need.
195 */
196#define __ZONE_COUNT ( \
197 defined(CONFIG_ZONE_DMA) \
198 + defined(CONFIG_ZONE_DMA32) \
199 + 1 \
200 + defined(CONFIG_HIGHMEM) \
201 + 1 \
202)
203#if __ZONE_COUNT < 2
204#define ZONES_SHIFT 0 198#define ZONES_SHIFT 0
205#elif __ZONE_COUNT <= 2 199#elif MAX_NR_ZONES <= 2
206#define ZONES_SHIFT 1 200#define ZONES_SHIFT 1
207#elif __ZONE_COUNT <= 4 201#elif MAX_NR_ZONES <= 4
208#define ZONES_SHIFT 2 202#define ZONES_SHIFT 2
209#else 203#else
210#error ZONES_SHIFT -- too many zones configured adjust calculation 204#error ZONES_SHIFT -- too many zones configured adjust calculation
211#endif 205#endif
212#undef __ZONE_COUNT
213 206
214struct zone { 207struct zone {
215 /* Fields commonly accessed by the page allocator */ 208 /* Fields commonly accessed by the page allocator */
@@ -393,10 +386,10 @@ static inline int zone_is_oom_locked(const struct zone *zone)
393 * The NUMA zonelists are doubled becausse we need zonelists that restrict the 386 * The NUMA zonelists are doubled becausse we need zonelists that restrict the
394 * allocations to a single node for GFP_THISNODE. 387 * allocations to a single node for GFP_THISNODE.
395 * 388 *
396 * [0 .. MAX_NR_ZONES -1] : Zonelists with fallback 389 * [0] : Zonelist with fallback
397 * [MAZ_NR_ZONES ... MAZ_ZONELISTS -1] : No fallback (GFP_THISNODE) 390 * [1] : No fallback (GFP_THISNODE)
398 */ 391 */
399#define MAX_ZONELISTS (2 * MAX_NR_ZONES) 392#define MAX_ZONELISTS 2
400 393
401 394
402/* 395/*
@@ -464,11 +457,20 @@ struct zonelist_cache {
464 unsigned long last_full_zap; /* when last zap'd (jiffies) */ 457 unsigned long last_full_zap; /* when last zap'd (jiffies) */
465}; 458};
466#else 459#else
467#define MAX_ZONELISTS MAX_NR_ZONES 460#define MAX_ZONELISTS 1
468struct zonelist_cache; 461struct zonelist_cache;
469#endif 462#endif
470 463
471/* 464/*
465 * This struct contains information about a zone in a zonelist. It is stored
466 * here to avoid dereferences into large structures and lookups of tables
467 */
468struct zoneref {
469 struct zone *zone; /* Pointer to actual zone */
470 int zone_idx; /* zone_idx(zoneref->zone) */
471};
472
473/*
472 * One allocation request operates on a zonelist. A zonelist 474 * One allocation request operates on a zonelist. A zonelist
473 * is a list of zones, the first one is the 'goal' of the 475 * is a list of zones, the first one is the 'goal' of the
474 * allocation, the other zones are fallback zones, in decreasing 476 * allocation, the other zones are fallback zones, in decreasing
@@ -476,34 +478,23 @@ struct zonelist_cache;
476 * 478 *
477 * If zlcache_ptr is not NULL, then it is just the address of zlcache, 479 * If zlcache_ptr is not NULL, then it is just the address of zlcache,
478 * as explained above. If zlcache_ptr is NULL, there is no zlcache. 480 * as explained above. If zlcache_ptr is NULL, there is no zlcache.
481 * *
482 * To speed the reading of the zonelist, the zonerefs contain the zone index
483 * of the entry being read. Helper functions to access information given
484 * a struct zoneref are
485 *
486 * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
487 * zonelist_zone_idx() - Return the index of the zone for an entry
488 * zonelist_node_idx() - Return the index of the node for an entry
479 */ 489 */
480
481struct zonelist { 490struct zonelist {
482 struct zonelist_cache *zlcache_ptr; // NULL or &zlcache 491 struct zonelist_cache *zlcache_ptr; // NULL or &zlcache
483 struct zone *zones[MAX_ZONES_PER_ZONELIST + 1]; // NULL delimited 492 struct zoneref _zonerefs[MAX_ZONES_PER_ZONELIST + 1];
484#ifdef CONFIG_NUMA 493#ifdef CONFIG_NUMA
485 struct zonelist_cache zlcache; // optional ... 494 struct zonelist_cache zlcache; // optional ...
486#endif 495#endif
487}; 496};
488 497
489#ifdef CONFIG_NUMA
490/*
491 * Only custom zonelists like MPOL_BIND need to be filtered as part of
492 * policies. As described in the comment for struct zonelist_cache, these
493 * zonelists will not have a zlcache so zlcache_ptr will not be set. Use
494 * that to determine if the zonelists needs to be filtered or not.
495 */
496static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
497{
498 return !zonelist->zlcache_ptr;
499}
500#else
501static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
502{
503 return 0;
504}
505#endif /* CONFIG_NUMA */
506
507#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 498#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
508struct node_active_region { 499struct node_active_region {
509 unsigned long start_pfn; 500 unsigned long start_pfn;
@@ -637,9 +628,10 @@ static inline int is_normal_idx(enum zone_type idx)
637static inline int is_highmem(struct zone *zone) 628static inline int is_highmem(struct zone *zone)
638{ 629{
639#ifdef CONFIG_HIGHMEM 630#ifdef CONFIG_HIGHMEM
640 int zone_idx = zone - zone->zone_pgdat->node_zones; 631 int zone_off = (char *)zone - (char *)zone->zone_pgdat->node_zones;
641 return zone_idx == ZONE_HIGHMEM || 632 return zone_off == ZONE_HIGHMEM * sizeof(*zone) ||
642 (zone_idx == ZONE_MOVABLE && zone_movable_is_highmem()); 633 (zone_off == ZONE_MOVABLE * sizeof(*zone) &&
634 zone_movable_is_highmem());
643#else 635#else
644 return 0; 636 return 0;
645#endif 637#endif
@@ -730,32 +722,103 @@ extern struct zone *next_zone(struct zone *zone);
730 zone; \ 722 zone; \
731 zone = next_zone(zone)) 723 zone = next_zone(zone))
732 724
733#ifdef CONFIG_SPARSEMEM 725static inline struct zone *zonelist_zone(struct zoneref *zoneref)
734#include <asm/sparsemem.h> 726{
735#endif 727 return zoneref->zone;
728}
736 729
737#if BITS_PER_LONG == 32 730static inline int zonelist_zone_idx(struct zoneref *zoneref)
738/* 731{
739 * with 32 bit page->flags field, we reserve 9 bits for node/zone info. 732 return zoneref->zone_idx;
740 * there are 4 zones (3 bits) and this leaves 9-3=6 bits for nodes. 733}
734
735static inline int zonelist_node_idx(struct zoneref *zoneref)
736{
737#ifdef CONFIG_NUMA
738 /* zone_to_nid not available in this context */
739 return zoneref->zone->node;
740#else
741 return 0;
742#endif /* CONFIG_NUMA */
743}
744
745/**
746 * next_zones_zonelist - Returns the next zone at or below highest_zoneidx within the allowed nodemask using a cursor within a zonelist as a starting point
747 * @z - The cursor used as a starting point for the search
748 * @highest_zoneidx - The zone index of the highest zone to return
749 * @nodes - An optional nodemask to filter the zonelist with
750 * @zone - The first suitable zone found is returned via this parameter
751 *
752 * This function returns the next zone at or below a given zone index that is
753 * within the allowed nodemask using a cursor as the starting point for the
754 * search. The zoneref returned is a cursor that is used as the next starting
755 * point for future calls to next_zones_zonelist().
741 */ 756 */
742#define FLAGS_RESERVED 9 757struct zoneref *next_zones_zonelist(struct zoneref *z,
758 enum zone_type highest_zoneidx,
759 nodemask_t *nodes,
760 struct zone **zone);
743 761
744#elif BITS_PER_LONG == 64 762/**
745/* 763 * first_zones_zonelist - Returns the first zone at or below highest_zoneidx within the allowed nodemask in a zonelist
746 * with 64 bit flags field, there's plenty of room. 764 * @zonelist - The zonelist to search for a suitable zone
765 * @highest_zoneidx - The zone index of the highest zone to return
766 * @nodes - An optional nodemask to filter the zonelist with
767 * @zone - The first suitable zone found is returned via this parameter
768 *
769 * This function returns the first zone at or below a given zone index that is
770 * within the allowed nodemask. The zoneref returned is a cursor that can be
771 * used to iterate the zonelist with next_zones_zonelist. The cursor should
772 * not be used by the caller as it does not match the value of the zone
773 * returned.
747 */ 774 */
748#define FLAGS_RESERVED 32 775static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
776 enum zone_type highest_zoneidx,
777 nodemask_t *nodes,
778 struct zone **zone)
779{
780 return next_zones_zonelist(zonelist->_zonerefs, highest_zoneidx, nodes,
781 zone);
782}
749 783
750#else 784/**
785 * for_each_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a given zone index and within a nodemask
786 * @zone - The current zone in the iterator
787 * @z - The current pointer within zonelist->zones being iterated
788 * @zlist - The zonelist being iterated
789 * @highidx - The zone index of the highest zone to return
790 * @nodemask - Nodemask allowed by the allocator
791 *
792 * This iterator iterates though all zones at or below a given zone index and
793 * within a given nodemask
794 */
795#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \
796 for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \
797 zone; \
798 z = next_zones_zonelist(z, highidx, nodemask, &zone)) \
751 799
752#error BITS_PER_LONG not defined 800/**
801 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
802 * @zone - The current zone in the iterator
803 * @z - The current pointer within zonelist->zones being iterated
804 * @zlist - The zonelist being iterated
805 * @highidx - The zone index of the highest zone to return
806 *
807 * This iterator iterates though all zones at or below a given zone index.
808 */
809#define for_each_zone_zonelist(zone, z, zlist, highidx) \
810 for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, NULL)
753 811
812#ifdef CONFIG_SPARSEMEM
813#include <asm/sparsemem.h>
754#endif 814#endif
755 815
756#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ 816#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
757 !defined(CONFIG_ARCH_POPULATES_NODE_MAP) 817 !defined(CONFIG_ARCH_POPULATES_NODE_MAP)
758#define early_pfn_to_nid(nid) (0UL) 818static inline unsigned long early_pfn_to_nid(unsigned long pfn)
819{
820 return 0;
821}
759#endif 822#endif
760 823
761#ifdef CONFIG_FLATMEM 824#ifdef CONFIG_FLATMEM
@@ -833,6 +896,7 @@ static inline struct mem_section *__nr_to_section(unsigned long nr)
833 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; 896 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
834} 897}
835extern int __section_nr(struct mem_section* ms); 898extern int __section_nr(struct mem_section* ms);
899extern unsigned long usemap_size(void);
836 900
837/* 901/*
838 * We use the lower bits of the mem_map pointer to store 902 * We use the lower bits of the mem_map pointer to store
@@ -938,6 +1002,7 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
938#define pfn_valid_within(pfn) (1) 1002#define pfn_valid_within(pfn) (1)
939#endif 1003#endif
940 1004
1005#endif /* !__GENERATING_BOUNDS.H */
941#endif /* !__ASSEMBLY__ */ 1006#endif /* !__ASSEMBLY__ */
942#endif /* __KERNEL__ */ 1007#endif /* __KERNEL__ */
943#endif /* _LINUX_MMZONE_H */ 1008#endif /* _LINUX_MMZONE_H */
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index f950921523f5..b03b27457413 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -58,7 +58,11 @@
58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ 58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
59 59
60/* media of boot sector */ 60/* media of boot sector */
61#define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0) 61static inline int fat_valid_media(u8 media)
62{
63 return 0xf8 <= media || media == 0xf0;
64}
65
62#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ 66#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
63 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) 67 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
64 68
@@ -195,6 +199,7 @@ struct fat_mount_options {
195 char *iocharset; /* Charset used for filename input/display */ 199 char *iocharset; /* Charset used for filename input/display */
196 unsigned short shortname; /* flags for shortname display/create rule */ 200 unsigned short shortname; /* flags for shortname display/create rule */
197 unsigned char name_check; /* r = relaxed, n = normal, s = strict */ 201 unsigned char name_check; /* r = relaxed, n = normal, s = strict */
202 unsigned short allow_utime;/* permission for setting the [am]time */
198 unsigned quiet:1, /* set = fake successful chmods and chowns */ 203 unsigned quiet:1, /* set = fake successful chmods and chowns */
199 showexec:1, /* set = only set x bit for com/exe/bat */ 204 showexec:1, /* set = only set x bit for com/exe/bat */
200 sys_immutable:1, /* set = system files are immutable */ 205 sys_immutable:1, /* set = system files are immutable */
@@ -232,6 +237,7 @@ struct msdos_sb_info {
232 struct mutex fat_lock; 237 struct mutex fat_lock;
233 unsigned int prev_free; /* previously allocated cluster number */ 238 unsigned int prev_free; /* previously allocated cluster number */
234 unsigned int free_clusters; /* -1 if undefined */ 239 unsigned int free_clusters; /* -1 if undefined */
240 unsigned int free_clus_valid; /* is free_clusters valid? */
235 struct fat_mount_options options; 241 struct fat_mount_options options;
236 struct nls_table *nls_disk; /* Codepage used on disk */ 242 struct nls_table *nls_disk; /* Codepage used on disk */
237 struct nls_table *nls_io; /* Charset used for input and display */ 243 struct nls_table *nls_io; /* Charset used for input and display */
@@ -401,7 +407,7 @@ extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
401 unsigned int cmd, unsigned long arg); 407 unsigned int cmd, unsigned long arg);
402extern const struct file_operations fat_file_operations; 408extern const struct file_operations fat_file_operations;
403extern const struct inode_operations fat_file_inode_operations; 409extern const struct inode_operations fat_file_inode_operations;
404extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 410extern int fat_setattr(struct dentry * dentry, struct iattr * attr);
405extern void fat_truncate(struct inode *inode); 411extern void fat_truncate(struct inode *inode);
406extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, 412extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
407 struct kstat *stat); 413 struct kstat *stat);
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 88766e43e121..9f2d76347f19 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -204,6 +204,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
204/* linux/fs/ncpfs/dir.c */ 204/* linux/fs/ncpfs/dir.c */
205extern const struct inode_operations ncp_dir_inode_operations; 205extern const struct inode_operations ncp_dir_inode_operations;
206extern const struct file_operations ncp_dir_operations; 206extern const struct file_operations ncp_dir_operations;
207extern struct dentry_operations ncp_root_dentry_operations;
207int ncp_conn_logged_in(struct super_block *); 208int ncp_conn_logged_in(struct super_block *);
208int ncp_date_dos2unix(__le16 time, __le16 date); 209int ncp_date_dos2unix(__le16 time, __le16 date);
209void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
@@ -223,6 +224,12 @@ int ncp_disconnect(struct ncp_server *server);
223void ncp_lock_server(struct ncp_server *server); 224void ncp_lock_server(struct ncp_server *server);
224void ncp_unlock_server(struct ncp_server *server); 225void ncp_unlock_server(struct ncp_server *server);
225 226
227/* linux/fs/ncpfs/symlink.c */
228#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
229extern const struct address_space_operations ncp_symlink_aops;
230int ncp_symlink(struct inode*, struct dentry*, const char*);
231#endif
232
226/* linux/fs/ncpfs/file.c */ 233/* linux/fs/ncpfs/file.c */
227extern const struct inode_operations ncp_file_inode_operations; 234extern const struct inode_operations ncp_file_inode_operations;
228extern const struct file_operations ncp_file_operations; 235extern const struct file_operations ncp_file_operations;
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 905e18f4b412..848025cd7087 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -14,6 +14,8 @@
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. 15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c.
16 * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. 16 * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c.
17 * For details of nodes_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of nodes_fold(), see bitmap_fold in lib/bitmap.c.
17 * 19 *
18 * The available nodemask operations are: 20 * The available nodemask operations are:
19 * 21 *
@@ -55,7 +57,9 @@
55 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing 57 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing
56 * int nodelist_parse(buf, map) Parse ascii string as nodelist 58 * int nodelist_parse(buf, map) Parse ascii string as nodelist
57 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 59 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
58 * int nodes_remap(dst, src, old, new) *dst = map(old, new)(dst) 60 * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src)
61 * void nodes_onto(dst, orig, relmap) *dst = orig relative to relmap
62 * void nodes_fold(dst, orig, sz) dst bits = orig bits mod sz
59 * 63 *
60 * for_each_node_mask(node, mask) for-loop node over mask 64 * for_each_node_mask(node, mask) for-loop node over mask
61 * 65 *
@@ -326,6 +330,22 @@ static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp,
326 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); 330 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
327} 331}
328 332
333#define nodes_onto(dst, orig, relmap) \
334 __nodes_onto(&(dst), &(orig), &(relmap), MAX_NUMNODES)
335static inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp,
336 const nodemask_t *relmapp, int nbits)
337{
338 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
339}
340
341#define nodes_fold(dst, orig, sz) \
342 __nodes_fold(&(dst), &(orig), sz, MAX_NUMNODES)
343static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
344 int sz, int nbits)
345{
346 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
347}
348
329#if MAX_NUMNODES > 1 349#if MAX_NUMNODES > 1
330#define for_each_node_mask(node, mask) \ 350#define for_each_node_mask(node, mask) \
331 for ((node) = first_node(mask); \ 351 for ((node) = first_node(mask); \
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index f4df40038f0c..20dfed590183 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -247,6 +247,7 @@ extern struct blocking_notifier_head reboot_notifier_list;
247#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */ 247#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */
248#define VT_WRITE 0x0003 /* A char got output */ 248#define VT_WRITE 0x0003 /* A char got output */
249#define VT_UPDATE 0x0004 /* A bigger update occurred */ 249#define VT_UPDATE 0x0004 /* A bigger update occurred */
250#define VT_PREWRITE 0x0005 /* A char is about to be written to the console */
250 251
251#endif /* __KERNEL__ */ 252#endif /* __KERNEL__ */
252#endif /* _LINUX_NOTIFIER_H */ 253#endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 3852436b652a..a7979baf1e39 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -23,8 +23,8 @@ enum oom_constraint {
23 CONSTRAINT_MEMORY_POLICY, 23 CONSTRAINT_MEMORY_POLICY,
24}; 24};
25 25
26extern int try_set_zone_oom(struct zonelist *zonelist); 26extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags);
27extern void clear_zonelist_oom(struct zonelist *zonelist); 27extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
28 28
29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); 29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb); 30extern int register_oom_notifier(struct notifier_block *nb);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5b30f1c1e59..590cff32415d 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -6,7 +6,10 @@
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#ifndef __GENERATING_BOUNDS_H
9#include <linux/mm_types.h> 10#include <linux/mm_types.h>
11#include <linux/bounds.h>
12#endif /* !__GENERATING_BOUNDS_H */
10 13
11/* 14/*
12 * Various page->flags bits: 15 * Various page->flags bits:
@@ -59,77 +62,138 @@
59 * extends from the high bits downwards. 62 * extends from the high bits downwards.
60 * 63 *
61 * | FIELD | ... | FLAGS | 64 * | FIELD | ... | FLAGS |
62 * N-1 ^ 0 65 * N-1 ^ 0
63 * (N-FLAGS_RESERVED) 66 * (NR_PAGEFLAGS)
64 * 67 *
65 * The fields area is reserved for fields mapping zone, node and SPARSEMEM 68 * The fields area is reserved for fields mapping zone, node (for NUMA) and
66 * section. The boundry between these two areas is defined by 69 * SPARSEMEM section (for variants of SPARSEMEM that require section ids like
67 * FLAGS_RESERVED which defines the width of the fields section 70 * SPARSEMEM_EXTREME with !SPARSEMEM_VMEMMAP).
68 * (see linux/mmzone.h). New flags must _not_ overlap with this area.
69 */ 71 */
70#define PG_locked 0 /* Page is locked. Don't touch. */ 72enum pageflags {
71#define PG_error 1 73 PG_locked, /* Page is locked. Don't touch. */
72#define PG_referenced 2 74 PG_error,
73#define PG_uptodate 3 75 PG_referenced,
76 PG_uptodate,
77 PG_dirty,
78 PG_lru,
79 PG_active,
80 PG_slab,
81 PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/
82 PG_arch_1,
83 PG_reserved,
84 PG_private, /* If pagecache, has fs-private data */
85 PG_writeback, /* Page is under writeback */
86#ifdef CONFIG_PAGEFLAGS_EXTENDED
87 PG_head, /* A head page */
88 PG_tail, /* A tail page */
89#else
90 PG_compound, /* A compound page */
91#endif
92 PG_swapcache, /* Swap page: swp_entry_t in private */
93 PG_mappedtodisk, /* Has blocks allocated on-disk */
94 PG_reclaim, /* To be reclaimed asap */
95 PG_buddy, /* Page is free, on buddy lists */
96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
97 PG_uncached, /* Page has been mapped as uncached */
98#endif
99 __NR_PAGEFLAGS
100};
101
102#ifndef __GENERATING_BOUNDS_H
103
104/*
105 * Macros to create function definitions for page flags
106 */
107#define TESTPAGEFLAG(uname, lname) \
108static inline int Page##uname(struct page *page) \
109 { return test_bit(PG_##lname, &page->flags); }
74 110
75#define PG_dirty 4 111#define SETPAGEFLAG(uname, lname) \
76#define PG_lru 5 112static inline void SetPage##uname(struct page *page) \
77#define PG_active 6 113 { set_bit(PG_##lname, &page->flags); }
78#define PG_slab 7 /* slab debug (Suparna wants this) */
79 114
80#define PG_owner_priv_1 8 /* Owner use. If pagecache, fs may use*/ 115#define CLEARPAGEFLAG(uname, lname) \
81#define PG_arch_1 9 116static inline void ClearPage##uname(struct page *page) \
82#define PG_reserved 10 117 { clear_bit(PG_##lname, &page->flags); }
83#define PG_private 11 /* If pagecache, has fs-private data */
84 118
85#define PG_writeback 12 /* Page is under writeback */ 119#define __SETPAGEFLAG(uname, lname) \
86#define PG_compound 14 /* Part of a compound page */ 120static inline void __SetPage##uname(struct page *page) \
87#define PG_swapcache 15 /* Swap page: swp_entry_t in private */ 121 { __set_bit(PG_##lname, &page->flags); }
88 122
89#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ 123#define __CLEARPAGEFLAG(uname, lname) \
90#define PG_reclaim 17 /* To be reclaimed asap */ 124static inline void __ClearPage##uname(struct page *page) \
91#define PG_buddy 19 /* Page is free, on buddy lists */ 125 { __clear_bit(PG_##lname, &page->flags); }
126
127#define TESTSETFLAG(uname, lname) \
128static inline int TestSetPage##uname(struct page *page) \
129 { return test_and_set_bit(PG_##lname, &page->flags); }
130
131#define TESTCLEARFLAG(uname, lname) \
132static inline int TestClearPage##uname(struct page *page) \
133 { return test_and_clear_bit(PG_##lname, &page->flags); }
92 134
93/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
94#define PG_readahead PG_reclaim /* Reminder to do async read-ahead */
95 135
96/* PG_owner_priv_1 users should have descriptive aliases */ 136#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
97#define PG_checked PG_owner_priv_1 /* Used by some filesystems */ 137 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
98#define PG_pinned PG_owner_priv_1 /* Xen pinned pagetable */ 138
139#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
140 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
141
142#define PAGEFLAG_FALSE(uname) \
143static inline int Page##uname(struct page *page) \
144 { return 0; }
145
146#define TESTSCFLAG(uname, lname) \
147 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
148
149struct page; /* forward declaration */
150
151PAGEFLAG(Locked, locked) TESTSCFLAG(Locked, locked)
152PAGEFLAG(Error, error)
153PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
154PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
155PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
156PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
157__PAGEFLAG(Slab, slab)
158PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */
159PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */
160PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
161PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
162 __SETPAGEFLAG(Private, private)
99 163
100#if (BITS_PER_LONG > 32)
101/* 164/*
102 * 64-bit-only flags build down from bit 31 165 * Only test-and-set exist for PG_writeback. The unconditional operators are
103 * 166 * risky: they bypass page accounting.
104 * 32 bit -------------------------------| FIELDS | FLAGS |
105 * 64 bit | FIELDS | ?????? FLAGS |
106 * 63 32 0
107 */ 167 */
108#define PG_uncached 31 /* Page has been mapped as uncached */ 168TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback)
109#endif 169__PAGEFLAG(Buddy, buddy)
170PAGEFLAG(MappedToDisk, mappedtodisk)
110 171
172/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
173PAGEFLAG(Reclaim, reclaim) TESTCLEARFLAG(Reclaim, reclaim)
174PAGEFLAG(Readahead, reclaim) /* Reminder to do async read-ahead */
175
176#ifdef CONFIG_HIGHMEM
111/* 177/*
112 * Manipulation of page state flags 178 * Must use a macro here due to header dependency issues. page_zone() is not
179 * available at this point.
113 */ 180 */
114#define PageLocked(page) \ 181#define PageHighMem(__p) is_highmem(page_zone(__p))
115 test_bit(PG_locked, &(page)->flags) 182#else
116#define SetPageLocked(page) \ 183PAGEFLAG_FALSE(HighMem)
117 set_bit(PG_locked, &(page)->flags) 184#endif
118#define TestSetPageLocked(page) \ 185
119 test_and_set_bit(PG_locked, &(page)->flags) 186#ifdef CONFIG_SWAP
120#define ClearPageLocked(page) \ 187PAGEFLAG(SwapCache, swapcache)
121 clear_bit(PG_locked, &(page)->flags) 188#else
122#define TestClearPageLocked(page) \ 189PAGEFLAG_FALSE(SwapCache)
123 test_and_clear_bit(PG_locked, &(page)->flags) 190#endif
124 191
125#define PageError(page) test_bit(PG_error, &(page)->flags) 192#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
126#define SetPageError(page) set_bit(PG_error, &(page)->flags) 193PAGEFLAG(Uncached, uncached)
127#define ClearPageError(page) clear_bit(PG_error, &(page)->flags) 194#else
128 195PAGEFLAG_FALSE(Uncached)
129#define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) 196#endif
130#define SetPageReferenced(page) set_bit(PG_referenced, &(page)->flags)
131#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags)
132#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags)
133 197
134static inline int PageUptodate(struct page *page) 198static inline int PageUptodate(struct page *page)
135{ 199{
@@ -177,97 +241,59 @@ static inline void SetPageUptodate(struct page *page)
177#endif 241#endif
178} 242}
179 243
180#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) 244CLEARPAGEFLAG(Uptodate, uptodate)
181
182#define PageDirty(page) test_bit(PG_dirty, &(page)->flags)
183#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags)
184#define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags)
185#define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags)
186#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags)
187#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)
188
189#define PageLRU(page) test_bit(PG_lru, &(page)->flags)
190#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
191#define ClearPageLRU(page) clear_bit(PG_lru, &(page)->flags)
192#define __ClearPageLRU(page) __clear_bit(PG_lru, &(page)->flags)
193
194#define PageActive(page) test_bit(PG_active, &(page)->flags)
195#define SetPageActive(page) set_bit(PG_active, &(page)->flags)
196#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags)
197#define __ClearPageActive(page) __clear_bit(PG_active, &(page)->flags)
198
199#define PageSlab(page) test_bit(PG_slab, &(page)->flags)
200#define __SetPageSlab(page) __set_bit(PG_slab, &(page)->flags)
201#define __ClearPageSlab(page) __clear_bit(PG_slab, &(page)->flags)
202
203#ifdef CONFIG_HIGHMEM
204#define PageHighMem(page) is_highmem(page_zone(page))
205#else
206#define PageHighMem(page) 0 /* needed to optimize away at compile time */
207#endif
208 245
209#define PageChecked(page) test_bit(PG_checked, &(page)->flags) 246extern void cancel_dirty_page(struct page *page, unsigned int account_size);
210#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags)
211#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags)
212
213#define PagePinned(page) test_bit(PG_pinned, &(page)->flags)
214#define SetPagePinned(page) set_bit(PG_pinned, &(page)->flags)
215#define ClearPagePinned(page) clear_bit(PG_pinned, &(page)->flags)
216 247
217#define PageReserved(page) test_bit(PG_reserved, &(page)->flags) 248int test_clear_page_writeback(struct page *page);
218#define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags) 249int test_set_page_writeback(struct page *page);
219#define ClearPageReserved(page) clear_bit(PG_reserved, &(page)->flags)
220#define __ClearPageReserved(page) __clear_bit(PG_reserved, &(page)->flags)
221 250
222#define SetPagePrivate(page) set_bit(PG_private, &(page)->flags) 251static inline void set_page_writeback(struct page *page)
223#define ClearPagePrivate(page) clear_bit(PG_private, &(page)->flags) 252{
224#define PagePrivate(page) test_bit(PG_private, &(page)->flags) 253 test_set_page_writeback(page);
225#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags) 254}
226#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags)
227 255
256#ifdef CONFIG_PAGEFLAGS_EXTENDED
228/* 257/*
229 * Only test-and-set exist for PG_writeback. The unconditional operators are 258 * System with lots of page flags available. This allows separate
230 * risky: they bypass page accounting. 259 * flags for PageHead() and PageTail() checks of compound pages so that bit
260 * tests can be used in performance sensitive paths. PageCompound is
261 * generally not used in hot code paths.
231 */ 262 */
232#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags) 263__PAGEFLAG(Head, head)
233#define TestSetPageWriteback(page) test_and_set_bit(PG_writeback, \ 264__PAGEFLAG(Tail, tail)
234 &(page)->flags)
235#define TestClearPageWriteback(page) test_and_clear_bit(PG_writeback, \
236 &(page)->flags)
237 265
238#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags) 266static inline int PageCompound(struct page *page)
239#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags) 267{
240#define __ClearPageBuddy(page) __clear_bit(PG_buddy, &(page)->flags) 268 return page->flags & ((1L << PG_head) | (1L << PG_tail));
241
242#define PageMappedToDisk(page) test_bit(PG_mappedtodisk, &(page)->flags)
243#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
244#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
245
246#define PageReadahead(page) test_bit(PG_readahead, &(page)->flags)
247#define SetPageReadahead(page) set_bit(PG_readahead, &(page)->flags)
248#define ClearPageReadahead(page) clear_bit(PG_readahead, &(page)->flags)
249
250#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags)
251#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags)
252#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
253#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
254 269
255#define PageCompound(page) test_bit(PG_compound, &(page)->flags) 270}
256#define __SetPageCompound(page) __set_bit(PG_compound, &(page)->flags) 271#else
257#define __ClearPageCompound(page) __clear_bit(PG_compound, &(page)->flags) 272/*
273 * Reduce page flag use as much as possible by overlapping
274 * compound page flags with the flags used for page cache pages. Possible
275 * because PageCompound is always set for compound pages and not for
276 * pages on the LRU and/or pagecache.
277 */
278TESTPAGEFLAG(Compound, compound)
279__PAGEFLAG(Head, compound)
258 280
259/* 281/*
260 * PG_reclaim is used in combination with PG_compound to mark the 282 * PG_reclaim is used in combination with PG_compound to mark the
261 * head and tail of a compound page 283 * head and tail of a compound page. This saves one page flag
284 * but makes it impossible to use compound pages for the page cache.
285 * The PG_reclaim bit would have to be used for reclaim or readahead
286 * if compound pages enter the page cache.
262 * 287 *
263 * PG_compound & PG_reclaim => Tail page 288 * PG_compound & PG_reclaim => Tail page
264 * PG_compound & ~PG_reclaim => Head page 289 * PG_compound & ~PG_reclaim => Head page
265 */ 290 */
266
267#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) 291#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
268 292
269#define PageTail(page) (((page)->flags & PG_head_tail_mask) \ 293static inline int PageTail(struct page *page)
270 == PG_head_tail_mask) 294{
295 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask);
296}
271 297
272static inline void __SetPageTail(struct page *page) 298static inline void __SetPageTail(struct page *page)
273{ 299{
@@ -279,33 +305,6 @@ static inline void __ClearPageTail(struct page *page)
279 page->flags &= ~PG_head_tail_mask; 305 page->flags &= ~PG_head_tail_mask;
280} 306}
281 307
282#define PageHead(page) (((page)->flags & PG_head_tail_mask) \ 308#endif /* !PAGEFLAGS_EXTENDED */
283 == (1L << PG_compound)) 309#endif /* !__GENERATING_BOUNDS_H */
284#define __SetPageHead(page) __SetPageCompound(page)
285#define __ClearPageHead(page) __ClearPageCompound(page)
286
287#ifdef CONFIG_SWAP
288#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags)
289#define SetPageSwapCache(page) set_bit(PG_swapcache, &(page)->flags)
290#define ClearPageSwapCache(page) clear_bit(PG_swapcache, &(page)->flags)
291#else
292#define PageSwapCache(page) 0
293#endif
294
295#define PageUncached(page) test_bit(PG_uncached, &(page)->flags)
296#define SetPageUncached(page) set_bit(PG_uncached, &(page)->flags)
297#define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags)
298
299struct page; /* forward declaration */
300
301extern void cancel_dirty_page(struct page *page, unsigned int account_size);
302
303int test_clear_page_writeback(struct page *page);
304int test_set_page_writeback(struct page *page);
305
306static inline void set_page_writeback(struct page *page)
307{
308 test_set_page_writeback(page);
309}
310
311#endif /* PAGE_FLAGS_H */ 310#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 5c80b1939636..5ad79198d6f9 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -16,7 +16,8 @@
16# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ 16# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
17# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ 17# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
18 18
19/* Get/set whether or not to drop capabilities on setuid() away from uid 0 */ 19/* Get/set whether or not to drop capabilities on setuid() away from
20 * uid 0 (as per security/commoncap.c) */
20#define PR_GET_KEEPCAPS 7 21#define PR_GET_KEEPCAPS 7
21#define PR_SET_KEEPCAPS 8 22#define PR_SET_KEEPCAPS 8
22 23
@@ -63,7 +64,7 @@
63#define PR_GET_SECCOMP 21 64#define PR_GET_SECCOMP 21
64#define PR_SET_SECCOMP 22 65#define PR_SET_SECCOMP 22
65 66
66/* Get/set the capability bounding set */ 67/* Get/set the capability bounding set (as per security/commoncap.c) */
67#define PR_CAPBSET_READ 23 68#define PR_CAPBSET_READ 23
68#define PR_CAPBSET_DROP 24 69#define PR_CAPBSET_DROP 24
69 70
@@ -73,4 +74,8 @@
73# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ 74# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */
74# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ 75# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
75 76
77/* Get/set securebits (as per security/commoncap.c) */
78#define PR_GET_SECUREBITS 27
79#define PR_SET_SECUREBITS 28
80
76#endif /* _LINUX_PRCTL_H */ 81#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index eb560d031acd..52e49dce6584 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -202,10 +202,14 @@ struct quota_format_type;
202 202
203struct mem_dqinfo { 203struct mem_dqinfo {
204 struct quota_format_type *dqi_format; 204 struct quota_format_type *dqi_format;
205 int dqi_fmt_id; /* Id of the dqi_format - used when turning
206 * quotas on after remount RW */
205 struct list_head dqi_dirty_list; /* List of dirty dquots */ 207 struct list_head dqi_dirty_list; /* List of dirty dquots */
206 unsigned long dqi_flags; 208 unsigned long dqi_flags;
207 unsigned int dqi_bgrace; 209 unsigned int dqi_bgrace;
208 unsigned int dqi_igrace; 210 unsigned int dqi_igrace;
211 qsize_t dqi_maxblimit;
212 qsize_t dqi_maxilimit;
209 union { 213 union {
210 struct v1_mem_dqinfo v1_i; 214 struct v1_mem_dqinfo v1_i;
211 struct v2_mem_dqinfo v2_i; 215 struct v2_mem_dqinfo v2_i;
@@ -296,8 +300,8 @@ struct dquot_operations {
296 300
297/* Operations handling requests from userspace */ 301/* Operations handling requests from userspace */
298struct quotactl_ops { 302struct quotactl_ops {
299 int (*quota_on)(struct super_block *, int, int, char *); 303 int (*quota_on)(struct super_block *, int, int, char *, int);
300 int (*quota_off)(struct super_block *, int); 304 int (*quota_off)(struct super_block *, int, int);
301 int (*quota_sync)(struct super_block *, int); 305 int (*quota_sync)(struct super_block *, int);
302 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 306 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
303 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 307 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
@@ -318,6 +322,10 @@ struct quota_format_type {
318 322
319#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ 323#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
320#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ 324#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */
325#define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but
326 * we have necessary info in
327 * memory to turn them on */
328#define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */
321 329
322struct quota_info { 330struct quota_info {
323 unsigned int flags; /* Flags for diskquotas on this device */ 331 unsigned int flags; /* Flags for diskquotas on this device */
@@ -329,17 +337,16 @@ struct quota_info {
329 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 337 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
330}; 338};
331 339
332/* Inline would be better but we need to dereference super_block which is not defined yet */
333int mark_dquot_dirty(struct dquot *dquot);
334
335#define dquot_dirty(dquot) test_bit(DQ_MOD_B, &(dquot)->dq_flags)
336
337#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ 340#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
338 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) 341 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
339 342
340#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \ 343#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
341 sb_has_quota_enabled(sb, GRPQUOTA)) 344 sb_has_quota_enabled(sb, GRPQUOTA))
342 345
346#define sb_has_quota_suspended(sb, type) \
347 ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
348 (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
349
343int register_quota_format(struct quota_format_type *fmt); 350int register_quota_format(struct quota_format_type *fmt);
344void unregister_quota_format(struct quota_format_type *fmt); 351void unregister_quota_format(struct quota_format_type *fmt);
345 352
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 5110201a4159..f86702053853 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -37,11 +37,11 @@ extern int dquot_release(struct dquot *dquot);
37extern int dquot_commit_info(struct super_block *sb, int type); 37extern int dquot_commit_info(struct super_block *sb, int type);
38extern int dquot_mark_dquot_dirty(struct dquot *dquot); 38extern int dquot_mark_dquot_dirty(struct dquot *dquot);
39 39
40extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); 40extern int vfs_quota_on(struct super_block *sb, int type, int format_id,
41 char *path, int remount);
41extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 42extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
42 int format_id, int type); 43 int format_id, int type);
43extern int vfs_quota_off(struct super_block *sb, int type); 44extern int vfs_quota_off(struct super_block *sb, int type, int remount);
44#define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type)
45extern int vfs_quota_sync(struct super_block *sb, int type); 45extern int vfs_quota_sync(struct super_block *sb, int type);
46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -59,7 +59,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
59 59
60/* It is better to call this function outside of any transaction as it might 60/* It is better to call this function outside of any transaction as it might
61 * need a lot of space in journal for dquot structure allocation. */ 61 * need a lot of space in journal for dquot structure allocation. */
62static __inline__ void DQUOT_INIT(struct inode *inode) 62static inline void DQUOT_INIT(struct inode *inode)
63{ 63{
64 BUG_ON(!inode->i_sb); 64 BUG_ON(!inode->i_sb);
65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
@@ -67,7 +67,7 @@ static __inline__ void DQUOT_INIT(struct inode *inode)
67} 67}
68 68
69/* The same as with DQUOT_INIT */ 69/* The same as with DQUOT_INIT */
70static __inline__ void DQUOT_DROP(struct inode *inode) 70static inline void DQUOT_DROP(struct inode *inode)
71{ 71{
72 /* Here we can get arbitrary inode from clear_inode() so we have 72 /* Here we can get arbitrary inode from clear_inode() so we have
73 * to be careful. OTOH we don't need locking as quota operations 73 * to be careful. OTOH we don't need locking as quota operations
@@ -90,7 +90,7 @@ static __inline__ void DQUOT_DROP(struct inode *inode)
90 90
91/* The following allocation/freeing/transfer functions *must* be called inside 91/* The following allocation/freeing/transfer functions *must* be called inside
92 * a transaction (deadlocks possible otherwise) */ 92 * a transaction (deadlocks possible otherwise) */
93static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 93static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
94{ 94{
95 if (sb_any_quota_enabled(inode->i_sb)) { 95 if (sb_any_quota_enabled(inode->i_sb)) {
96 /* Used space is updated in alloc_space() */ 96 /* Used space is updated in alloc_space() */
@@ -102,7 +102,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t
102 return 0; 102 return 0;
103} 103}
104 104
105static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 105static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
106{ 106{
107 int ret; 107 int ret;
108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) 108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr)))
@@ -110,7 +110,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
110 return ret; 110 return ret;
111} 111}
112 112
113static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 113static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
114{ 114{
115 if (sb_any_quota_enabled(inode->i_sb)) { 115 if (sb_any_quota_enabled(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 116 /* Used space is updated in alloc_space() */
@@ -122,7 +122,7 @@ static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
122 return 0; 122 return 0;
123} 123}
124 124
125static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 125static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
126{ 126{
127 int ret; 127 int ret;
128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) 128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr)))
@@ -130,7 +130,7 @@ static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
130 return ret; 130 return ret;
131} 131}
132 132
133static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode) 133static inline int DQUOT_ALLOC_INODE(struct inode *inode)
134{ 134{
135 if (sb_any_quota_enabled(inode->i_sb)) { 135 if (sb_any_quota_enabled(inode->i_sb)) {
136 DQUOT_INIT(inode); 136 DQUOT_INIT(inode);
@@ -140,7 +140,7 @@ static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode)
140 return 0; 140 return 0;
141} 141}
142 142
143static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 143static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
144{ 144{
145 if (sb_any_quota_enabled(inode->i_sb)) 145 if (sb_any_quota_enabled(inode->i_sb))
146 inode->i_sb->dq_op->free_space(inode, nr); 146 inode->i_sb->dq_op->free_space(inode, nr);
@@ -148,19 +148,19 @@ static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
148 inode_sub_bytes(inode, nr); 148 inode_sub_bytes(inode, nr);
149} 149}
150 150
151static __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 151static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
152{ 152{
153 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 153 DQUOT_FREE_SPACE_NODIRTY(inode, nr);
154 mark_inode_dirty(inode); 154 mark_inode_dirty(inode);
155} 155}
156 156
157static __inline__ void DQUOT_FREE_INODE(struct inode *inode) 157static inline void DQUOT_FREE_INODE(struct inode *inode)
158{ 158{
159 if (sb_any_quota_enabled(inode->i_sb)) 159 if (sb_any_quota_enabled(inode->i_sb))
160 inode->i_sb->dq_op->free_inode(inode, 1); 160 inode->i_sb->dq_op->free_inode(inode, 1);
161} 161}
162 162
163static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) 163static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
164{ 164{
165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { 165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
166 DQUOT_INIT(inode); 166 DQUOT_INIT(inode);
@@ -171,14 +171,32 @@ static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
171} 171}
172 172
173/* The following two functions cannot be called inside a transaction */ 173/* The following two functions cannot be called inside a transaction */
174#define DQUOT_SYNC(sb) sync_dquots(sb, -1) 174static inline void DQUOT_SYNC(struct super_block *sb)
175{
176 sync_dquots(sb, -1);
177}
175 178
176static __inline__ int DQUOT_OFF(struct super_block *sb) 179static inline int DQUOT_OFF(struct super_block *sb, int remount)
177{ 180{
178 int ret = -ENOSYS; 181 int ret = -ENOSYS;
179 182
180 if (sb_any_quota_enabled(sb) && sb->s_qcop && sb->s_qcop->quota_off) 183 if (sb->s_qcop && sb->s_qcop->quota_off)
181 ret = sb->s_qcop->quota_off(sb, -1); 184 ret = sb->s_qcop->quota_off(sb, -1, remount);
185 return ret;
186}
187
188static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
189{
190 int cnt;
191 int ret = 0, err;
192
193 if (!sb->s_qcop || !sb->s_qcop->quota_on)
194 return -ENOSYS;
195 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
196 err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
197 if (err < 0 && !ret)
198 ret = err;
199 }
182 return ret; 200 return ret;
183} 201}
184 202
@@ -189,13 +207,43 @@ static __inline__ int DQUOT_OFF(struct super_block *sb)
189 */ 207 */
190#define sb_dquot_ops (NULL) 208#define sb_dquot_ops (NULL)
191#define sb_quotactl_ops (NULL) 209#define sb_quotactl_ops (NULL)
192#define DQUOT_INIT(inode) do { } while(0) 210
193#define DQUOT_DROP(inode) do { } while(0) 211static inline void DQUOT_INIT(struct inode *inode)
194#define DQUOT_ALLOC_INODE(inode) (0) 212{
195#define DQUOT_FREE_INODE(inode) do { } while(0) 213}
196#define DQUOT_SYNC(sb) do { } while(0) 214
197#define DQUOT_OFF(sb) do { } while(0) 215static inline void DQUOT_DROP(struct inode *inode)
198#define DQUOT_TRANSFER(inode, iattr) (0) 216{
217}
218
219static inline int DQUOT_ALLOC_INODE(struct inode *inode)
220{
221 return 0;
222}
223
224static inline void DQUOT_FREE_INODE(struct inode *inode)
225{
226}
227
228static inline void DQUOT_SYNC(struct super_block *sb)
229{
230}
231
232static inline int DQUOT_OFF(struct super_block *sb, int remount)
233{
234 return 0;
235}
236
237static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
238{
239 return 0;
240}
241
242static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
243{
244 return 0;
245}
246
199static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 247static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
200{ 248{
201 inode_add_bytes(inode, nr); 249 inode_add_bytes(inode, nr);
@@ -235,11 +283,38 @@ static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
235 283
236#endif /* CONFIG_QUOTA */ 284#endif /* CONFIG_QUOTA */
237 285
238#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_PREALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 286static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
239#define DQUOT_PREALLOC_BLOCK(inode, nr) DQUOT_PREALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 287{
240#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_ALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 288 return DQUOT_PREALLOC_SPACE_NODIRTY(inode,
241#define DQUOT_ALLOC_BLOCK(inode, nr) DQUOT_ALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 289 nr << inode->i_sb->s_blocksize_bits);
242#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) DQUOT_FREE_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 290}
243#define DQUOT_FREE_BLOCK(inode, nr) DQUOT_FREE_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 291
292static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr)
293{
294 return DQUOT_PREALLOC_SPACE(inode,
295 nr << inode->i_sb->s_blocksize_bits);
296}
297
298static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
299{
300 return DQUOT_ALLOC_SPACE_NODIRTY(inode,
301 nr << inode->i_sb->s_blocksize_bits);
302}
303
304static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr)
305{
306 return DQUOT_ALLOC_SPACE(inode,
307 nr << inode->i_sb->s_blocksize_bits);
308}
309
310static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
311{
312 DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits);
313}
314
315static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr)
316{
317 DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits);
318}
244 319
245#endif /* _LINUX_QUOTAOPS_ */ 320#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 93678f57ccbe..f0827d31ae6f 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -252,6 +252,8 @@ struct r6_state {
252#define STRIPE_EXPANDING 9 252#define STRIPE_EXPANDING 9
253#define STRIPE_EXPAND_SOURCE 10 253#define STRIPE_EXPAND_SOURCE 10
254#define STRIPE_EXPAND_READY 11 254#define STRIPE_EXPAND_READY 11
255#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */
256#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
255/* 257/*
256 * Operations flags (in issue order) 258 * Operations flags (in issue order)
257 */ 259 */
@@ -316,12 +318,17 @@ struct raid5_private_data {
316 int previous_raid_disks; 318 int previous_raid_disks;
317 319
318 struct list_head handle_list; /* stripes needing handling */ 320 struct list_head handle_list; /* stripes needing handling */
321 struct list_head hold_list; /* preread ready stripes */
319 struct list_head delayed_list; /* stripes that have plugged requests */ 322 struct list_head delayed_list; /* stripes that have plugged requests */
320 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ 323 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
321 struct bio *retry_read_aligned; /* currently retrying aligned bios */ 324 struct bio *retry_read_aligned; /* currently retrying aligned bios */
322 struct bio *retry_read_aligned_list; /* aligned bios retry list */ 325 struct bio *retry_read_aligned_list; /* aligned bios retry list */
323 atomic_t preread_active_stripes; /* stripes with scheduled io */ 326 atomic_t preread_active_stripes; /* stripes with scheduled io */
324 atomic_t active_aligned_reads; 327 atomic_t active_aligned_reads;
328 atomic_t pending_full_writes; /* full write backlog */
329 int bypass_count; /* bypassed prereads */
330 int bypass_threshold; /* preread nice */
331 struct list_head *last_hold; /* detect hold_list promotions */
325 332
326 atomic_t reshape_stripes; /* stripes with pending writes for reshape */ 333 atomic_t reshape_stripes; /* stripes with pending writes for reshape */
327 /* unfortunately we need two cache names as we temporarily have 334 /* unfortunately we need two cache names as we temporarily have
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 8e7eff2cd0ab..4aacaeecb56f 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2176,6 +2176,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp,
2176 unsigned int cmd, unsigned long arg); 2176 unsigned int cmd, unsigned long arg);
2177long reiserfs_compat_ioctl(struct file *filp, 2177long reiserfs_compat_ioctl(struct file *filp,
2178 unsigned int cmd, unsigned long arg); 2178 unsigned int cmd, unsigned long arg);
2179int reiserfs_unpack(struct inode *inode, struct file *filp);
2179 2180
2180/* ioctl's command */ 2181/* ioctl's command */
2181#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) 2182#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9a4f3e63e3bf..024d72b47a0c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -68,7 +68,6 @@ struct sched_param {
68#include <linux/smp.h> 68#include <linux/smp.h>
69#include <linux/sem.h> 69#include <linux/sem.h>
70#include <linux/signal.h> 70#include <linux/signal.h>
71#include <linux/securebits.h>
72#include <linux/fs_struct.h> 71#include <linux/fs_struct.h>
73#include <linux/compiler.h> 72#include <linux/compiler.h>
74#include <linux/completion.h> 73#include <linux/completion.h>
@@ -1133,7 +1132,7 @@ struct task_struct {
1133 gid_t gid,egid,sgid,fsgid; 1132 gid_t gid,egid,sgid,fsgid;
1134 struct group_info *group_info; 1133 struct group_info *group_info;
1135 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1134 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1136 unsigned keep_capabilities:1; 1135 unsigned securebits;
1137 struct user_struct *user; 1136 struct user_struct *user;
1138#ifdef CONFIG_KEYS 1137#ifdef CONFIG_KEYS
1139 struct key *request_key_auth; /* assumed request_key authority */ 1138 struct key *request_key_auth; /* assumed request_key authority */
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index 5b0617840fa4..c1f19dbceb05 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -3,28 +3,39 @@
3 3
4#define SECUREBITS_DEFAULT 0x00000000 4#define SECUREBITS_DEFAULT 0x00000000
5 5
6extern unsigned securebits;
7
8/* When set UID 0 has no special privileges. When unset, we support 6/* When set UID 0 has no special privileges. When unset, we support
9 inheritance of root-permissions and suid-root executable under 7 inheritance of root-permissions and suid-root executable under
10 compatibility mode. We raise the effective and inheritable bitmasks 8 compatibility mode. We raise the effective and inheritable bitmasks
11 *of the executable file* if the effective uid of the new process is 9 *of the executable file* if the effective uid of the new process is
12 0. If the real uid is 0, we raise the inheritable bitmask of the 10 0. If the real uid is 0, we raise the inheritable bitmask of the
13 executable file. */ 11 executable file. */
14#define SECURE_NOROOT 0 12#define SECURE_NOROOT 0
13#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */
15 14
16/* When set, setuid to/from uid 0 does not trigger capability-"fixes" 15/* When set, setuid to/from uid 0 does not trigger capability-"fixes"
17 to be compatible with old programs relying on set*uid to loose 16 to be compatible with old programs relying on set*uid to loose
18 privileges. When unset, setuid doesn't change privileges. */ 17 privileges. When unset, setuid doesn't change privileges. */
19#define SECURE_NO_SETUID_FIXUP 2 18#define SECURE_NO_SETUID_FIXUP 2
19#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */
20
21/* When set, a process can retain its capabilities even after
22 transitioning to a non-root user (the set-uid fixup suppressed by
23 bit 2). Bit-4 is cleared when a process calls exec(); setting both
24 bit 4 and 5 will create a barrier through exec that no exec()'d
25 child can use this feature again. */
26#define SECURE_KEEP_CAPS 4
27#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */
20 28
21/* Each securesetting is implemented using two bits. One bit specify 29/* Each securesetting is implemented using two bits. One bit specify
22 whether the setting is on or off. The other bit specify whether the 30 whether the setting is on or off. The other bit specify whether the
23 setting is fixed or not. A setting which is fixed cannot be changed 31 setting is fixed or not. A setting which is fixed cannot be changed
24 from user-level. */ 32 from user-level. */
33#define issecure_mask(X) (1 << (X))
34#define issecure(X) (issecure_mask(X) & current->securebits)
25 35
26#define issecure(X) ( (1 << (X+1)) & SECUREBITS_DEFAULT ? \ 36#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
27 (1 << (X)) & SECUREBITS_DEFAULT : \ 37 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
28 (1 << (X)) & securebits ) 38 issecure_mask(SECURE_KEEP_CAPS))
39#define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1)
29 40
30#endif /* !_LINUX_SECUREBITS_H */ 41#endif /* !_LINUX_SECUREBITS_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 53a34539382a..d0a28fd1747a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -34,8 +34,6 @@
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <net/flow.h> 35#include <net/flow.h>
36 36
37extern unsigned securebits;
38
39/* Maximum number of letters for an LSM name string */ 37/* Maximum number of letters for an LSM name string */
40#define SECURITY_NAME_MAX 10 38#define SECURITY_NAME_MAX 10
41 39
@@ -46,25 +44,27 @@ struct audit_krule;
46 * These functions are in security/capability.c and are used 44 * These functions are in security/capability.c and are used
47 * as the default capabilities functions 45 * as the default capabilities functions
48 */ 46 */
49extern int cap_capable (struct task_struct *tsk, int cap); 47extern int cap_capable(struct task_struct *tsk, int cap);
50extern int cap_settime (struct timespec *ts, struct timezone *tz); 48extern int cap_settime(struct timespec *ts, struct timezone *tz);
51extern int cap_ptrace (struct task_struct *parent, struct task_struct *child); 49extern int cap_ptrace(struct task_struct *parent, struct task_struct *child);
52extern int cap_capget (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 50extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
53extern int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 51extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
54extern void cap_capset_set (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 52extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
55extern int cap_bprm_set_security (struct linux_binprm *bprm); 53extern int cap_bprm_set_security(struct linux_binprm *bprm);
56extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe); 54extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
57extern int cap_bprm_secureexec(struct linux_binprm *bprm); 55extern int cap_bprm_secureexec(struct linux_binprm *bprm);
58extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags); 56extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags);
59extern int cap_inode_removexattr(struct dentry *dentry, char *name); 57extern int cap_inode_removexattr(struct dentry *dentry, char *name);
60extern int cap_inode_need_killpriv(struct dentry *dentry); 58extern int cap_inode_need_killpriv(struct dentry *dentry);
61extern int cap_inode_killpriv(struct dentry *dentry); 59extern int cap_inode_killpriv(struct dentry *dentry);
62extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 60extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
63extern void cap_task_reparent_to_init (struct task_struct *p); 61extern void cap_task_reparent_to_init(struct task_struct *p);
64extern int cap_task_setscheduler (struct task_struct *p, int policy, struct sched_param *lp); 62extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
65extern int cap_task_setioprio (struct task_struct *p, int ioprio); 63 unsigned long arg4, unsigned long arg5, long *rc_p);
66extern int cap_task_setnice (struct task_struct *p, int nice); 64extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp);
67extern int cap_syslog (int type); 65extern int cap_task_setioprio(struct task_struct *p, int ioprio);
66extern int cap_task_setnice(struct task_struct *p, int nice);
67extern int cap_syslog(int type);
68extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); 68extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
69 69
70struct msghdr; 70struct msghdr;
@@ -128,7 +128,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
128{ 128{
129 int i; 129 int i;
130 if (opts->mnt_opts) 130 if (opts->mnt_opts)
131 for(i = 0; i < opts->num_mnt_opts; i++) 131 for (i = 0; i < opts->num_mnt_opts; i++)
132 kfree(opts->mnt_opts[i]); 132 kfree(opts->mnt_opts[i]);
133 kfree(opts->mnt_opts); 133 kfree(opts->mnt_opts);
134 opts->mnt_opts = NULL; 134 opts->mnt_opts = NULL;
@@ -190,21 +190,21 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
190 * @bprm contains the linux_binprm structure. 190 * @bprm contains the linux_binprm structure.
191 * Return 0 if the hook is successful and permission is granted. 191 * Return 0 if the hook is successful and permission is granted.
192 * @bprm_check_security: 192 * @bprm_check_security:
193 * This hook mediates the point when a search for a binary handler will 193 * This hook mediates the point when a search for a binary handler will
194 * begin. It allows a check the @bprm->security value which is set in 194 * begin. It allows a check the @bprm->security value which is set in
195 * the preceding set_security call. The primary difference from 195 * the preceding set_security call. The primary difference from
196 * set_security is that the argv list and envp list are reliably 196 * set_security is that the argv list and envp list are reliably
197 * available in @bprm. This hook may be called multiple times 197 * available in @bprm. This hook may be called multiple times
198 * during a single execve; and in each pass set_security is called 198 * during a single execve; and in each pass set_security is called
199 * first. 199 * first.
200 * @bprm contains the linux_binprm structure. 200 * @bprm contains the linux_binprm structure.
201 * Return 0 if the hook is successful and permission is granted. 201 * Return 0 if the hook is successful and permission is granted.
202 * @bprm_secureexec: 202 * @bprm_secureexec:
203 * Return a boolean value (0 or 1) indicating whether a "secure exec" 203 * Return a boolean value (0 or 1) indicating whether a "secure exec"
204 * is required. The flag is passed in the auxiliary table 204 * is required. The flag is passed in the auxiliary table
205 * on the initial stack to the ELF interpreter to indicate whether libc 205 * on the initial stack to the ELF interpreter to indicate whether libc
206 * should enable secure mode. 206 * should enable secure mode.
207 * @bprm contains the linux_binprm structure. 207 * @bprm contains the linux_binprm structure.
208 * 208 *
209 * Security hooks for filesystem operations. 209 * Security hooks for filesystem operations.
210 * 210 *
@@ -221,7 +221,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
221 * Check permission before obtaining filesystem statistics for the @mnt 221 * Check permission before obtaining filesystem statistics for the @mnt
222 * mountpoint. 222 * mountpoint.
223 * @dentry is a handle on the superblock for the filesystem. 223 * @dentry is a handle on the superblock for the filesystem.
224 * Return 0 if permission is granted. 224 * Return 0 if permission is granted.
225 * @sb_mount: 225 * @sb_mount:
226 * Check permission before an object specified by @dev_name is mounted on 226 * Check permission before an object specified by @dev_name is mounted on
227 * the mount point named by @nd. For an ordinary mount, @dev_name 227 * the mount point named by @nd. For an ordinary mount, @dev_name
@@ -282,12 +282,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
282 * @sb_pivotroot: 282 * @sb_pivotroot:
283 * Check permission before pivoting the root filesystem. 283 * Check permission before pivoting the root filesystem.
284 * @old_path contains the path for the new location of the current root (put_old). 284 * @old_path contains the path for the new location of the current root (put_old).
285 * @new_path contains the path for the new root (new_root). 285 * @new_path contains the path for the new root (new_root).
286 * Return 0 if permission is granted. 286 * Return 0 if permission is granted.
287 * @sb_post_pivotroot: 287 * @sb_post_pivotroot:
288 * Update module state after a successful pivot. 288 * Update module state after a successful pivot.
289 * @old_path contains the path for the old root. 289 * @old_path contains the path for the old root.
290 * @new_path contains the path for the new root. 290 * @new_path contains the path for the new root.
291 * @sb_get_mnt_opts: 291 * @sb_get_mnt_opts:
292 * Get the security relevant mount options used for a superblock 292 * Get the security relevant mount options used for a superblock
293 * @sb the superblock to get security mount options from 293 * @sb the superblock to get security mount options from
@@ -316,9 +316,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
316 * @inode_free_security: 316 * @inode_free_security:
317 * @inode contains the inode structure. 317 * @inode contains the inode structure.
318 * Deallocate the inode security structure and set @inode->i_security to 318 * Deallocate the inode security structure and set @inode->i_security to
319 * NULL. 319 * NULL.
320 * @inode_init_security: 320 * @inode_init_security:
321 * Obtain the security attribute name suffix and value to set on a newly 321 * Obtain the security attribute name suffix and value to set on a newly
322 * created inode and set up the incore security field for the new inode. 322 * created inode and set up the incore security field for the new inode.
323 * This hook is called by the fs code as part of the inode creation 323 * This hook is called by the fs code as part of the inode creation
324 * transaction and provides for atomic labeling of the inode, unlike 324 * transaction and provides for atomic labeling of the inode, unlike
@@ -349,7 +349,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
349 * @new_dentry contains the dentry structure for the new link. 349 * @new_dentry contains the dentry structure for the new link.
350 * Return 0 if permission is granted. 350 * Return 0 if permission is granted.
351 * @inode_unlink: 351 * @inode_unlink:
352 * Check the permission to remove a hard link to a file. 352 * Check the permission to remove a hard link to a file.
353 * @dir contains the inode structure of parent directory of the file. 353 * @dir contains the inode structure of parent directory of the file.
354 * @dentry contains the dentry structure for file to be unlinked. 354 * @dentry contains the dentry structure for file to be unlinked.
355 * Return 0 if permission is granted. 355 * Return 0 if permission is granted.
@@ -361,7 +361,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
361 * Return 0 if permission is granted. 361 * Return 0 if permission is granted.
362 * @inode_mkdir: 362 * @inode_mkdir:
363 * Check permissions to create a new directory in the existing directory 363 * Check permissions to create a new directory in the existing directory
364 * associated with inode strcture @dir. 364 * associated with inode strcture @dir.
365 * @dir containst the inode structure of parent of the directory to be created. 365 * @dir containst the inode structure of parent of the directory to be created.
366 * @dentry contains the dentry structure of new directory. 366 * @dentry contains the dentry structure of new directory.
367 * @mode contains the mode of new directory. 367 * @mode contains the mode of new directory.
@@ -406,7 +406,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
406 * called when the actual read/write operations are performed. 406 * called when the actual read/write operations are performed.
407 * @inode contains the inode structure to check. 407 * @inode contains the inode structure to check.
408 * @mask contains the permission mask. 408 * @mask contains the permission mask.
409 * @nd contains the nameidata (may be NULL). 409 * @nd contains the nameidata (may be NULL).
410 * Return 0 if permission is granted. 410 * Return 0 if permission is granted.
411 * @inode_setattr: 411 * @inode_setattr:
412 * Check permission before setting file attributes. Note that the kernel 412 * Check permission before setting file attributes. Note that the kernel
@@ -428,24 +428,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
428 * can use this hook to release any persistent label associated with the 428 * can use this hook to release any persistent label associated with the
429 * inode. 429 * inode.
430 * @inode_setxattr: 430 * @inode_setxattr:
431 * Check permission before setting the extended attributes 431 * Check permission before setting the extended attributes
432 * @value identified by @name for @dentry. 432 * @value identified by @name for @dentry.
433 * Return 0 if permission is granted. 433 * Return 0 if permission is granted.
434 * @inode_post_setxattr: 434 * @inode_post_setxattr:
435 * Update inode security field after successful setxattr operation. 435 * Update inode security field after successful setxattr operation.
436 * @value identified by @name for @dentry. 436 * @value identified by @name for @dentry.
437 * @inode_getxattr: 437 * @inode_getxattr:
438 * Check permission before obtaining the extended attributes 438 * Check permission before obtaining the extended attributes
439 * identified by @name for @dentry. 439 * identified by @name for @dentry.
440 * Return 0 if permission is granted. 440 * Return 0 if permission is granted.
441 * @inode_listxattr: 441 * @inode_listxattr:
442 * Check permission before obtaining the list of extended attribute 442 * Check permission before obtaining the list of extended attribute
443 * names for @dentry. 443 * names for @dentry.
444 * Return 0 if permission is granted. 444 * Return 0 if permission is granted.
445 * @inode_removexattr: 445 * @inode_removexattr:
446 * Check permission before removing the extended attribute 446 * Check permission before removing the extended attribute
447 * identified by @name for @dentry. 447 * identified by @name for @dentry.
448 * Return 0 if permission is granted. 448 * Return 0 if permission is granted.
449 * @inode_getsecurity: 449 * @inode_getsecurity:
450 * Retrieve a copy of the extended attribute representation of the 450 * Retrieve a copy of the extended attribute representation of the
451 * security label associated with @name for @inode via @buffer. Note that 451 * security label associated with @name for @inode via @buffer. Note that
@@ -457,7 +457,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
457 * Set the security label associated with @name for @inode from the 457 * Set the security label associated with @name for @inode from the
458 * extended attribute value @value. @size indicates the size of the 458 * extended attribute value @value. @size indicates the size of the
459 * @value in bytes. @flags may be XATTR_CREATE, XATTR_REPLACE, or 0. 459 * @value in bytes. @flags may be XATTR_CREATE, XATTR_REPLACE, or 0.
460 * Note that @name is the remainder of the attribute name after the 460 * Note that @name is the remainder of the attribute name after the
461 * security. prefix has been removed. 461 * security. prefix has been removed.
462 * Return 0 on success. 462 * Return 0 on success.
463 * @inode_listsecurity: 463 * @inode_listsecurity:
@@ -564,7 +564,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
564 * struct file, so the file structure (and associated security information) 564 * struct file, so the file structure (and associated security information)
565 * can always be obtained: 565 * can always be obtained:
566 * container_of(fown, struct file, f_owner) 566 * container_of(fown, struct file, f_owner)
567 * @tsk contains the structure of task receiving signal. 567 * @tsk contains the structure of task receiving signal.
568 * @fown contains the file owner information. 568 * @fown contains the file owner information.
569 * @sig is the signal that will be sent. When 0, kernel sends SIGIO. 569 * @sig is the signal that will be sent. When 0, kernel sends SIGIO.
570 * Return 0 if permission is granted. 570 * Return 0 if permission is granted.
@@ -720,14 +720,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
720 * @arg3 contains a argument. 720 * @arg3 contains a argument.
721 * @arg4 contains a argument. 721 * @arg4 contains a argument.
722 * @arg5 contains a argument. 722 * @arg5 contains a argument.
723 * Return 0 if permission is granted. 723 * @rc_p contains a pointer to communicate back the forced return code
724 * Return 0 if permission is granted, and non-zero if the security module
725 * has taken responsibility (setting *rc_p) for the prctl call.
724 * @task_reparent_to_init: 726 * @task_reparent_to_init:
725 * Set the security attributes in @p->security for a kernel thread that 727 * Set the security attributes in @p->security for a kernel thread that
726 * is being reparented to the init task. 728 * is being reparented to the init task.
727 * @p contains the task_struct for the kernel thread. 729 * @p contains the task_struct for the kernel thread.
728 * @task_to_inode: 730 * @task_to_inode:
729 * Set the security attributes for an inode based on an associated task's 731 * Set the security attributes for an inode based on an associated task's
730 * security attributes, e.g. for /proc/pid inodes. 732 * security attributes, e.g. for /proc/pid inodes.
731 * @p contains the task_struct for the task. 733 * @p contains the task_struct for the task.
732 * @inode contains the inode structure for the inode. 734 * @inode contains the inode structure for the inode.
733 * 735 *
@@ -737,7 +739,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
737 * Save security information for a netlink message so that permission 739 * Save security information for a netlink message so that permission
738 * checking can be performed when the message is processed. The security 740 * checking can be performed when the message is processed. The security
739 * information can be saved using the eff_cap field of the 741 * information can be saved using the eff_cap field of the
740 * netlink_skb_parms structure. Also may be used to provide fine 742 * netlink_skb_parms structure. Also may be used to provide fine
741 * grained control over message transmission. 743 * grained control over message transmission.
742 * @sk associated sock of task sending the message., 744 * @sk associated sock of task sending the message.,
743 * @skb contains the sk_buff structure for the netlink message. 745 * @skb contains the sk_buff structure for the netlink message.
@@ -805,14 +807,14 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
805 * @sock contains the socket structure. 807 * @sock contains the socket structure.
806 * @address contains the address to bind to. 808 * @address contains the address to bind to.
807 * @addrlen contains the length of address. 809 * @addrlen contains the length of address.
808 * Return 0 if permission is granted. 810 * Return 0 if permission is granted.
809 * @socket_connect: 811 * @socket_connect:
810 * Check permission before socket protocol layer connect operation 812 * Check permission before socket protocol layer connect operation
811 * attempts to connect socket @sock to a remote address, @address. 813 * attempts to connect socket @sock to a remote address, @address.
812 * @sock contains the socket structure. 814 * @sock contains the socket structure.
813 * @address contains the address of remote endpoint. 815 * @address contains the address of remote endpoint.
814 * @addrlen contains the length of address. 816 * @addrlen contains the length of address.
815 * Return 0 if permission is granted. 817 * Return 0 if permission is granted.
816 * @socket_listen: 818 * @socket_listen:
817 * Check permission before socket protocol layer listen operation. 819 * Check permission before socket protocol layer listen operation.
818 * @sock contains the socket structure. 820 * @sock contains the socket structure.
@@ -842,7 +844,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
842 * @msg contains the message structure. 844 * @msg contains the message structure.
843 * @size contains the size of message structure. 845 * @size contains the size of message structure.
844 * @flags contains the operational flags. 846 * @flags contains the operational flags.
845 * Return 0 if permission is granted. 847 * Return 0 if permission is granted.
846 * @socket_getsockname: 848 * @socket_getsockname:
847 * Check permission before the local address (name) of the socket object 849 * Check permission before the local address (name) of the socket object
848 * @sock is retrieved. 850 * @sock is retrieved.
@@ -866,7 +868,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
866 * @sock contains the socket structure. 868 * @sock contains the socket structure.
867 * @level contains the protocol level to set options for. 869 * @level contains the protocol level to set options for.
868 * @optname contains the name of the option to set. 870 * @optname contains the name of the option to set.
869 * Return 0 if permission is granted. 871 * Return 0 if permission is granted.
870 * @socket_shutdown: 872 * @socket_shutdown:
871 * Checks permission before all or part of a connection on the socket 873 * Checks permission before all or part of a connection on the socket
872 * @sock is shut down. 874 * @sock is shut down.
@@ -893,19 +895,19 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
893 * Return 0 if all is well, otherwise, typical getsockopt return 895 * Return 0 if all is well, otherwise, typical getsockopt return
894 * values. 896 * values.
895 * @socket_getpeersec_dgram: 897 * @socket_getpeersec_dgram:
896 * This hook allows the security module to provide peer socket security 898 * This hook allows the security module to provide peer socket security
897 * state for udp sockets on a per-packet basis to userspace via 899 * state for udp sockets on a per-packet basis to userspace via
898 * getsockopt SO_GETPEERSEC. The application must first have indicated 900 * getsockopt SO_GETPEERSEC. The application must first have indicated
899 * the IP_PASSSEC option via getsockopt. It can then retrieve the 901 * the IP_PASSSEC option via getsockopt. It can then retrieve the
900 * security state returned by this hook for a packet via the SCM_SECURITY 902 * security state returned by this hook for a packet via the SCM_SECURITY
901 * ancillary message type. 903 * ancillary message type.
902 * @skb is the skbuff for the packet being queried 904 * @skb is the skbuff for the packet being queried
903 * @secdata is a pointer to a buffer in which to copy the security data 905 * @secdata is a pointer to a buffer in which to copy the security data
904 * @seclen is the maximum length for @secdata 906 * @seclen is the maximum length for @secdata
905 * Return 0 on success, error on failure. 907 * Return 0 on success, error on failure.
906 * @sk_alloc_security: 908 * @sk_alloc_security:
907 * Allocate and attach a security structure to the sk->sk_security field, 909 * Allocate and attach a security structure to the sk->sk_security field,
908 * which is used to copy security attributes between local stream sockets. 910 * which is used to copy security attributes between local stream sockets.
909 * @sk_free_security: 911 * @sk_free_security:
910 * Deallocate security structure. 912 * Deallocate security structure.
911 * @sk_clone_security: 913 * @sk_clone_security:
@@ -920,7 +922,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
920 * @inet_csk_clone: 922 * @inet_csk_clone:
921 * Sets the new child socket's sid to the openreq sid. 923 * Sets the new child socket's sid to the openreq sid.
922 * @inet_conn_established: 924 * @inet_conn_established:
923 * Sets the connection's peersid to the secmark on skb. 925 * Sets the connection's peersid to the secmark on skb.
924 * @req_classify_flow: 926 * @req_classify_flow:
925 * Sets the flow's sid to the openreq sid. 927 * Sets the flow's sid to the openreq sid.
926 * 928 *
@@ -999,13 +1001,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
999 * No return value. 1001 * No return value.
1000 * @key_permission: 1002 * @key_permission:
1001 * See whether a specific operational right is granted to a process on a 1003 * See whether a specific operational right is granted to a process on a
1002 * key. 1004 * key.
1003 * @key_ref refers to the key (key pointer + possession attribute bit). 1005 * @key_ref refers to the key (key pointer + possession attribute bit).
1004 * @context points to the process to provide the context against which to 1006 * @context points to the process to provide the context against which to
1005 * evaluate the security data on the key. 1007 * evaluate the security data on the key.
1006 * @perm describes the combination of permissions required of this key. 1008 * @perm describes the combination of permissions required of this key.
1007 * Return 1 if permission granted, 0 if permission denied and -ve it the 1009 * Return 1 if permission granted, 0 if permission denied and -ve it the
1008 * normal permissions model should be effected. 1010 * normal permissions model should be effected.
1009 * 1011 *
1010 * Security hooks affecting all System V IPC operations. 1012 * Security hooks affecting all System V IPC operations.
1011 * 1013 *
@@ -1056,7 +1058,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1056 * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO. 1058 * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO.
1057 * @msq contains the message queue to act upon. May be NULL. 1059 * @msq contains the message queue to act upon. May be NULL.
1058 * @cmd contains the operation to be performed. 1060 * @cmd contains the operation to be performed.
1059 * Return 0 if permission is granted. 1061 * Return 0 if permission is granted.
1060 * @msg_queue_msgsnd: 1062 * @msg_queue_msgsnd:
1061 * Check permission before a message, @msg, is enqueued on the message 1063 * Check permission before a message, @msg, is enqueued on the message
1062 * queue, @msq. 1064 * queue, @msq.
@@ -1066,8 +1068,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1066 * Return 0 if permission is granted. 1068 * Return 0 if permission is granted.
1067 * @msg_queue_msgrcv: 1069 * @msg_queue_msgrcv:
1068 * Check permission before a message, @msg, is removed from the message 1070 * Check permission before a message, @msg, is removed from the message
1069 * queue, @msq. The @target task structure contains a pointer to the 1071 * queue, @msq. The @target task structure contains a pointer to the
1070 * process that will be receiving the message (not equal to the current 1072 * process that will be receiving the message (not equal to the current
1071 * process when inline receives are being performed). 1073 * process when inline receives are being performed).
1072 * @msq contains the message queue to retrieve message from. 1074 * @msq contains the message queue to retrieve message from.
1073 * @msg contains the message destination. 1075 * @msg contains the message destination.
@@ -1132,15 +1134,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1132 * Return 0 if permission is granted. 1134 * Return 0 if permission is granted.
1133 * @sem_semctl: 1135 * @sem_semctl:
1134 * Check permission when a semaphore operation specified by @cmd is to be 1136 * Check permission when a semaphore operation specified by @cmd is to be
1135 * performed on the semaphore @sma. The @sma may be NULL, e.g. for 1137 * performed on the semaphore @sma. The @sma may be NULL, e.g. for
1136 * IPC_INFO or SEM_INFO. 1138 * IPC_INFO or SEM_INFO.
1137 * @sma contains the semaphore structure. May be NULL. 1139 * @sma contains the semaphore structure. May be NULL.
1138 * @cmd contains the operation to be performed. 1140 * @cmd contains the operation to be performed.
1139 * Return 0 if permission is granted. 1141 * Return 0 if permission is granted.
1140 * @sem_semop 1142 * @sem_semop
1141 * Check permissions before performing operations on members of the 1143 * Check permissions before performing operations on members of the
1142 * semaphore set @sma. If the @alter flag is nonzero, the semaphore set 1144 * semaphore set @sma. If the @alter flag is nonzero, the semaphore set
1143 * may be modified. 1145 * may be modified.
1144 * @sma contains the semaphore structure. 1146 * @sma contains the semaphore structure.
1145 * @sops contains the operations to perform. 1147 * @sops contains the operations to perform.
1146 * @nsops contains the number of operations to perform. 1148 * @nsops contains the number of operations to perform.
@@ -1211,7 +1213,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1211 * @syslog: 1213 * @syslog:
1212 * Check permission before accessing the kernel message ring or changing 1214 * Check permission before accessing the kernel message ring or changing
1213 * logging to the console. 1215 * logging to the console.
1214 * See the syslog(2) manual page for an explanation of the @type values. 1216 * See the syslog(2) manual page for an explanation of the @type values.
1215 * @type contains the type of action. 1217 * @type contains the type of action.
1216 * Return 0 if permission is granted. 1218 * Return 0 if permission is granted.
1217 * @settime: 1219 * @settime:
@@ -1223,22 +1225,22 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1223 * @vm_enough_memory: 1225 * @vm_enough_memory:
1224 * Check permissions for allocating a new virtual mapping. 1226 * Check permissions for allocating a new virtual mapping.
1225 * @mm contains the mm struct it is being added to. 1227 * @mm contains the mm struct it is being added to.
1226 * @pages contains the number of pages. 1228 * @pages contains the number of pages.
1227 * Return 0 if permission is granted. 1229 * Return 0 if permission is granted.
1228 * 1230 *
1229 * @register_security: 1231 * @register_security:
1230 * allow module stacking. 1232 * allow module stacking.
1231 * @name contains the name of the security module being stacked. 1233 * @name contains the name of the security module being stacked.
1232 * @ops contains a pointer to the struct security_operations of the module to stack. 1234 * @ops contains a pointer to the struct security_operations of the module to stack.
1233 * 1235 *
1234 * @secid_to_secctx: 1236 * @secid_to_secctx:
1235 * Convert secid to security context. 1237 * Convert secid to security context.
1236 * @secid contains the security ID. 1238 * @secid contains the security ID.
1237 * @secdata contains the pointer that stores the converted security context. 1239 * @secdata contains the pointer that stores the converted security context.
1238 * @secctx_to_secid: 1240 * @secctx_to_secid:
1239 * Convert security context to secid. 1241 * Convert security context to secid.
1240 * @secid contains the pointer to the generated security ID. 1242 * @secid contains the pointer to the generated security ID.
1241 * @secdata contains the security context. 1243 * @secdata contains the security context.
1242 * 1244 *
1243 * @release_secctx: 1245 * @release_secctx:
1244 * Release the security context. 1246 * Release the security context.
@@ -1281,49 +1283,49 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1281struct security_operations { 1283struct security_operations {
1282 char name[SECURITY_NAME_MAX + 1]; 1284 char name[SECURITY_NAME_MAX + 1];
1283 1285
1284 int (*ptrace) (struct task_struct * parent, struct task_struct * child); 1286 int (*ptrace) (struct task_struct *parent, struct task_struct *child);
1285 int (*capget) (struct task_struct * target, 1287 int (*capget) (struct task_struct *target,
1286 kernel_cap_t * effective, 1288 kernel_cap_t *effective,
1287 kernel_cap_t * inheritable, kernel_cap_t * permitted); 1289 kernel_cap_t *inheritable, kernel_cap_t *permitted);
1288 int (*capset_check) (struct task_struct * target, 1290 int (*capset_check) (struct task_struct *target,
1289 kernel_cap_t * effective, 1291 kernel_cap_t *effective,
1290 kernel_cap_t * inheritable, 1292 kernel_cap_t *inheritable,
1291 kernel_cap_t * permitted); 1293 kernel_cap_t *permitted);
1292 void (*capset_set) (struct task_struct * target, 1294 void (*capset_set) (struct task_struct *target,
1293 kernel_cap_t * effective, 1295 kernel_cap_t *effective,
1294 kernel_cap_t * inheritable, 1296 kernel_cap_t *inheritable,
1295 kernel_cap_t * permitted); 1297 kernel_cap_t *permitted);
1296 int (*capable) (struct task_struct * tsk, int cap); 1298 int (*capable) (struct task_struct *tsk, int cap);
1297 int (*acct) (struct file * file); 1299 int (*acct) (struct file *file);
1298 int (*sysctl) (struct ctl_table * table, int op); 1300 int (*sysctl) (struct ctl_table *table, int op);
1299 int (*quotactl) (int cmds, int type, int id, struct super_block * sb); 1301 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1300 int (*quota_on) (struct dentry * dentry); 1302 int (*quota_on) (struct dentry *dentry);
1301 int (*syslog) (int type); 1303 int (*syslog) (int type);
1302 int (*settime) (struct timespec *ts, struct timezone *tz); 1304 int (*settime) (struct timespec *ts, struct timezone *tz);
1303 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1305 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1304 1306
1305 int (*bprm_alloc_security) (struct linux_binprm * bprm); 1307 int (*bprm_alloc_security) (struct linux_binprm *bprm);
1306 void (*bprm_free_security) (struct linux_binprm * bprm); 1308 void (*bprm_free_security) (struct linux_binprm *bprm);
1307 void (*bprm_apply_creds) (struct linux_binprm * bprm, int unsafe); 1309 void (*bprm_apply_creds) (struct linux_binprm *bprm, int unsafe);
1308 void (*bprm_post_apply_creds) (struct linux_binprm * bprm); 1310 void (*bprm_post_apply_creds) (struct linux_binprm *bprm);
1309 int (*bprm_set_security) (struct linux_binprm * bprm); 1311 int (*bprm_set_security) (struct linux_binprm *bprm);
1310 int (*bprm_check_security) (struct linux_binprm * bprm); 1312 int (*bprm_check_security) (struct linux_binprm *bprm);
1311 int (*bprm_secureexec) (struct linux_binprm * bprm); 1313 int (*bprm_secureexec) (struct linux_binprm *bprm);
1312 1314
1313 int (*sb_alloc_security) (struct super_block * sb); 1315 int (*sb_alloc_security) (struct super_block *sb);
1314 void (*sb_free_security) (struct super_block * sb); 1316 void (*sb_free_security) (struct super_block *sb);
1315 int (*sb_copy_data)(char *orig, char *copy); 1317 int (*sb_copy_data) (char *orig, char *copy);
1316 int (*sb_kern_mount) (struct super_block *sb, void *data); 1318 int (*sb_kern_mount) (struct super_block *sb, void *data);
1317 int (*sb_statfs) (struct dentry *dentry); 1319 int (*sb_statfs) (struct dentry *dentry);
1318 int (*sb_mount) (char *dev_name, struct path *path, 1320 int (*sb_mount) (char *dev_name, struct path *path,
1319 char *type, unsigned long flags, void *data); 1321 char *type, unsigned long flags, void *data);
1320 int (*sb_check_sb) (struct vfsmount * mnt, struct path *path); 1322 int (*sb_check_sb) (struct vfsmount *mnt, struct path *path);
1321 int (*sb_umount) (struct vfsmount * mnt, int flags); 1323 int (*sb_umount) (struct vfsmount *mnt, int flags);
1322 void (*sb_umount_close) (struct vfsmount * mnt); 1324 void (*sb_umount_close) (struct vfsmount *mnt);
1323 void (*sb_umount_busy) (struct vfsmount * mnt); 1325 void (*sb_umount_busy) (struct vfsmount *mnt);
1324 void (*sb_post_remount) (struct vfsmount * mnt, 1326 void (*sb_post_remount) (struct vfsmount *mnt,
1325 unsigned long flags, void *data); 1327 unsigned long flags, void *data);
1326 void (*sb_post_addmount) (struct vfsmount * mnt, 1328 void (*sb_post_addmount) (struct vfsmount *mnt,
1327 struct path *mountpoint); 1329 struct path *mountpoint);
1328 int (*sb_pivotroot) (struct path *old_path, 1330 int (*sb_pivotroot) (struct path *old_path,
1329 struct path *new_path); 1331 struct path *new_path);
@@ -1337,29 +1339,29 @@ struct security_operations {
1337 struct super_block *newsb); 1339 struct super_block *newsb);
1338 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1340 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1339 1341
1340 int (*inode_alloc_security) (struct inode *inode); 1342 int (*inode_alloc_security) (struct inode *inode);
1341 void (*inode_free_security) (struct inode *inode); 1343 void (*inode_free_security) (struct inode *inode);
1342 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1344 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1343 char **name, void **value, size_t *len); 1345 char **name, void **value, size_t *len);
1344 int (*inode_create) (struct inode *dir, 1346 int (*inode_create) (struct inode *dir,
1345 struct dentry *dentry, int mode); 1347 struct dentry *dentry, int mode);
1346 int (*inode_link) (struct dentry *old_dentry, 1348 int (*inode_link) (struct dentry *old_dentry,
1347 struct inode *dir, struct dentry *new_dentry); 1349 struct inode *dir, struct dentry *new_dentry);
1348 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1350 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1349 int (*inode_symlink) (struct inode *dir, 1351 int (*inode_symlink) (struct inode *dir,
1350 struct dentry *dentry, const char *old_name); 1352 struct dentry *dentry, const char *old_name);
1351 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); 1353 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
1352 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); 1354 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1353 int (*inode_mknod) (struct inode *dir, struct dentry *dentry, 1355 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1354 int mode, dev_t dev); 1356 int mode, dev_t dev);
1355 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1357 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1356 struct inode *new_dir, struct dentry *new_dentry); 1358 struct inode *new_dir, struct dentry *new_dentry);
1357 int (*inode_readlink) (struct dentry *dentry); 1359 int (*inode_readlink) (struct dentry *dentry);
1358 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1360 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1359 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); 1361 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd);
1360 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1362 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1361 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1363 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1362 void (*inode_delete) (struct inode *inode); 1364 void (*inode_delete) (struct inode *inode);
1363 int (*inode_setxattr) (struct dentry *dentry, char *name, void *value, 1365 int (*inode_setxattr) (struct dentry *dentry, char *name, void *value,
1364 size_t size, int flags); 1366 size_t size, int flags);
1365 void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value, 1367 void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value,
@@ -1369,145 +1371,145 @@ struct security_operations {
1369 int (*inode_removexattr) (struct dentry *dentry, char *name); 1371 int (*inode_removexattr) (struct dentry *dentry, char *name);
1370 int (*inode_need_killpriv) (struct dentry *dentry); 1372 int (*inode_need_killpriv) (struct dentry *dentry);
1371 int (*inode_killpriv) (struct dentry *dentry); 1373 int (*inode_killpriv) (struct dentry *dentry);
1372 int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc); 1374 int (*inode_getsecurity) (const struct inode *inode, const char *name, void **buffer, bool alloc);
1373 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1375 int (*inode_setsecurity) (struct inode *inode, const char *name, const void *value, size_t size, int flags);
1374 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); 1376 int (*inode_listsecurity) (struct inode *inode, char *buffer, size_t buffer_size);
1375 void (*inode_getsecid)(const struct inode *inode, u32 *secid); 1377 void (*inode_getsecid) (const struct inode *inode, u32 *secid);
1376 1378
1377 int (*file_permission) (struct file * file, int mask); 1379 int (*file_permission) (struct file *file, int mask);
1378 int (*file_alloc_security) (struct file * file); 1380 int (*file_alloc_security) (struct file *file);
1379 void (*file_free_security) (struct file * file); 1381 void (*file_free_security) (struct file *file);
1380 int (*file_ioctl) (struct file * file, unsigned int cmd, 1382 int (*file_ioctl) (struct file *file, unsigned int cmd,
1381 unsigned long arg); 1383 unsigned long arg);
1382 int (*file_mmap) (struct file * file, 1384 int (*file_mmap) (struct file *file,
1383 unsigned long reqprot, unsigned long prot, 1385 unsigned long reqprot, unsigned long prot,
1384 unsigned long flags, unsigned long addr, 1386 unsigned long flags, unsigned long addr,
1385 unsigned long addr_only); 1387 unsigned long addr_only);
1386 int (*file_mprotect) (struct vm_area_struct * vma, 1388 int (*file_mprotect) (struct vm_area_struct *vma,
1387 unsigned long reqprot, 1389 unsigned long reqprot,
1388 unsigned long prot); 1390 unsigned long prot);
1389 int (*file_lock) (struct file * file, unsigned int cmd); 1391 int (*file_lock) (struct file *file, unsigned int cmd);
1390 int (*file_fcntl) (struct file * file, unsigned int cmd, 1392 int (*file_fcntl) (struct file *file, unsigned int cmd,
1391 unsigned long arg); 1393 unsigned long arg);
1392 int (*file_set_fowner) (struct file * file); 1394 int (*file_set_fowner) (struct file *file);
1393 int (*file_send_sigiotask) (struct task_struct * tsk, 1395 int (*file_send_sigiotask) (struct task_struct *tsk,
1394 struct fown_struct * fown, int sig); 1396 struct fown_struct *fown, int sig);
1395 int (*file_receive) (struct file * file); 1397 int (*file_receive) (struct file *file);
1396 int (*dentry_open) (struct file *file); 1398 int (*dentry_open) (struct file *file);
1397 1399
1398 int (*task_create) (unsigned long clone_flags); 1400 int (*task_create) (unsigned long clone_flags);
1399 int (*task_alloc_security) (struct task_struct * p); 1401 int (*task_alloc_security) (struct task_struct *p);
1400 void (*task_free_security) (struct task_struct * p); 1402 void (*task_free_security) (struct task_struct *p);
1401 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); 1403 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1402 int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ , 1404 int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ ,
1403 uid_t old_euid, uid_t old_suid, int flags); 1405 uid_t old_euid, uid_t old_suid, int flags);
1404 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags); 1406 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1405 int (*task_setpgid) (struct task_struct * p, pid_t pgid); 1407 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1406 int (*task_getpgid) (struct task_struct * p); 1408 int (*task_getpgid) (struct task_struct *p);
1407 int (*task_getsid) (struct task_struct * p); 1409 int (*task_getsid) (struct task_struct *p);
1408 void (*task_getsecid) (struct task_struct * p, u32 * secid); 1410 void (*task_getsecid) (struct task_struct *p, u32 *secid);
1409 int (*task_setgroups) (struct group_info *group_info); 1411 int (*task_setgroups) (struct group_info *group_info);
1410 int (*task_setnice) (struct task_struct * p, int nice); 1412 int (*task_setnice) (struct task_struct *p, int nice);
1411 int (*task_setioprio) (struct task_struct * p, int ioprio); 1413 int (*task_setioprio) (struct task_struct *p, int ioprio);
1412 int (*task_getioprio) (struct task_struct * p); 1414 int (*task_getioprio) (struct task_struct *p);
1413 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); 1415 int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim);
1414 int (*task_setscheduler) (struct task_struct * p, int policy, 1416 int (*task_setscheduler) (struct task_struct *p, int policy,
1415 struct sched_param * lp); 1417 struct sched_param *lp);
1416 int (*task_getscheduler) (struct task_struct * p); 1418 int (*task_getscheduler) (struct task_struct *p);
1417 int (*task_movememory) (struct task_struct * p); 1419 int (*task_movememory) (struct task_struct *p);
1418 int (*task_kill) (struct task_struct * p, 1420 int (*task_kill) (struct task_struct *p,
1419 struct siginfo * info, int sig, u32 secid); 1421 struct siginfo *info, int sig, u32 secid);
1420 int (*task_wait) (struct task_struct * p); 1422 int (*task_wait) (struct task_struct *p);
1421 int (*task_prctl) (int option, unsigned long arg2, 1423 int (*task_prctl) (int option, unsigned long arg2,
1422 unsigned long arg3, unsigned long arg4, 1424 unsigned long arg3, unsigned long arg4,
1423 unsigned long arg5); 1425 unsigned long arg5, long *rc_p);
1424 void (*task_reparent_to_init) (struct task_struct * p); 1426 void (*task_reparent_to_init) (struct task_struct *p);
1425 void (*task_to_inode)(struct task_struct *p, struct inode *inode); 1427 void (*task_to_inode) (struct task_struct *p, struct inode *inode);
1426 1428
1427 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); 1429 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag);
1428 void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid); 1430 void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid);
1429 1431
1430 int (*msg_msg_alloc_security) (struct msg_msg * msg); 1432 int (*msg_msg_alloc_security) (struct msg_msg *msg);
1431 void (*msg_msg_free_security) (struct msg_msg * msg); 1433 void (*msg_msg_free_security) (struct msg_msg *msg);
1432 1434
1433 int (*msg_queue_alloc_security) (struct msg_queue * msq); 1435 int (*msg_queue_alloc_security) (struct msg_queue *msq);
1434 void (*msg_queue_free_security) (struct msg_queue * msq); 1436 void (*msg_queue_free_security) (struct msg_queue *msq);
1435 int (*msg_queue_associate) (struct msg_queue * msq, int msqflg); 1437 int (*msg_queue_associate) (struct msg_queue *msq, int msqflg);
1436 int (*msg_queue_msgctl) (struct msg_queue * msq, int cmd); 1438 int (*msg_queue_msgctl) (struct msg_queue *msq, int cmd);
1437 int (*msg_queue_msgsnd) (struct msg_queue * msq, 1439 int (*msg_queue_msgsnd) (struct msg_queue *msq,
1438 struct msg_msg * msg, int msqflg); 1440 struct msg_msg *msg, int msqflg);
1439 int (*msg_queue_msgrcv) (struct msg_queue * msq, 1441 int (*msg_queue_msgrcv) (struct msg_queue *msq,
1440 struct msg_msg * msg, 1442 struct msg_msg *msg,
1441 struct task_struct * target, 1443 struct task_struct *target,
1442 long type, int mode); 1444 long type, int mode);
1443 1445
1444 int (*shm_alloc_security) (struct shmid_kernel * shp); 1446 int (*shm_alloc_security) (struct shmid_kernel *shp);
1445 void (*shm_free_security) (struct shmid_kernel * shp); 1447 void (*shm_free_security) (struct shmid_kernel *shp);
1446 int (*shm_associate) (struct shmid_kernel * shp, int shmflg); 1448 int (*shm_associate) (struct shmid_kernel *shp, int shmflg);
1447 int (*shm_shmctl) (struct shmid_kernel * shp, int cmd); 1449 int (*shm_shmctl) (struct shmid_kernel *shp, int cmd);
1448 int (*shm_shmat) (struct shmid_kernel * shp, 1450 int (*shm_shmat) (struct shmid_kernel *shp,
1449 char __user *shmaddr, int shmflg); 1451 char __user *shmaddr, int shmflg);
1450 1452
1451 int (*sem_alloc_security) (struct sem_array * sma); 1453 int (*sem_alloc_security) (struct sem_array *sma);
1452 void (*sem_free_security) (struct sem_array * sma); 1454 void (*sem_free_security) (struct sem_array *sma);
1453 int (*sem_associate) (struct sem_array * sma, int semflg); 1455 int (*sem_associate) (struct sem_array *sma, int semflg);
1454 int (*sem_semctl) (struct sem_array * sma, int cmd); 1456 int (*sem_semctl) (struct sem_array *sma, int cmd);
1455 int (*sem_semop) (struct sem_array * sma, 1457 int (*sem_semop) (struct sem_array *sma,
1456 struct sembuf * sops, unsigned nsops, int alter); 1458 struct sembuf *sops, unsigned nsops, int alter);
1457 1459
1458 int (*netlink_send) (struct sock * sk, struct sk_buff * skb); 1460 int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
1459 int (*netlink_recv) (struct sk_buff * skb, int cap); 1461 int (*netlink_recv) (struct sk_buff *skb, int cap);
1460 1462
1461 /* allow module stacking */ 1463 /* allow module stacking */
1462 int (*register_security) (const char *name, 1464 int (*register_security) (const char *name,
1463 struct security_operations *ops); 1465 struct security_operations *ops);
1464 1466
1465 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1467 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1466 1468
1467 int (*getprocattr)(struct task_struct *p, char *name, char **value); 1469 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1468 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1470 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1469 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); 1471 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1470 int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid); 1472 int (*secctx_to_secid) (char *secdata, u32 seclen, u32 *secid);
1471 void (*release_secctx)(char *secdata, u32 seclen); 1473 void (*release_secctx) (char *secdata, u32 seclen);
1472 1474
1473#ifdef CONFIG_SECURITY_NETWORK 1475#ifdef CONFIG_SECURITY_NETWORK
1474 int (*unix_stream_connect) (struct socket * sock, 1476 int (*unix_stream_connect) (struct socket *sock,
1475 struct socket * other, struct sock * newsk); 1477 struct socket *other, struct sock *newsk);
1476 int (*unix_may_send) (struct socket * sock, struct socket * other); 1478 int (*unix_may_send) (struct socket *sock, struct socket *other);
1477 1479
1478 int (*socket_create) (int family, int type, int protocol, int kern); 1480 int (*socket_create) (int family, int type, int protocol, int kern);
1479 int (*socket_post_create) (struct socket * sock, int family, 1481 int (*socket_post_create) (struct socket *sock, int family,
1480 int type, int protocol, int kern); 1482 int type, int protocol, int kern);
1481 int (*socket_bind) (struct socket * sock, 1483 int (*socket_bind) (struct socket *sock,
1482 struct sockaddr * address, int addrlen); 1484 struct sockaddr *address, int addrlen);
1483 int (*socket_connect) (struct socket * sock, 1485 int (*socket_connect) (struct socket *sock,
1484 struct sockaddr * address, int addrlen); 1486 struct sockaddr *address, int addrlen);
1485 int (*socket_listen) (struct socket * sock, int backlog); 1487 int (*socket_listen) (struct socket *sock, int backlog);
1486 int (*socket_accept) (struct socket * sock, struct socket * newsock); 1488 int (*socket_accept) (struct socket *sock, struct socket *newsock);
1487 void (*socket_post_accept) (struct socket * sock, 1489 void (*socket_post_accept) (struct socket *sock,
1488 struct socket * newsock); 1490 struct socket *newsock);
1489 int (*socket_sendmsg) (struct socket * sock, 1491 int (*socket_sendmsg) (struct socket *sock,
1490 struct msghdr * msg, int size); 1492 struct msghdr *msg, int size);
1491 int (*socket_recvmsg) (struct socket * sock, 1493 int (*socket_recvmsg) (struct socket *sock,
1492 struct msghdr * msg, int size, int flags); 1494 struct msghdr *msg, int size, int flags);
1493 int (*socket_getsockname) (struct socket * sock); 1495 int (*socket_getsockname) (struct socket *sock);
1494 int (*socket_getpeername) (struct socket * sock); 1496 int (*socket_getpeername) (struct socket *sock);
1495 int (*socket_getsockopt) (struct socket * sock, int level, int optname); 1497 int (*socket_getsockopt) (struct socket *sock, int level, int optname);
1496 int (*socket_setsockopt) (struct socket * sock, int level, int optname); 1498 int (*socket_setsockopt) (struct socket *sock, int level, int optname);
1497 int (*socket_shutdown) (struct socket * sock, int how); 1499 int (*socket_shutdown) (struct socket *sock, int how);
1498 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); 1500 int (*socket_sock_rcv_skb) (struct sock *sk, struct sk_buff *skb);
1499 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1501 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1500 int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid); 1502 int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid);
1501 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1503 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1502 void (*sk_free_security) (struct sock *sk); 1504 void (*sk_free_security) (struct sock *sk);
1503 void (*sk_clone_security) (const struct sock *sk, struct sock *newsk); 1505 void (*sk_clone_security) (const struct sock *sk, struct sock *newsk);
1504 void (*sk_getsecid) (struct sock *sk, u32 *secid); 1506 void (*sk_getsecid) (struct sock *sk, u32 *secid);
1505 void (*sock_graft)(struct sock* sk, struct socket *parent); 1507 void (*sock_graft) (struct sock *sk, struct socket *parent);
1506 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, 1508 int (*inet_conn_request) (struct sock *sk, struct sk_buff *skb,
1507 struct request_sock *req); 1509 struct request_sock *req);
1508 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); 1510 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req);
1509 void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb); 1511 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb);
1510 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); 1512 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1511#endif /* CONFIG_SECURITY_NETWORK */ 1513#endif /* CONFIG_SECURITY_NETWORK */
1512 1514
1513#ifdef CONFIG_SECURITY_NETWORK_XFRM 1515#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -1521,57 +1523,57 @@ struct security_operations {
1521 u32 secid); 1523 u32 secid);
1522 void (*xfrm_state_free_security) (struct xfrm_state *x); 1524 void (*xfrm_state_free_security) (struct xfrm_state *x);
1523 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1525 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1524 int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 1526 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
1525 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, 1527 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x,
1526 struct xfrm_policy *xp, struct flowi *fl); 1528 struct xfrm_policy *xp,
1527 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); 1529 struct flowi *fl);
1530 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall);
1528#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1531#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1529 1532
1530 /* key management security hooks */ 1533 /* key management security hooks */
1531#ifdef CONFIG_KEYS 1534#ifdef CONFIG_KEYS
1532 int (*key_alloc)(struct key *key, struct task_struct *tsk, unsigned long flags); 1535 int (*key_alloc) (struct key *key, struct task_struct *tsk, unsigned long flags);
1533 void (*key_free)(struct key *key); 1536 void (*key_free) (struct key *key);
1534 int (*key_permission)(key_ref_t key_ref, 1537 int (*key_permission) (key_ref_t key_ref,
1535 struct task_struct *context, 1538 struct task_struct *context,
1536 key_perm_t perm); 1539 key_perm_t perm);
1537 1540
1538#endif /* CONFIG_KEYS */ 1541#endif /* CONFIG_KEYS */
1539 1542
1540#ifdef CONFIG_AUDIT 1543#ifdef CONFIG_AUDIT
1541 int (*audit_rule_init)(u32 field, u32 op, char *rulestr, void **lsmrule); 1544 int (*audit_rule_init) (u32 field, u32 op, char *rulestr, void **lsmrule);
1542 int (*audit_rule_known)(struct audit_krule *krule); 1545 int (*audit_rule_known) (struct audit_krule *krule);
1543 int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule, 1546 int (*audit_rule_match) (u32 secid, u32 field, u32 op, void *lsmrule,
1544 struct audit_context *actx); 1547 struct audit_context *actx);
1545 void (*audit_rule_free)(void *lsmrule); 1548 void (*audit_rule_free) (void *lsmrule);
1546#endif /* CONFIG_AUDIT */ 1549#endif /* CONFIG_AUDIT */
1547}; 1550};
1548 1551
1549/* prototypes */ 1552/* prototypes */
1550extern int security_init (void); 1553extern int security_init(void);
1551extern int security_module_enable(struct security_operations *ops); 1554extern int security_module_enable(struct security_operations *ops);
1552extern int register_security (struct security_operations *ops); 1555extern int register_security(struct security_operations *ops);
1553extern int mod_reg_security (const char *name, struct security_operations *ops); 1556extern int mod_reg_security(const char *name, struct security_operations *ops);
1554extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 1557extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
1555 struct dentry *parent, void *data, 1558 struct dentry *parent, void *data,
1556 const struct file_operations *fops); 1559 const struct file_operations *fops);
1557extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); 1560extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
1558extern void securityfs_remove(struct dentry *dentry); 1561extern void securityfs_remove(struct dentry *dentry);
1559 1562
1560
1561/* Security operations */ 1563/* Security operations */
1562int security_ptrace(struct task_struct *parent, struct task_struct *child); 1564int security_ptrace(struct task_struct *parent, struct task_struct *child);
1563int security_capget(struct task_struct *target, 1565int security_capget(struct task_struct *target,
1564 kernel_cap_t *effective, 1566 kernel_cap_t *effective,
1565 kernel_cap_t *inheritable, 1567 kernel_cap_t *inheritable,
1566 kernel_cap_t *permitted); 1568 kernel_cap_t *permitted);
1567int security_capset_check(struct task_struct *target, 1569int security_capset_check(struct task_struct *target,
1568 kernel_cap_t *effective,
1569 kernel_cap_t *inheritable,
1570 kernel_cap_t *permitted);
1571void security_capset_set(struct task_struct *target,
1572 kernel_cap_t *effective, 1570 kernel_cap_t *effective,
1573 kernel_cap_t *inheritable, 1571 kernel_cap_t *inheritable,
1574 kernel_cap_t *permitted); 1572 kernel_cap_t *permitted);
1573void security_capset_set(struct task_struct *target,
1574 kernel_cap_t *effective,
1575 kernel_cap_t *inheritable,
1576 kernel_cap_t *permitted);
1575int security_capable(struct task_struct *tsk, int cap); 1577int security_capable(struct task_struct *tsk, int cap);
1576int security_acct(struct file *file); 1578int security_acct(struct file *file);
1577int security_sysctl(struct ctl_table *table, int op); 1579int security_sysctl(struct ctl_table *table, int op);
@@ -1594,7 +1596,7 @@ int security_sb_copy_data(char *orig, char *copy);
1594int security_sb_kern_mount(struct super_block *sb, void *data); 1596int security_sb_kern_mount(struct super_block *sb, void *data);
1595int security_sb_statfs(struct dentry *dentry); 1597int security_sb_statfs(struct dentry *dentry);
1596int security_sb_mount(char *dev_name, struct path *path, 1598int security_sb_mount(char *dev_name, struct path *path,
1597 char *type, unsigned long flags, void *data); 1599 char *type, unsigned long flags, void *data);
1598int security_sb_check_sb(struct vfsmount *mnt, struct path *path); 1600int security_sb_check_sb(struct vfsmount *mnt, struct path *path);
1599int security_sb_umount(struct vfsmount *mnt, int flags); 1601int security_sb_umount(struct vfsmount *mnt, int flags);
1600void security_sb_umount_close(struct vfsmount *mnt); 1602void security_sb_umount_close(struct vfsmount *mnt);
@@ -1619,12 +1621,12 @@ int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1619 struct dentry *new_dentry); 1621 struct dentry *new_dentry);
1620int security_inode_unlink(struct inode *dir, struct dentry *dentry); 1622int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1621int security_inode_symlink(struct inode *dir, struct dentry *dentry, 1623int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1622 const char *old_name); 1624 const char *old_name);
1623int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); 1625int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode);
1624int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1626int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1625int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); 1627int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
1626int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1628int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1627 struct inode *new_dir, struct dentry *new_dentry); 1629 struct inode *new_dir, struct dentry *new_dentry);
1628int security_inode_readlink(struct dentry *dentry); 1630int security_inode_readlink(struct dentry *dentry);
1629int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1631int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1630int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd); 1632int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
@@ -1632,9 +1634,9 @@ int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1632int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1634int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1633void security_inode_delete(struct inode *inode); 1635void security_inode_delete(struct inode *inode);
1634int security_inode_setxattr(struct dentry *dentry, char *name, 1636int security_inode_setxattr(struct dentry *dentry, char *name,
1635 void *value, size_t size, int flags); 1637 void *value, size_t size, int flags);
1636void security_inode_post_setxattr(struct dentry *dentry, char *name, 1638void security_inode_post_setxattr(struct dentry *dentry, char *name,
1637 void *value, size_t size, int flags); 1639 void *value, size_t size, int flags);
1638int security_inode_getxattr(struct dentry *dentry, char *name); 1640int security_inode_getxattr(struct dentry *dentry, char *name);
1639int security_inode_listxattr(struct dentry *dentry); 1641int security_inode_listxattr(struct dentry *dentry);
1640int security_inode_removexattr(struct dentry *dentry, char *name); 1642int security_inode_removexattr(struct dentry *dentry, char *name);
@@ -1652,12 +1654,12 @@ int security_file_mmap(struct file *file, unsigned long reqprot,
1652 unsigned long prot, unsigned long flags, 1654 unsigned long prot, unsigned long flags,
1653 unsigned long addr, unsigned long addr_only); 1655 unsigned long addr, unsigned long addr_only);
1654int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 1656int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
1655 unsigned long prot); 1657 unsigned long prot);
1656int security_file_lock(struct file *file, unsigned int cmd); 1658int security_file_lock(struct file *file, unsigned int cmd);
1657int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); 1659int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
1658int security_file_set_fowner(struct file *file); 1660int security_file_set_fowner(struct file *file);
1659int security_file_send_sigiotask(struct task_struct *tsk, 1661int security_file_send_sigiotask(struct task_struct *tsk,
1660 struct fown_struct *fown, int sig); 1662 struct fown_struct *fown, int sig);
1661int security_file_receive(struct file *file); 1663int security_file_receive(struct file *file);
1662int security_dentry_open(struct file *file); 1664int security_dentry_open(struct file *file);
1663int security_task_create(unsigned long clone_flags); 1665int security_task_create(unsigned long clone_flags);
@@ -1665,7 +1667,7 @@ int security_task_alloc(struct task_struct *p);
1665void security_task_free(struct task_struct *p); 1667void security_task_free(struct task_struct *p);
1666int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); 1668int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1667int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 1669int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
1668 uid_t old_suid, int flags); 1670 uid_t old_suid, int flags);
1669int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); 1671int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1670int security_task_setpgid(struct task_struct *p, pid_t pgid); 1672int security_task_setpgid(struct task_struct *p, pid_t pgid);
1671int security_task_getpgid(struct task_struct *p); 1673int security_task_getpgid(struct task_struct *p);
@@ -1684,7 +1686,7 @@ int security_task_kill(struct task_struct *p, struct siginfo *info,
1684 int sig, u32 secid); 1686 int sig, u32 secid);
1685int security_task_wait(struct task_struct *p); 1687int security_task_wait(struct task_struct *p);
1686int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 1688int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1687 unsigned long arg4, unsigned long arg5); 1689 unsigned long arg4, unsigned long arg5, long *rc_p);
1688void security_task_reparent_to_init(struct task_struct *p); 1690void security_task_reparent_to_init(struct task_struct *p);
1689void security_task_to_inode(struct task_struct *p, struct inode *inode); 1691void security_task_to_inode(struct task_struct *p, struct inode *inode);
1690int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); 1692int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
@@ -1696,9 +1698,9 @@ void security_msg_queue_free(struct msg_queue *msq);
1696int security_msg_queue_associate(struct msg_queue *msq, int msqflg); 1698int security_msg_queue_associate(struct msg_queue *msq, int msqflg);
1697int security_msg_queue_msgctl(struct msg_queue *msq, int cmd); 1699int security_msg_queue_msgctl(struct msg_queue *msq, int cmd);
1698int security_msg_queue_msgsnd(struct msg_queue *msq, 1700int security_msg_queue_msgsnd(struct msg_queue *msq,
1699 struct msg_msg *msg, int msqflg); 1701 struct msg_msg *msg, int msqflg);
1700int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, 1702int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
1701 struct task_struct *target, long type, int mode); 1703 struct task_struct *target, long type, int mode);
1702int security_shm_alloc(struct shmid_kernel *shp); 1704int security_shm_alloc(struct shmid_kernel *shp);
1703void security_shm_free(struct shmid_kernel *shp); 1705void security_shm_free(struct shmid_kernel *shp);
1704int security_shm_associate(struct shmid_kernel *shp, int shmflg); 1706int security_shm_associate(struct shmid_kernel *shp, int shmflg);
@@ -1710,7 +1712,7 @@ int security_sem_associate(struct sem_array *sma, int semflg);
1710int security_sem_semctl(struct sem_array *sma, int cmd); 1712int security_sem_semctl(struct sem_array *sma, int cmd);
1711int security_sem_semop(struct sem_array *sma, struct sembuf *sops, 1713int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
1712 unsigned nsops, int alter); 1714 unsigned nsops, int alter);
1713void security_d_instantiate (struct dentry *dentry, struct inode *inode); 1715void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1714int security_getprocattr(struct task_struct *p, char *name, char **value); 1716int security_getprocattr(struct task_struct *p, char *name, char **value);
1715int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1717int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1716int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1718int security_netlink_send(struct sock *sk, struct sk_buff *skb);
@@ -1741,33 +1743,33 @@ static inline int security_init(void)
1741 return 0; 1743 return 0;
1742} 1744}
1743 1745
1744static inline int security_ptrace (struct task_struct *parent, struct task_struct * child) 1746static inline int security_ptrace(struct task_struct *parent, struct task_struct *child)
1745{ 1747{
1746 return cap_ptrace (parent, child); 1748 return cap_ptrace(parent, child);
1747} 1749}
1748 1750
1749static inline int security_capget (struct task_struct *target, 1751static inline int security_capget(struct task_struct *target,
1750 kernel_cap_t *effective, 1752 kernel_cap_t *effective,
1751 kernel_cap_t *inheritable, 1753 kernel_cap_t *inheritable,
1752 kernel_cap_t *permitted) 1754 kernel_cap_t *permitted)
1753{ 1755{
1754 return cap_capget (target, effective, inheritable, permitted); 1756 return cap_capget(target, effective, inheritable, permitted);
1755} 1757}
1756 1758
1757static inline int security_capset_check (struct task_struct *target, 1759static inline int security_capset_check(struct task_struct *target,
1758 kernel_cap_t *effective, 1760 kernel_cap_t *effective,
1759 kernel_cap_t *inheritable, 1761 kernel_cap_t *inheritable,
1760 kernel_cap_t *permitted) 1762 kernel_cap_t *permitted)
1761{ 1763{
1762 return cap_capset_check (target, effective, inheritable, permitted); 1764 return cap_capset_check(target, effective, inheritable, permitted);
1763} 1765}
1764 1766
1765static inline void security_capset_set (struct task_struct *target, 1767static inline void security_capset_set(struct task_struct *target,
1766 kernel_cap_t *effective, 1768 kernel_cap_t *effective,
1767 kernel_cap_t *inheritable, 1769 kernel_cap_t *inheritable,
1768 kernel_cap_t *permitted) 1770 kernel_cap_t *permitted)
1769{ 1771{
1770 cap_capset_set (target, effective, inheritable, permitted); 1772 cap_capset_set(target, effective, inheritable, permitted);
1771} 1773}
1772 1774
1773static inline int security_capable(struct task_struct *tsk, int cap) 1775static inline int security_capable(struct task_struct *tsk, int cap)
@@ -1775,7 +1777,7 @@ static inline int security_capable(struct task_struct *tsk, int cap)
1775 return cap_capable(tsk, cap); 1777 return cap_capable(tsk, cap);
1776} 1778}
1777 1779
1778static inline int security_acct (struct file *file) 1780static inline int security_acct(struct file *file)
1779{ 1781{
1780 return 0; 1782 return 0;
1781} 1783}
@@ -1785,13 +1787,13 @@ static inline int security_sysctl(struct ctl_table *table, int op)
1785 return 0; 1787 return 0;
1786} 1788}
1787 1789
1788static inline int security_quotactl (int cmds, int type, int id, 1790static inline int security_quotactl(int cmds, int type, int id,
1789 struct super_block * sb) 1791 struct super_block *sb)
1790{ 1792{
1791 return 0; 1793 return 0;
1792} 1794}
1793 1795
1794static inline int security_quota_on (struct dentry * dentry) 1796static inline int security_quota_on(struct dentry *dentry)
1795{ 1797{
1796 return 0; 1798 return 0;
1797} 1799}
@@ -1816,102 +1818,102 @@ static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1816 return cap_vm_enough_memory(mm, pages); 1818 return cap_vm_enough_memory(mm, pages);
1817} 1819}
1818 1820
1819static inline int security_bprm_alloc (struct linux_binprm *bprm) 1821static inline int security_bprm_alloc(struct linux_binprm *bprm)
1820{ 1822{
1821 return 0; 1823 return 0;
1822} 1824}
1823 1825
1824static inline void security_bprm_free (struct linux_binprm *bprm) 1826static inline void security_bprm_free(struct linux_binprm *bprm)
1825{ } 1827{ }
1826 1828
1827static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe) 1829static inline void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
1828{ 1830{
1829 cap_bprm_apply_creds (bprm, unsafe); 1831 cap_bprm_apply_creds(bprm, unsafe);
1830} 1832}
1831 1833
1832static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm) 1834static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm)
1833{ 1835{
1834 return; 1836 return;
1835} 1837}
1836 1838
1837static inline int security_bprm_set (struct linux_binprm *bprm) 1839static inline int security_bprm_set(struct linux_binprm *bprm)
1838{ 1840{
1839 return cap_bprm_set_security (bprm); 1841 return cap_bprm_set_security(bprm);
1840} 1842}
1841 1843
1842static inline int security_bprm_check (struct linux_binprm *bprm) 1844static inline int security_bprm_check(struct linux_binprm *bprm)
1843{ 1845{
1844 return 0; 1846 return 0;
1845} 1847}
1846 1848
1847static inline int security_bprm_secureexec (struct linux_binprm *bprm) 1849static inline int security_bprm_secureexec(struct linux_binprm *bprm)
1848{ 1850{
1849 return cap_bprm_secureexec(bprm); 1851 return cap_bprm_secureexec(bprm);
1850} 1852}
1851 1853
1852static inline int security_sb_alloc (struct super_block *sb) 1854static inline int security_sb_alloc(struct super_block *sb)
1853{ 1855{
1854 return 0; 1856 return 0;
1855} 1857}
1856 1858
1857static inline void security_sb_free (struct super_block *sb) 1859static inline void security_sb_free(struct super_block *sb)
1858{ } 1860{ }
1859 1861
1860static inline int security_sb_copy_data (char *orig, char *copy) 1862static inline int security_sb_copy_data(char *orig, char *copy)
1861{ 1863{
1862 return 0; 1864 return 0;
1863} 1865}
1864 1866
1865static inline int security_sb_kern_mount (struct super_block *sb, void *data) 1867static inline int security_sb_kern_mount(struct super_block *sb, void *data)
1866{ 1868{
1867 return 0; 1869 return 0;
1868} 1870}
1869 1871
1870static inline int security_sb_statfs (struct dentry *dentry) 1872static inline int security_sb_statfs(struct dentry *dentry)
1871{ 1873{
1872 return 0; 1874 return 0;
1873} 1875}
1874 1876
1875static inline int security_sb_mount (char *dev_name, struct path *path, 1877static inline int security_sb_mount(char *dev_name, struct path *path,
1876 char *type, unsigned long flags, 1878 char *type, unsigned long flags,
1877 void *data) 1879 void *data)
1878{ 1880{
1879 return 0; 1881 return 0;
1880} 1882}
1881 1883
1882static inline int security_sb_check_sb (struct vfsmount *mnt, 1884static inline int security_sb_check_sb(struct vfsmount *mnt,
1883 struct path *path) 1885 struct path *path)
1884{ 1886{
1885 return 0; 1887 return 0;
1886} 1888}
1887 1889
1888static inline int security_sb_umount (struct vfsmount *mnt, int flags) 1890static inline int security_sb_umount(struct vfsmount *mnt, int flags)
1889{ 1891{
1890 return 0; 1892 return 0;
1891} 1893}
1892 1894
1893static inline void security_sb_umount_close (struct vfsmount *mnt) 1895static inline void security_sb_umount_close(struct vfsmount *mnt)
1894{ } 1896{ }
1895 1897
1896static inline void security_sb_umount_busy (struct vfsmount *mnt) 1898static inline void security_sb_umount_busy(struct vfsmount *mnt)
1897{ } 1899{ }
1898 1900
1899static inline void security_sb_post_remount (struct vfsmount *mnt, 1901static inline void security_sb_post_remount(struct vfsmount *mnt,
1900 unsigned long flags, void *data) 1902 unsigned long flags, void *data)
1901{ } 1903{ }
1902 1904
1903static inline void security_sb_post_addmount (struct vfsmount *mnt, 1905static inline void security_sb_post_addmount(struct vfsmount *mnt,
1904 struct path *mountpoint) 1906 struct path *mountpoint)
1905{ } 1907{ }
1906 1908
1907static inline int security_sb_pivotroot (struct path *old_path, 1909static inline int security_sb_pivotroot(struct path *old_path,
1908 struct path *new_path) 1910 struct path *new_path)
1909{ 1911{
1910 return 0; 1912 return 0;
1911} 1913}
1912 1914
1913static inline void security_sb_post_pivotroot (struct path *old_path, 1915static inline void security_sb_post_pivotroot(struct path *old_path,
1914 struct path *new_path) 1916 struct path *new_path)
1915{ } 1917{ }
1916static inline int security_sb_get_mnt_opts(const struct super_block *sb, 1918static inline int security_sb_get_mnt_opts(const struct super_block *sb,
1917 struct security_mnt_opts *opts) 1919 struct security_mnt_opts *opts)
@@ -1935,15 +1937,15 @@ static inline int security_sb_parse_opts_str(char *options, struct security_mnt_
1935 return 0; 1937 return 0;
1936} 1938}
1937 1939
1938static inline int security_inode_alloc (struct inode *inode) 1940static inline int security_inode_alloc(struct inode *inode)
1939{ 1941{
1940 return 0; 1942 return 0;
1941} 1943}
1942 1944
1943static inline void security_inode_free (struct inode *inode) 1945static inline void security_inode_free(struct inode *inode)
1944{ } 1946{ }
1945 1947
1946static inline int security_inode_init_security (struct inode *inode, 1948static inline int security_inode_init_security(struct inode *inode,
1947 struct inode *dir, 1949 struct inode *dir,
1948 char **name, 1950 char **name,
1949 void **value, 1951 void **value,
@@ -1951,55 +1953,55 @@ static inline int security_inode_init_security (struct inode *inode,
1951{ 1953{
1952 return -EOPNOTSUPP; 1954 return -EOPNOTSUPP;
1953} 1955}
1954 1956
1955static inline int security_inode_create (struct inode *dir, 1957static inline int security_inode_create(struct inode *dir,
1956 struct dentry *dentry, 1958 struct dentry *dentry,
1957 int mode) 1959 int mode)
1958{ 1960{
1959 return 0; 1961 return 0;
1960} 1962}
1961 1963
1962static inline int security_inode_link (struct dentry *old_dentry, 1964static inline int security_inode_link(struct dentry *old_dentry,
1963 struct inode *dir, 1965 struct inode *dir,
1964 struct dentry *new_dentry) 1966 struct dentry *new_dentry)
1965{ 1967{
1966 return 0; 1968 return 0;
1967} 1969}
1968 1970
1969static inline int security_inode_unlink (struct inode *dir, 1971static inline int security_inode_unlink(struct inode *dir,
1970 struct dentry *dentry) 1972 struct dentry *dentry)
1971{ 1973{
1972 return 0; 1974 return 0;
1973} 1975}
1974 1976
1975static inline int security_inode_symlink (struct inode *dir, 1977static inline int security_inode_symlink(struct inode *dir,
1976 struct dentry *dentry, 1978 struct dentry *dentry,
1977 const char *old_name) 1979 const char *old_name)
1978{ 1980{
1979 return 0; 1981 return 0;
1980} 1982}
1981 1983
1982static inline int security_inode_mkdir (struct inode *dir, 1984static inline int security_inode_mkdir(struct inode *dir,
1983 struct dentry *dentry, 1985 struct dentry *dentry,
1984 int mode) 1986 int mode)
1985{ 1987{
1986 return 0; 1988 return 0;
1987} 1989}
1988 1990
1989static inline int security_inode_rmdir (struct inode *dir, 1991static inline int security_inode_rmdir(struct inode *dir,
1990 struct dentry *dentry) 1992 struct dentry *dentry)
1991{ 1993{
1992 return 0; 1994 return 0;
1993} 1995}
1994 1996
1995static inline int security_inode_mknod (struct inode *dir, 1997static inline int security_inode_mknod(struct inode *dir,
1996 struct dentry *dentry, 1998 struct dentry *dentry,
1997 int mode, dev_t dev) 1999 int mode, dev_t dev)
1998{ 2000{
1999 return 0; 2001 return 0;
2000} 2002}
2001 2003
2002static inline int security_inode_rename (struct inode *old_dir, 2004static inline int security_inode_rename(struct inode *old_dir,
2003 struct dentry *old_dentry, 2005 struct dentry *old_dentry,
2004 struct inode *new_dir, 2006 struct inode *new_dir,
2005 struct dentry *new_dentry) 2007 struct dentry *new_dentry)
@@ -2007,59 +2009,59 @@ static inline int security_inode_rename (struct inode *old_dir,
2007 return 0; 2009 return 0;
2008} 2010}
2009 2011
2010static inline int security_inode_readlink (struct dentry *dentry) 2012static inline int security_inode_readlink(struct dentry *dentry)
2011{ 2013{
2012 return 0; 2014 return 0;
2013} 2015}
2014 2016
2015static inline int security_inode_follow_link (struct dentry *dentry, 2017static inline int security_inode_follow_link(struct dentry *dentry,
2016 struct nameidata *nd) 2018 struct nameidata *nd)
2017{ 2019{
2018 return 0; 2020 return 0;
2019} 2021}
2020 2022
2021static inline int security_inode_permission (struct inode *inode, int mask, 2023static inline int security_inode_permission(struct inode *inode, int mask,
2022 struct nameidata *nd) 2024 struct nameidata *nd)
2023{ 2025{
2024 return 0; 2026 return 0;
2025} 2027}
2026 2028
2027static inline int security_inode_setattr (struct dentry *dentry, 2029static inline int security_inode_setattr(struct dentry *dentry,
2028 struct iattr *attr) 2030 struct iattr *attr)
2029{ 2031{
2030 return 0; 2032 return 0;
2031} 2033}
2032 2034
2033static inline int security_inode_getattr (struct vfsmount *mnt, 2035static inline int security_inode_getattr(struct vfsmount *mnt,
2034 struct dentry *dentry) 2036 struct dentry *dentry)
2035{ 2037{
2036 return 0; 2038 return 0;
2037} 2039}
2038 2040
2039static inline void security_inode_delete (struct inode *inode) 2041static inline void security_inode_delete(struct inode *inode)
2040{ } 2042{ }
2041 2043
2042static inline int security_inode_setxattr (struct dentry *dentry, char *name, 2044static inline int security_inode_setxattr(struct dentry *dentry, char *name,
2043 void *value, size_t size, int flags) 2045 void *value, size_t size, int flags)
2044{ 2046{
2045 return cap_inode_setxattr(dentry, name, value, size, flags); 2047 return cap_inode_setxattr(dentry, name, value, size, flags);
2046} 2048}
2047 2049
2048static inline void security_inode_post_setxattr (struct dentry *dentry, char *name, 2050static inline void security_inode_post_setxattr(struct dentry *dentry, char *name,
2049 void *value, size_t size, int flags) 2051 void *value, size_t size, int flags)
2050{ } 2052{ }
2051 2053
2052static inline int security_inode_getxattr (struct dentry *dentry, char *name) 2054static inline int security_inode_getxattr(struct dentry *dentry, char *name)
2053{ 2055{
2054 return 0; 2056 return 0;
2055} 2057}
2056 2058
2057static inline int security_inode_listxattr (struct dentry *dentry) 2059static inline int security_inode_listxattr(struct dentry *dentry)
2058{ 2060{
2059 return 0; 2061 return 0;
2060} 2062}
2061 2063
2062static inline int security_inode_removexattr (struct dentry *dentry, char *name) 2064static inline int security_inode_removexattr(struct dentry *dentry, char *name)
2063{ 2065{
2064 return cap_inode_removexattr(dentry, name); 2066 return cap_inode_removexattr(dentry, name);
2065} 2067}
@@ -2094,198 +2096,198 @@ static inline void security_inode_getsecid(const struct inode *inode, u32 *secid
2094 *secid = 0; 2096 *secid = 0;
2095} 2097}
2096 2098
2097static inline int security_file_permission (struct file *file, int mask) 2099static inline int security_file_permission(struct file *file, int mask)
2098{ 2100{
2099 return 0; 2101 return 0;
2100} 2102}
2101 2103
2102static inline int security_file_alloc (struct file *file) 2104static inline int security_file_alloc(struct file *file)
2103{ 2105{
2104 return 0; 2106 return 0;
2105} 2107}
2106 2108
2107static inline void security_file_free (struct file *file) 2109static inline void security_file_free(struct file *file)
2108{ } 2110{ }
2109 2111
2110static inline int security_file_ioctl (struct file *file, unsigned int cmd, 2112static inline int security_file_ioctl(struct file *file, unsigned int cmd,
2111 unsigned long arg) 2113 unsigned long arg)
2112{ 2114{
2113 return 0; 2115 return 0;
2114} 2116}
2115 2117
2116static inline int security_file_mmap (struct file *file, unsigned long reqprot, 2118static inline int security_file_mmap(struct file *file, unsigned long reqprot,
2117 unsigned long prot, 2119 unsigned long prot,
2118 unsigned long flags, 2120 unsigned long flags,
2119 unsigned long addr, 2121 unsigned long addr,
2120 unsigned long addr_only) 2122 unsigned long addr_only)
2121{ 2123{
2122 return 0; 2124 return 0;
2123} 2125}
2124 2126
2125static inline int security_file_mprotect (struct vm_area_struct *vma, 2127static inline int security_file_mprotect(struct vm_area_struct *vma,
2126 unsigned long reqprot, 2128 unsigned long reqprot,
2127 unsigned long prot) 2129 unsigned long prot)
2128{ 2130{
2129 return 0; 2131 return 0;
2130} 2132}
2131 2133
2132static inline int security_file_lock (struct file *file, unsigned int cmd) 2134static inline int security_file_lock(struct file *file, unsigned int cmd)
2133{ 2135{
2134 return 0; 2136 return 0;
2135} 2137}
2136 2138
2137static inline int security_file_fcntl (struct file *file, unsigned int cmd, 2139static inline int security_file_fcntl(struct file *file, unsigned int cmd,
2138 unsigned long arg) 2140 unsigned long arg)
2139{ 2141{
2140 return 0; 2142 return 0;
2141} 2143}
2142 2144
2143static inline int security_file_set_fowner (struct file *file) 2145static inline int security_file_set_fowner(struct file *file)
2144{ 2146{
2145 return 0; 2147 return 0;
2146} 2148}
2147 2149
2148static inline int security_file_send_sigiotask (struct task_struct *tsk, 2150static inline int security_file_send_sigiotask(struct task_struct *tsk,
2149 struct fown_struct *fown, 2151 struct fown_struct *fown,
2150 int sig) 2152 int sig)
2151{ 2153{
2152 return 0; 2154 return 0;
2153} 2155}
2154 2156
2155static inline int security_file_receive (struct file *file) 2157static inline int security_file_receive(struct file *file)
2156{ 2158{
2157 return 0; 2159 return 0;
2158} 2160}
2159 2161
2160static inline int security_dentry_open (struct file *file) 2162static inline int security_dentry_open(struct file *file)
2161{ 2163{
2162 return 0; 2164 return 0;
2163} 2165}
2164 2166
2165static inline int security_task_create (unsigned long clone_flags) 2167static inline int security_task_create(unsigned long clone_flags)
2166{ 2168{
2167 return 0; 2169 return 0;
2168} 2170}
2169 2171
2170static inline int security_task_alloc (struct task_struct *p) 2172static inline int security_task_alloc(struct task_struct *p)
2171{ 2173{
2172 return 0; 2174 return 0;
2173} 2175}
2174 2176
2175static inline void security_task_free (struct task_struct *p) 2177static inline void security_task_free(struct task_struct *p)
2176{ } 2178{ }
2177 2179
2178static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2, 2180static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2179 int flags) 2181 int flags)
2180{ 2182{
2181 return 0; 2183 return 0;
2182} 2184}
2183 2185
2184static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid, 2186static inline int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
2185 uid_t old_suid, int flags) 2187 uid_t old_suid, int flags)
2186{ 2188{
2187 return cap_task_post_setuid (old_ruid, old_euid, old_suid, flags); 2189 return cap_task_post_setuid(old_ruid, old_euid, old_suid, flags);
2188} 2190}
2189 2191
2190static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2, 2192static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
2191 int flags) 2193 int flags)
2192{ 2194{
2193 return 0; 2195 return 0;
2194} 2196}
2195 2197
2196static inline int security_task_setpgid (struct task_struct *p, pid_t pgid) 2198static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
2197{ 2199{
2198 return 0; 2200 return 0;
2199} 2201}
2200 2202
2201static inline int security_task_getpgid (struct task_struct *p) 2203static inline int security_task_getpgid(struct task_struct *p)
2202{ 2204{
2203 return 0; 2205 return 0;
2204} 2206}
2205 2207
2206static inline int security_task_getsid (struct task_struct *p) 2208static inline int security_task_getsid(struct task_struct *p)
2207{ 2209{
2208 return 0; 2210 return 0;
2209} 2211}
2210 2212
2211static inline void security_task_getsecid (struct task_struct *p, u32 *secid) 2213static inline void security_task_getsecid(struct task_struct *p, u32 *secid)
2212{ 2214{
2213 *secid = 0; 2215 *secid = 0;
2214} 2216}
2215 2217
2216static inline int security_task_setgroups (struct group_info *group_info) 2218static inline int security_task_setgroups(struct group_info *group_info)
2217{ 2219{
2218 return 0; 2220 return 0;
2219} 2221}
2220 2222
2221static inline int security_task_setnice (struct task_struct *p, int nice) 2223static inline int security_task_setnice(struct task_struct *p, int nice)
2222{ 2224{
2223 return cap_task_setnice(p, nice); 2225 return cap_task_setnice(p, nice);
2224} 2226}
2225 2227
2226static inline int security_task_setioprio (struct task_struct *p, int ioprio) 2228static inline int security_task_setioprio(struct task_struct *p, int ioprio)
2227{ 2229{
2228 return cap_task_setioprio(p, ioprio); 2230 return cap_task_setioprio(p, ioprio);
2229} 2231}
2230 2232
2231static inline int security_task_getioprio (struct task_struct *p) 2233static inline int security_task_getioprio(struct task_struct *p)
2232{ 2234{
2233 return 0; 2235 return 0;
2234} 2236}
2235 2237
2236static inline int security_task_setrlimit (unsigned int resource, 2238static inline int security_task_setrlimit(unsigned int resource,
2237 struct rlimit *new_rlim) 2239 struct rlimit *new_rlim)
2238{ 2240{
2239 return 0; 2241 return 0;
2240} 2242}
2241 2243
2242static inline int security_task_setscheduler (struct task_struct *p, 2244static inline int security_task_setscheduler(struct task_struct *p,
2243 int policy, 2245 int policy,
2244 struct sched_param *lp) 2246 struct sched_param *lp)
2245{ 2247{
2246 return cap_task_setscheduler(p, policy, lp); 2248 return cap_task_setscheduler(p, policy, lp);
2247} 2249}
2248 2250
2249static inline int security_task_getscheduler (struct task_struct *p) 2251static inline int security_task_getscheduler(struct task_struct *p)
2250{ 2252{
2251 return 0; 2253 return 0;
2252} 2254}
2253 2255
2254static inline int security_task_movememory (struct task_struct *p) 2256static inline int security_task_movememory(struct task_struct *p)
2255{ 2257{
2256 return 0; 2258 return 0;
2257} 2259}
2258 2260
2259static inline int security_task_kill (struct task_struct *p, 2261static inline int security_task_kill(struct task_struct *p,
2260 struct siginfo *info, int sig, 2262 struct siginfo *info, int sig,
2261 u32 secid) 2263 u32 secid)
2262{ 2264{
2263 return 0; 2265 return 0;
2264} 2266}
2265 2267
2266static inline int security_task_wait (struct task_struct *p) 2268static inline int security_task_wait(struct task_struct *p)
2267{ 2269{
2268 return 0; 2270 return 0;
2269} 2271}
2270 2272
2271static inline int security_task_prctl (int option, unsigned long arg2, 2273static inline int security_task_prctl(int option, unsigned long arg2,
2272 unsigned long arg3, 2274 unsigned long arg3,
2273 unsigned long arg4, 2275 unsigned long arg4,
2274 unsigned long arg5) 2276 unsigned long arg5, long *rc_p)
2275{ 2277{
2276 return 0; 2278 return cap_task_prctl(option, arg2, arg3, arg3, arg5, rc_p);
2277} 2279}
2278 2280
2279static inline void security_task_reparent_to_init (struct task_struct *p) 2281static inline void security_task_reparent_to_init(struct task_struct *p)
2280{ 2282{
2281 cap_task_reparent_to_init (p); 2283 cap_task_reparent_to_init(p);
2282} 2284}
2283 2285
2284static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) 2286static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
2285{ } 2287{ }
2286 2288
2287static inline int security_ipc_permission (struct kern_ipc_perm *ipcp, 2289static inline int security_ipc_permission(struct kern_ipc_perm *ipcp,
2288 short flag) 2290 short flag)
2289{ 2291{
2290 return 0; 2292 return 0;
2291} 2293}
@@ -2295,98 +2297,98 @@ static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
2295 *secid = 0; 2297 *secid = 0;
2296} 2298}
2297 2299
2298static inline int security_msg_msg_alloc (struct msg_msg * msg) 2300static inline int security_msg_msg_alloc(struct msg_msg *msg)
2299{ 2301{
2300 return 0; 2302 return 0;
2301} 2303}
2302 2304
2303static inline void security_msg_msg_free (struct msg_msg * msg) 2305static inline void security_msg_msg_free(struct msg_msg *msg)
2304{ } 2306{ }
2305 2307
2306static inline int security_msg_queue_alloc (struct msg_queue *msq) 2308static inline int security_msg_queue_alloc(struct msg_queue *msq)
2307{ 2309{
2308 return 0; 2310 return 0;
2309} 2311}
2310 2312
2311static inline void security_msg_queue_free (struct msg_queue *msq) 2313static inline void security_msg_queue_free(struct msg_queue *msq)
2312{ } 2314{ }
2313 2315
2314static inline int security_msg_queue_associate (struct msg_queue * msq, 2316static inline int security_msg_queue_associate(struct msg_queue *msq,
2315 int msqflg) 2317 int msqflg)
2316{ 2318{
2317 return 0; 2319 return 0;
2318} 2320}
2319 2321
2320static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd) 2322static inline int security_msg_queue_msgctl(struct msg_queue *msq, int cmd)
2321{ 2323{
2322 return 0; 2324 return 0;
2323} 2325}
2324 2326
2325static inline int security_msg_queue_msgsnd (struct msg_queue * msq, 2327static inline int security_msg_queue_msgsnd(struct msg_queue *msq,
2326 struct msg_msg * msg, int msqflg) 2328 struct msg_msg *msg, int msqflg)
2327{ 2329{
2328 return 0; 2330 return 0;
2329} 2331}
2330 2332
2331static inline int security_msg_queue_msgrcv (struct msg_queue * msq, 2333static inline int security_msg_queue_msgrcv(struct msg_queue *msq,
2332 struct msg_msg * msg, 2334 struct msg_msg *msg,
2333 struct task_struct * target, 2335 struct task_struct *target,
2334 long type, int mode) 2336 long type, int mode)
2335{ 2337{
2336 return 0; 2338 return 0;
2337} 2339}
2338 2340
2339static inline int security_shm_alloc (struct shmid_kernel *shp) 2341static inline int security_shm_alloc(struct shmid_kernel *shp)
2340{ 2342{
2341 return 0; 2343 return 0;
2342} 2344}
2343 2345
2344static inline void security_shm_free (struct shmid_kernel *shp) 2346static inline void security_shm_free(struct shmid_kernel *shp)
2345{ } 2347{ }
2346 2348
2347static inline int security_shm_associate (struct shmid_kernel * shp, 2349static inline int security_shm_associate(struct shmid_kernel *shp,
2348 int shmflg) 2350 int shmflg)
2349{ 2351{
2350 return 0; 2352 return 0;
2351} 2353}
2352 2354
2353static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd) 2355static inline int security_shm_shmctl(struct shmid_kernel *shp, int cmd)
2354{ 2356{
2355 return 0; 2357 return 0;
2356} 2358}
2357 2359
2358static inline int security_shm_shmat (struct shmid_kernel * shp, 2360static inline int security_shm_shmat(struct shmid_kernel *shp,
2359 char __user *shmaddr, int shmflg) 2361 char __user *shmaddr, int shmflg)
2360{ 2362{
2361 return 0; 2363 return 0;
2362} 2364}
2363 2365
2364static inline int security_sem_alloc (struct sem_array *sma) 2366static inline int security_sem_alloc(struct sem_array *sma)
2365{ 2367{
2366 return 0; 2368 return 0;
2367} 2369}
2368 2370
2369static inline void security_sem_free (struct sem_array *sma) 2371static inline void security_sem_free(struct sem_array *sma)
2370{ } 2372{ }
2371 2373
2372static inline int security_sem_associate (struct sem_array * sma, int semflg) 2374static inline int security_sem_associate(struct sem_array *sma, int semflg)
2373{ 2375{
2374 return 0; 2376 return 0;
2375} 2377}
2376 2378
2377static inline int security_sem_semctl (struct sem_array * sma, int cmd) 2379static inline int security_sem_semctl(struct sem_array *sma, int cmd)
2378{ 2380{
2379 return 0; 2381 return 0;
2380} 2382}
2381 2383
2382static inline int security_sem_semop (struct sem_array * sma, 2384static inline int security_sem_semop(struct sem_array *sma,
2383 struct sembuf * sops, unsigned nsops, 2385 struct sembuf *sops, unsigned nsops,
2384 int alter) 2386 int alter)
2385{ 2387{
2386 return 0; 2388 return 0;
2387} 2389}
2388 2390
2389static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode) 2391static inline void security_d_instantiate(struct dentry *dentry, struct inode *inode)
2390{ } 2392{ }
2391 2393
2392static inline int security_getprocattr(struct task_struct *p, char *name, char **value) 2394static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
@@ -2399,14 +2401,14 @@ static inline int security_setprocattr(struct task_struct *p, char *name, void *
2399 return -EINVAL; 2401 return -EINVAL;
2400} 2402}
2401 2403
2402static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb) 2404static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2403{ 2405{
2404 return cap_netlink_send (sk, skb); 2406 return cap_netlink_send(sk, skb);
2405} 2407}
2406 2408
2407static inline int security_netlink_recv (struct sk_buff *skb, int cap) 2409static inline int security_netlink_recv(struct sk_buff *skb, int cap)
2408{ 2410{
2409 return cap_netlink_recv (skb, cap); 2411 return cap_netlink_recv(skb, cap);
2410} 2412}
2411 2413
2412static inline struct dentry *securityfs_create_dir(const char *name, 2414static inline struct dentry *securityfs_create_dir(const char *name,
@@ -2484,26 +2486,26 @@ void security_inet_conn_established(struct sock *sk,
2484 struct sk_buff *skb); 2486 struct sk_buff *skb);
2485 2487
2486#else /* CONFIG_SECURITY_NETWORK */ 2488#else /* CONFIG_SECURITY_NETWORK */
2487static inline int security_unix_stream_connect(struct socket * sock, 2489static inline int security_unix_stream_connect(struct socket *sock,
2488 struct socket * other, 2490 struct socket *other,
2489 struct sock * newsk) 2491 struct sock *newsk)
2490{ 2492{
2491 return 0; 2493 return 0;
2492} 2494}
2493 2495
2494static inline int security_unix_may_send(struct socket * sock, 2496static inline int security_unix_may_send(struct socket *sock,
2495 struct socket * other) 2497 struct socket *other)
2496{ 2498{
2497 return 0; 2499 return 0;
2498} 2500}
2499 2501
2500static inline int security_socket_create (int family, int type, 2502static inline int security_socket_create(int family, int type,
2501 int protocol, int kern) 2503 int protocol, int kern)
2502{ 2504{
2503 return 0; 2505 return 0;
2504} 2506}
2505 2507
2506static inline int security_socket_post_create(struct socket * sock, 2508static inline int security_socket_post_create(struct socket *sock,
2507 int family, 2509 int family,
2508 int type, 2510 int type,
2509 int protocol, int kern) 2511 int protocol, int kern)
@@ -2511,77 +2513,77 @@ static inline int security_socket_post_create(struct socket * sock,
2511 return 0; 2513 return 0;
2512} 2514}
2513 2515
2514static inline int security_socket_bind(struct socket * sock, 2516static inline int security_socket_bind(struct socket *sock,
2515 struct sockaddr * address, 2517 struct sockaddr *address,
2516 int addrlen) 2518 int addrlen)
2517{ 2519{
2518 return 0; 2520 return 0;
2519} 2521}
2520 2522
2521static inline int security_socket_connect(struct socket * sock, 2523static inline int security_socket_connect(struct socket *sock,
2522 struct sockaddr * address, 2524 struct sockaddr *address,
2523 int addrlen) 2525 int addrlen)
2524{ 2526{
2525 return 0; 2527 return 0;
2526} 2528}
2527 2529
2528static inline int security_socket_listen(struct socket * sock, int backlog) 2530static inline int security_socket_listen(struct socket *sock, int backlog)
2529{ 2531{
2530 return 0; 2532 return 0;
2531} 2533}
2532 2534
2533static inline int security_socket_accept(struct socket * sock, 2535static inline int security_socket_accept(struct socket *sock,
2534 struct socket * newsock) 2536 struct socket *newsock)
2535{ 2537{
2536 return 0; 2538 return 0;
2537} 2539}
2538 2540
2539static inline void security_socket_post_accept(struct socket * sock, 2541static inline void security_socket_post_accept(struct socket *sock,
2540 struct socket * newsock) 2542 struct socket *newsock)
2541{ 2543{
2542} 2544}
2543 2545
2544static inline int security_socket_sendmsg(struct socket * sock, 2546static inline int security_socket_sendmsg(struct socket *sock,
2545 struct msghdr * msg, int size) 2547 struct msghdr *msg, int size)
2546{ 2548{
2547 return 0; 2549 return 0;
2548} 2550}
2549 2551
2550static inline int security_socket_recvmsg(struct socket * sock, 2552static inline int security_socket_recvmsg(struct socket *sock,
2551 struct msghdr * msg, int size, 2553 struct msghdr *msg, int size,
2552 int flags) 2554 int flags)
2553{ 2555{
2554 return 0; 2556 return 0;
2555} 2557}
2556 2558
2557static inline int security_socket_getsockname(struct socket * sock) 2559static inline int security_socket_getsockname(struct socket *sock)
2558{ 2560{
2559 return 0; 2561 return 0;
2560} 2562}
2561 2563
2562static inline int security_socket_getpeername(struct socket * sock) 2564static inline int security_socket_getpeername(struct socket *sock)
2563{ 2565{
2564 return 0; 2566 return 0;
2565} 2567}
2566 2568
2567static inline int security_socket_getsockopt(struct socket * sock, 2569static inline int security_socket_getsockopt(struct socket *sock,
2568 int level, int optname) 2570 int level, int optname)
2569{ 2571{
2570 return 0; 2572 return 0;
2571} 2573}
2572 2574
2573static inline int security_socket_setsockopt(struct socket * sock, 2575static inline int security_socket_setsockopt(struct socket *sock,
2574 int level, int optname) 2576 int level, int optname)
2575{ 2577{
2576 return 0; 2578 return 0;
2577} 2579}
2578 2580
2579static inline int security_socket_shutdown(struct socket * sock, int how) 2581static inline int security_socket_shutdown(struct socket *sock, int how)
2580{ 2582{
2581 return 0; 2583 return 0;
2582} 2584}
2583static inline int security_sock_rcv_skb (struct sock * sk, 2585static inline int security_sock_rcv_skb(struct sock *sk,
2584 struct sk_buff * skb) 2586 struct sk_buff *skb)
2585{ 2587{
2586 return 0; 2588 return 0;
2587} 2589}
@@ -2618,7 +2620,7 @@ static inline void security_req_classify_flow(const struct request_sock *req, st
2618{ 2620{
2619} 2621}
2620 2622
2621static inline void security_sock_graft(struct sock* sk, struct socket *parent) 2623static inline void security_sock_graft(struct sock *sk, struct socket *parent)
2622{ 2624{
2623} 2625}
2624 2626
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 00b65c0a82ca..3d37c94abbc8 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -46,6 +46,7 @@ enum {
46 PLAT8250_DEV_HUB6, 46 PLAT8250_DEV_HUB6,
47 PLAT8250_DEV_MCA, 47 PLAT8250_DEV_MCA,
48 PLAT8250_DEV_AU1X00, 48 PLAT8250_DEV_AU1X00,
49 PLAT8250_DEV_SM501,
49}; 50};
50 51
51/* 52/*
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 8d5fb36ea047..f2d12d5a21b8 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -34,8 +34,7 @@ struct shmem_sb_info {
34 uid_t uid; /* Mount uid for root directory */ 34 uid_t uid; /* Mount uid for root directory */
35 gid_t gid; /* Mount gid for root directory */ 35 gid_t gid; /* Mount gid for root directory */
36 mode_t mode; /* Mount mode for root directory */ 36 mode_t mode; /* Mount mode for root directory */
37 int policy; /* Default NUMA memory alloc policy */ 37 struct mempolicy *mpol; /* default memory policy for mappings */
38 nodemask_t policy_nodes; /* nodemask for preferred and bind */
39}; 38};
40 39
41static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) 40static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 1d7d4c5797ee..a6977423baf7 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -12,11 +12,22 @@
12#include <asm/errno.h> 12#include <asm/errno.h>
13 13
14#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) 14#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
15extern void pm_set_vt_switch(int);
15extern int pm_prepare_console(void); 16extern int pm_prepare_console(void);
16extern void pm_restore_console(void); 17extern void pm_restore_console(void);
17#else 18#else
18static inline int pm_prepare_console(void) { return 0; } 19static inline void pm_set_vt_switch(int do_switch)
19static inline void pm_restore_console(void) {} 20{
21}
22
23static inline int pm_prepare_console(void)
24{
25 return 0;
26}
27
28static inline void pm_restore_console(void)
29{
30}
20#endif 31#endif
21 32
22typedef int __bitwise suspend_state_t; 33typedef int __bitwise suspend_state_t;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 878459ae0454..0b3377650c85 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -177,11 +177,11 @@ extern void activate_page(struct page *);
177extern void mark_page_accessed(struct page *); 177extern void mark_page_accessed(struct page *);
178extern void lru_add_drain(void); 178extern void lru_add_drain(void);
179extern int lru_add_drain_all(void); 179extern int lru_add_drain_all(void);
180extern int rotate_reclaimable_page(struct page *page); 180extern void rotate_reclaimable_page(struct page *page);
181extern void swap_setup(void); 181extern void swap_setup(void);
182 182
183/* linux/mm/vmscan.c */ 183/* linux/mm/vmscan.c */
184extern unsigned long try_to_free_pages(struct zone **zones, int order, 184extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
185 gfp_t gfp_mask); 185 gfp_t gfp_mask);
186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
187 gfp_t gfp_mask); 187 gfp_t gfp_mask);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 5562fbf72095..45f6bc82d317 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -13,10 +13,6 @@
13#define _SYNCLINK_H_ 13#define _SYNCLINK_H_
14#define SYNCLINK_H_VERSION 3.6 14#define SYNCLINK_H_VERSION 3.6
15 15
16#define BOOLEAN int
17#define TRUE 1
18#define FALSE 0
19
20#define BIT0 0x0001 16#define BIT0 0x0001
21#define BIT1 0x0002 17#define BIT1 0x0002
22#define BIT2 0x0004 18#define BIT2 0x0004
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index ce8e7da05807..364789aae9f3 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -31,6 +31,7 @@ struct vm_struct {
31 struct page **pages; 31 struct page **pages;
32 unsigned int nr_pages; 32 unsigned int nr_pages;
33 unsigned long phys_addr; 33 unsigned long phys_addr;
34 void *caller;
34}; 35};
35 36
36/* 37/*
@@ -66,6 +67,8 @@ static inline size_t get_vm_area_size(const struct vm_struct *area)
66} 67}
67 68
68extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); 69extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
70extern struct vm_struct *get_vm_area_caller(unsigned long size,
71 unsigned long flags, void *caller);
69extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 72extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
70 unsigned long start, unsigned long end); 73 unsigned long start, unsigned long end);
71extern struct vm_struct *get_vm_area_node(unsigned long size, 74extern struct vm_struct *get_vm_area_node(unsigned long size,
@@ -87,4 +90,6 @@ extern void free_vm_area(struct vm_struct *area);
87extern rwlock_t vmlist_lock; 90extern rwlock_t vmlist_lock;
88extern struct vm_struct *vmlist; 91extern struct vm_struct *vmlist;
89 92
93extern const struct seq_operations vmalloc_op;
94
90#endif /* _LINUX_VMALLOC_H */ 95#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 9f1b4b46151e..e83b69346d23 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -25,6 +25,7 @@
25#define HIGHMEM_ZONE(xx) 25#define HIGHMEM_ZONE(xx)
26#endif 26#endif
27 27
28
28#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) , xx##_MOVABLE 29#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) , xx##_MOVABLE
29 30
30enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, 31enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
@@ -37,6 +38,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
37 FOR_ALL_ZONES(PGSCAN_DIRECT), 38 FOR_ALL_ZONES(PGSCAN_DIRECT),
38 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, 39 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
39 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 40 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_HUGETLB_PAGE
42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
43#endif
40 NR_VM_EVENT_ITEMS 44 NR_VM_EVENT_ITEMS
41}; 45};
42 46
@@ -174,7 +178,7 @@ static inline unsigned long node_page_state(int node,
174 zone_page_state(&zones[ZONE_MOVABLE], item); 178 zone_page_state(&zones[ZONE_MOVABLE], item);
175} 179}
176 180
177extern void zone_statistics(struct zonelist *, struct zone *); 181extern void zone_statistics(struct zone *, struct zone *);
178 182
179#else 183#else
180 184