diff options
Diffstat (limited to 'include/linux')
209 files changed, 3568 insertions, 4247 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index bda6f04791d4..b7d81b2a9041 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -20,6 +20,7 @@ header-y += affs_hardblocks.h | |||
20 | header-y += aio_abi.h | 20 | header-y += aio_abi.h |
21 | header-y += arcfb.h | 21 | header-y += arcfb.h |
22 | header-y += atmapi.h | 22 | header-y += atmapi.h |
23 | header-y += atmarp.h | ||
23 | header-y += atmbr2684.h | 24 | header-y += atmbr2684.h |
24 | header-y += atmclip.h | 25 | header-y += atmclip.h |
25 | header-y += atm_eni.h | 26 | header-y += atm_eni.h |
@@ -48,6 +49,7 @@ header-y += coff.h | |||
48 | header-y += comstats.h | 49 | header-y += comstats.h |
49 | header-y += const.h | 50 | header-y += const.h |
50 | header-y += cgroupstats.h | 51 | header-y += cgroupstats.h |
52 | header-y += cramfs_fs.h | ||
51 | header-y += cycx_cfm.h | 53 | header-y += cycx_cfm.h |
52 | header-y += dlmconstants.h | 54 | header-y += dlmconstants.h |
53 | header-y += dlm_device.h | 55 | header-y += dlm_device.h |
@@ -70,10 +72,12 @@ header-y += firewire-constants.h | |||
70 | header-y += fuse.h | 72 | header-y += fuse.h |
71 | header-y += genetlink.h | 73 | header-y += genetlink.h |
72 | header-y += gen_stats.h | 74 | header-y += gen_stats.h |
75 | header-y += gfs2_ondisk.h | ||
73 | header-y += gigaset_dev.h | 76 | header-y += gigaset_dev.h |
74 | header-y += hysdn_if.h | 77 | header-y += hysdn_if.h |
75 | header-y += i2o-dev.h | 78 | header-y += i2o-dev.h |
76 | header-y += i8k.h | 79 | header-y += i8k.h |
80 | header-y += if_addrlabel.h | ||
77 | header-y += if_arcnet.h | 81 | header-y += if_arcnet.h |
78 | header-y += if_bonding.h | 82 | header-y += if_bonding.h |
79 | header-y += if_cablemodem.h | 83 | header-y += if_cablemodem.h |
@@ -91,6 +95,7 @@ header-y += if_tunnel.h | |||
91 | header-y += in6.h | 95 | header-y += in6.h |
92 | header-y += in_route.h | 96 | header-y += in_route.h |
93 | header-y += ioctl.h | 97 | header-y += ioctl.h |
98 | header-y += ip6_tunnel.h | ||
94 | header-y += ipmi_msgdefs.h | 99 | header-y += ipmi_msgdefs.h |
95 | header-y += ipsec.h | 100 | header-y += ipsec.h |
96 | header-y += ipx.h | 101 | header-y += ipx.h |
@@ -117,7 +122,6 @@ header-y += nfs2.h | |||
117 | header-y += nfs4_mount.h | 122 | header-y += nfs4_mount.h |
118 | header-y += nfs_mount.h | 123 | header-y += nfs_mount.h |
119 | header-y += nl80211.h | 124 | header-y += nl80211.h |
120 | header-y += oom.h | ||
121 | header-y += param.h | 125 | header-y += param.h |
122 | header-y += pci_regs.h | 126 | header-y += pci_regs.h |
123 | header-y += pfkeyv2.h | 127 | header-y += pfkeyv2.h |
@@ -166,7 +170,6 @@ unifdef-y += adfs_fs.h | |||
166 | unifdef-y += agpgart.h | 170 | unifdef-y += agpgart.h |
167 | unifdef-y += apm_bios.h | 171 | unifdef-y += apm_bios.h |
168 | unifdef-y += atalk.h | 172 | unifdef-y += atalk.h |
169 | unifdef-y += atmarp.h | ||
170 | unifdef-y += atmdev.h | 173 | unifdef-y += atmdev.h |
171 | unifdef-y += atm.h | 174 | unifdef-y += atm.h |
172 | unifdef-y += atm_tcp.h | 175 | unifdef-y += atm_tcp.h |
@@ -182,7 +185,6 @@ unifdef-y += cm4000_cs.h | |||
182 | unifdef-y += cn_proc.h | 185 | unifdef-y += cn_proc.h |
183 | unifdef-y += coda.h | 186 | unifdef-y += coda.h |
184 | unifdef-y += connector.h | 187 | unifdef-y += connector.h |
185 | unifdef-y += cramfs_fs.h | ||
186 | unifdef-y += cuda.h | 188 | unifdef-y += cuda.h |
187 | unifdef-y += cyclades.h | 189 | unifdef-y += cyclades.h |
188 | unifdef-y += dccp.h | 190 | unifdef-y += dccp.h |
@@ -205,7 +207,6 @@ unifdef-y += futex.h | |||
205 | unifdef-y += fs.h | 207 | unifdef-y += fs.h |
206 | unifdef-y += gameport.h | 208 | unifdef-y += gameport.h |
207 | unifdef-y += generic_serial.h | 209 | unifdef-y += generic_serial.h |
208 | unifdef-y += gfs2_ondisk.h | ||
209 | unifdef-y += hayesesp.h | 210 | unifdef-y += hayesesp.h |
210 | unifdef-y += hdlcdrv.h | 211 | unifdef-y += hdlcdrv.h |
211 | unifdef-y += hdlc.h | 212 | unifdef-y += hdlc.h |
@@ -219,7 +220,6 @@ unifdef-y += i2c-dev.h | |||
219 | unifdef-y += icmp.h | 220 | unifdef-y += icmp.h |
220 | unifdef-y += icmpv6.h | 221 | unifdef-y += icmpv6.h |
221 | unifdef-y += if_addr.h | 222 | unifdef-y += if_addr.h |
222 | unifdef-y += if_addrlabel.h | ||
223 | unifdef-y += if_arp.h | 223 | unifdef-y += if_arp.h |
224 | unifdef-y += if_bridge.h | 224 | unifdef-y += if_bridge.h |
225 | unifdef-y += if_ec.h | 225 | unifdef-y += if_ec.h |
@@ -243,7 +243,6 @@ unifdef-y += ipc.h | |||
243 | unifdef-y += ipmi.h | 243 | unifdef-y += ipmi.h |
244 | unifdef-y += ipv6.h | 244 | unifdef-y += ipv6.h |
245 | unifdef-y += ipv6_route.h | 245 | unifdef-y += ipv6_route.h |
246 | unifdef-y += ip6_tunnel.h | ||
247 | unifdef-y += isdn.h | 246 | unifdef-y += isdn.h |
248 | unifdef-y += isdnif.h | 247 | unifdef-y += isdnif.h |
249 | unifdef-y += isdn_divertif.h | 248 | unifdef-y += isdn_divertif.h |
@@ -347,6 +346,11 @@ unifdef-y += videodev.h | |||
347 | unifdef-y += virtio_config.h | 346 | unifdef-y += virtio_config.h |
348 | unifdef-y += virtio_blk.h | 347 | unifdef-y += virtio_blk.h |
349 | unifdef-y += virtio_net.h | 348 | unifdef-y += virtio_net.h |
349 | unifdef-y += virtio_9p.h | ||
350 | unifdef-y += virtio_balloon.h | ||
351 | unifdef-y += virtio_console.h | ||
352 | unifdef-y += virtio_pci.h | ||
353 | unifdef-y += virtio_ring.h | ||
350 | unifdef-y += vt.h | 354 | unifdef-y += vt.h |
351 | unifdef-y += wait.h | 355 | unifdef-y += wait.h |
352 | unifdef-y += wanrouter.h | 356 | unifdef-y += wanrouter.h |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 2c7e003356ac..41f7ce7edd7a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -79,6 +79,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table); | |||
79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); | 79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); |
80 | 80 | ||
81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | 81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); |
82 | int early_acpi_boot_init(void); | ||
82 | int acpi_boot_init (void); | 83 | int acpi_boot_init (void); |
83 | int acpi_boot_table_init (void); | 84 | int acpi_boot_table_init (void); |
84 | int acpi_numa_init (void); | 85 | int acpi_numa_init (void); |
@@ -235,6 +236,10 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n, | |||
235 | 236 | ||
236 | #else /* CONFIG_ACPI */ | 237 | #else /* CONFIG_ACPI */ |
237 | 238 | ||
239 | static inline int early_acpi_boot_init(void) | ||
240 | { | ||
241 | return 0; | ||
242 | } | ||
238 | static inline int acpi_boot_init(void) | 243 | static inline int acpi_boot_init(void) |
239 | { | 244 | { |
240 | return 0; | 245 | return 0; |
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h index 03e34547d489..661d90d6cf7c 100644 --- a/include/linux/agp_backend.h +++ b/include/linux/agp_backend.h | |||
@@ -30,8 +30,6 @@ | |||
30 | #ifndef _AGP_BACKEND_H | 30 | #ifndef _AGP_BACKEND_H |
31 | #define _AGP_BACKEND_H 1 | 31 | #define _AGP_BACKEND_H 1 |
32 | 32 | ||
33 | #ifdef __KERNEL__ | ||
34 | |||
35 | #ifndef TRUE | 33 | #ifndef TRUE |
36 | #define TRUE 1 | 34 | #define TRUE 1 |
37 | #endif | 35 | #endif |
@@ -111,5 +109,4 @@ extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); | |||
111 | extern void agp_backend_release(struct agp_bridge_data *); | 109 | extern void agp_backend_release(struct agp_bridge_data *); |
112 | extern void agp_flush_chipset(struct agp_bridge_data *); | 110 | extern void agp_flush_chipset(struct agp_bridge_data *); |
113 | 111 | ||
114 | #endif /* __KERNEL__ */ | ||
115 | #endif /* _AGP_BACKEND_H */ | 112 | #endif /* _AGP_BACKEND_H */ |
diff --git a/include/linux/aio.h b/include/linux/aio.h index 0d0b7f629bd3..b51ddd28444e 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
@@ -209,27 +209,8 @@ extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); | |||
209 | extern int aio_put_req(struct kiocb *iocb); | 209 | extern int aio_put_req(struct kiocb *iocb); |
210 | extern void kick_iocb(struct kiocb *iocb); | 210 | extern void kick_iocb(struct kiocb *iocb); |
211 | extern int aio_complete(struct kiocb *iocb, long res, long res2); | 211 | extern int aio_complete(struct kiocb *iocb, long res, long res2); |
212 | extern void __put_ioctx(struct kioctx *ctx); | ||
213 | struct mm_struct; | 212 | struct mm_struct; |
214 | extern void exit_aio(struct mm_struct *mm); | 213 | extern void exit_aio(struct mm_struct *mm); |
215 | extern struct kioctx *lookup_ioctx(unsigned long ctx_id); | ||
216 | extern int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | ||
217 | struct iocb *iocb); | ||
218 | |||
219 | /* semi private, but used by the 32bit emulations: */ | ||
220 | struct kioctx *lookup_ioctx(unsigned long ctx_id); | ||
221 | int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | ||
222 | struct iocb *iocb); | ||
223 | |||
224 | #define get_ioctx(kioctx) do { \ | ||
225 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | ||
226 | atomic_inc(&(kioctx)->users); \ | ||
227 | } while (0) | ||
228 | #define put_ioctx(kioctx) do { \ | ||
229 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | ||
230 | if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \ | ||
231 | __put_ioctx(kioctx); \ | ||
232 | } while (0) | ||
233 | 214 | ||
234 | #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) | 215 | #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) |
235 | 216 | ||
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h index b2e1ba325b9a..6129e58ca7c9 100644 --- a/include/linux/anon_inodes.h +++ b/include/linux/anon_inodes.h | |||
@@ -8,8 +8,7 @@ | |||
8 | #ifndef _LINUX_ANON_INODES_H | 8 | #ifndef _LINUX_ANON_INODES_H |
9 | #define _LINUX_ANON_INODES_H | 9 | #define _LINUX_ANON_INODES_H |
10 | 10 | ||
11 | int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, | 11 | int anon_inode_getfd(const char *name, const struct file_operations *fops, |
12 | const char *name, const struct file_operations *fops, | ||
13 | void *priv); | 12 | void *priv); |
14 | 13 | ||
15 | #endif /* _LINUX_ANON_INODES_H */ | 14 | #endif /* _LINUX_ANON_INODES_H */ |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 4ccb048cae1d..63c3bb98558f 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -146,7 +146,7 @@ | |||
146 | /* Rule structure sizes -- if these change, different AUDIT_ADD and | 146 | /* Rule structure sizes -- if these change, different AUDIT_ADD and |
147 | * AUDIT_LIST commands must be implemented. */ | 147 | * AUDIT_LIST commands must be implemented. */ |
148 | #define AUDIT_MAX_FIELDS 64 | 148 | #define AUDIT_MAX_FIELDS 64 |
149 | #define AUDIT_MAX_KEY_LEN 32 | 149 | #define AUDIT_MAX_KEY_LEN 256 |
150 | #define AUDIT_BITMASK_SIZE 64 | 150 | #define AUDIT_BITMASK_SIZE 64 |
151 | #define AUDIT_WORD(nr) ((__u32)((nr)/32)) | 151 | #define AUDIT_WORD(nr) ((__u32)((nr)/32)) |
152 | #define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) | 152 | #define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) |
@@ -209,6 +209,7 @@ | |||
209 | #define AUDIT_WATCH 105 | 209 | #define AUDIT_WATCH 105 |
210 | #define AUDIT_PERM 106 | 210 | #define AUDIT_PERM 106 |
211 | #define AUDIT_DIR 107 | 211 | #define AUDIT_DIR 107 |
212 | #define AUDIT_FILETYPE 108 | ||
212 | 213 | ||
213 | #define AUDIT_ARG0 200 | 214 | #define AUDIT_ARG0 200 |
214 | #define AUDIT_ARG1 (AUDIT_ARG0+1) | 215 | #define AUDIT_ARG1 (AUDIT_ARG0+1) |
@@ -549,16 +550,20 @@ extern void audit_log_format(struct audit_buffer *ab, | |||
549 | const char *fmt, ...) | 550 | const char *fmt, ...) |
550 | __attribute__((format(printf,2,3))); | 551 | __attribute__((format(printf,2,3))); |
551 | extern void audit_log_end(struct audit_buffer *ab); | 552 | extern void audit_log_end(struct audit_buffer *ab); |
552 | extern void audit_log_hex(struct audit_buffer *ab, | ||
553 | const unsigned char *buf, | ||
554 | size_t len); | ||
555 | extern int audit_string_contains_control(const char *string, | 553 | extern int audit_string_contains_control(const char *string, |
556 | size_t len); | 554 | size_t len); |
555 | extern void audit_log_n_hex(struct audit_buffer *ab, | ||
556 | const unsigned char *buf, | ||
557 | size_t len); | ||
558 | extern void audit_log_n_string(struct audit_buffer *ab, | ||
559 | const char *buf, | ||
560 | size_t n); | ||
561 | #define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b)); | ||
562 | extern void audit_log_n_untrustedstring(struct audit_buffer *ab, | ||
563 | const char *string, | ||
564 | size_t n); | ||
557 | extern void audit_log_untrustedstring(struct audit_buffer *ab, | 565 | extern void audit_log_untrustedstring(struct audit_buffer *ab, |
558 | const char *string); | 566 | const char *string); |
559 | extern void audit_log_n_untrustedstring(struct audit_buffer *ab, | ||
560 | size_t n, | ||
561 | const char *string); | ||
562 | extern void audit_log_d_path(struct audit_buffer *ab, | 567 | extern void audit_log_d_path(struct audit_buffer *ab, |
563 | const char *prefix, | 568 | const char *prefix, |
564 | struct path *path); | 569 | struct path *path); |
@@ -569,7 +574,8 @@ extern int audit_update_lsm_rules(void); | |||
569 | extern int audit_filter_user(struct netlink_skb_parms *cb, int type); | 574 | extern int audit_filter_user(struct netlink_skb_parms *cb, int type); |
570 | extern int audit_filter_type(int type); | 575 | extern int audit_filter_type(int type); |
571 | extern int audit_receive_filter(int type, int pid, int uid, int seq, | 576 | extern int audit_receive_filter(int type, int pid, int uid, int seq, |
572 | void *data, size_t datasz, uid_t loginuid, u32 sid); | 577 | void *data, size_t datasz, uid_t loginuid, |
578 | u32 sessionid, u32 sid); | ||
573 | extern int audit_enabled; | 579 | extern int audit_enabled; |
574 | #else | 580 | #else |
575 | #define audit_log(c,g,t,f,...) do { ; } while (0) | 581 | #define audit_log(c,g,t,f,...) do { ; } while (0) |
@@ -577,9 +583,11 @@ extern int audit_enabled; | |||
577 | #define audit_log_vformat(b,f,a) do { ; } while (0) | 583 | #define audit_log_vformat(b,f,a) do { ; } while (0) |
578 | #define audit_log_format(b,f,...) do { ; } while (0) | 584 | #define audit_log_format(b,f,...) do { ; } while (0) |
579 | #define audit_log_end(b) do { ; } while (0) | 585 | #define audit_log_end(b) do { ; } while (0) |
580 | #define audit_log_hex(a,b,l) do { ; } while (0) | 586 | #define audit_log_n_hex(a,b,l) do { ; } while (0) |
581 | #define audit_log_untrustedstring(a,s) do { ; } while (0) | 587 | #define audit_log_n_string(a,c,l) do { ; } while (0) |
588 | #define audit_log_string(a,c) do { ; } while (0) | ||
582 | #define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) | 589 | #define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) |
590 | #define audit_log_untrustedstring(a,s) do { ; } while (0) | ||
583 | #define audit_log_d_path(b, p, d) do { ; } while (0) | 591 | #define audit_log_d_path(b, p, d) do { ; } while (0) |
584 | #define audit_enabled 0 | 592 | #define audit_enabled 0 |
585 | #endif | 593 | #endif |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 48a62baace58..0a24d5550eb3 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -11,9 +11,13 @@ | |||
11 | #include <linux/percpu_counter.h> | 11 | #include <linux/percpu_counter.h> |
12 | #include <linux/log2.h> | 12 | #include <linux/log2.h> |
13 | #include <linux/proportions.h> | 13 | #include <linux/proportions.h> |
14 | #include <linux/kernel.h> | ||
15 | #include <linux/fs.h> | ||
14 | #include <asm/atomic.h> | 16 | #include <asm/atomic.h> |
15 | 17 | ||
16 | struct page; | 18 | struct page; |
19 | struct device; | ||
20 | struct dentry; | ||
17 | 21 | ||
18 | /* | 22 | /* |
19 | * Bits in backing_dev_info.state | 23 | * Bits in backing_dev_info.state |
@@ -48,11 +52,26 @@ struct backing_dev_info { | |||
48 | 52 | ||
49 | struct prop_local_percpu completions; | 53 | struct prop_local_percpu completions; |
50 | int dirty_exceeded; | 54 | int dirty_exceeded; |
55 | |||
56 | unsigned int min_ratio; | ||
57 | unsigned int max_ratio, max_prop_frac; | ||
58 | |||
59 | struct device *dev; | ||
60 | |||
61 | #ifdef CONFIG_DEBUG_FS | ||
62 | struct dentry *debug_dir; | ||
63 | struct dentry *debug_stats; | ||
64 | #endif | ||
51 | }; | 65 | }; |
52 | 66 | ||
53 | int bdi_init(struct backing_dev_info *bdi); | 67 | int bdi_init(struct backing_dev_info *bdi); |
54 | void bdi_destroy(struct backing_dev_info *bdi); | 68 | void bdi_destroy(struct backing_dev_info *bdi); |
55 | 69 | ||
70 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | ||
71 | const char *fmt, ...); | ||
72 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | ||
73 | void bdi_unregister(struct backing_dev_info *bdi); | ||
74 | |||
56 | static inline void __add_bdi_stat(struct backing_dev_info *bdi, | 75 | static inline void __add_bdi_stat(struct backing_dev_info *bdi, |
57 | enum bdi_stat_item item, s64 amount) | 76 | enum bdi_stat_item item, s64 amount) |
58 | { | 77 | { |
@@ -116,6 +135,8 @@ static inline s64 bdi_stat_sum(struct backing_dev_info *bdi, | |||
116 | return sum; | 135 | return sum; |
117 | } | 136 | } |
118 | 137 | ||
138 | extern void bdi_writeout_inc(struct backing_dev_info *bdi); | ||
139 | |||
119 | /* | 140 | /* |
120 | * maximal error of a stat counter. | 141 | * maximal error of a stat counter. |
121 | */ | 142 | */ |
@@ -128,24 +149,48 @@ static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi) | |||
128 | #endif | 149 | #endif |
129 | } | 150 | } |
130 | 151 | ||
152 | int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio); | ||
153 | int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); | ||
154 | |||
131 | /* | 155 | /* |
132 | * Flags in backing_dev_info::capability | 156 | * Flags in backing_dev_info::capability |
133 | * - The first two flags control whether dirty pages will contribute to the | 157 | * |
134 | * VM's accounting and whether writepages() should be called for dirty pages | 158 | * The first three flags control whether dirty pages will contribute to the |
135 | * (something that would not, for example, be appropriate for ramfs) | 159 | * VM's accounting and whether writepages() should be called for dirty pages |
136 | * - These flags let !MMU mmap() govern direct device mapping vs immediate | 160 | * (something that would not, for example, be appropriate for ramfs) |
137 | * copying more easily for MAP_PRIVATE, especially for ROM filesystems | 161 | * |
162 | * WARNING: these flags are closely related and should not normally be | ||
163 | * used separately. The BDI_CAP_NO_ACCT_AND_WRITEBACK combines these | ||
164 | * three flags into a single convenience macro. | ||
165 | * | ||
166 | * BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting | ||
167 | * BDI_CAP_NO_WRITEBACK: Don't write pages back | ||
168 | * BDI_CAP_NO_ACCT_WB: Don't automatically account writeback pages | ||
169 | * | ||
170 | * These flags let !MMU mmap() govern direct device mapping vs immediate | ||
171 | * copying more easily for MAP_PRIVATE, especially for ROM filesystems. | ||
172 | * | ||
173 | * BDI_CAP_MAP_COPY: Copy can be mapped (MAP_PRIVATE) | ||
174 | * BDI_CAP_MAP_DIRECT: Can be mapped directly (MAP_SHARED) | ||
175 | * BDI_CAP_READ_MAP: Can be mapped for reading | ||
176 | * BDI_CAP_WRITE_MAP: Can be mapped for writing | ||
177 | * BDI_CAP_EXEC_MAP: Can be mapped for execution | ||
138 | */ | 178 | */ |
139 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 /* Dirty pages shouldn't contribute to accounting */ | 179 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 |
140 | #define BDI_CAP_NO_WRITEBACK 0x00000002 /* Don't write pages back */ | 180 | #define BDI_CAP_NO_WRITEBACK 0x00000002 |
141 | #define BDI_CAP_MAP_COPY 0x00000004 /* Copy can be mapped (MAP_PRIVATE) */ | 181 | #define BDI_CAP_MAP_COPY 0x00000004 |
142 | #define BDI_CAP_MAP_DIRECT 0x00000008 /* Can be mapped directly (MAP_SHARED) */ | 182 | #define BDI_CAP_MAP_DIRECT 0x00000008 |
143 | #define BDI_CAP_READ_MAP 0x00000010 /* Can be mapped for reading */ | 183 | #define BDI_CAP_READ_MAP 0x00000010 |
144 | #define BDI_CAP_WRITE_MAP 0x00000020 /* Can be mapped for writing */ | 184 | #define BDI_CAP_WRITE_MAP 0x00000020 |
145 | #define BDI_CAP_EXEC_MAP 0x00000040 /* Can be mapped for execution */ | 185 | #define BDI_CAP_EXEC_MAP 0x00000040 |
186 | #define BDI_CAP_NO_ACCT_WB 0x00000080 | ||
187 | |||
146 | #define BDI_CAP_VMFLAGS \ | 188 | #define BDI_CAP_VMFLAGS \ |
147 | (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) | 189 | (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) |
148 | 190 | ||
191 | #define BDI_CAP_NO_ACCT_AND_WRITEBACK \ | ||
192 | (BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB) | ||
193 | |||
149 | #if defined(VM_MAYREAD) && \ | 194 | #if defined(VM_MAYREAD) && \ |
150 | (BDI_CAP_READ_MAP != VM_MAYREAD || \ | 195 | (BDI_CAP_READ_MAP != VM_MAYREAD || \ |
151 | BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ | 196 | BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ |
@@ -156,9 +201,7 @@ static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi) | |||
156 | extern struct backing_dev_info default_backing_dev_info; | 201 | extern struct backing_dev_info default_backing_dev_info; |
157 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); | 202 | void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); |
158 | 203 | ||
159 | int writeback_acquire(struct backing_dev_info *bdi); | ||
160 | int writeback_in_progress(struct backing_dev_info *bdi); | 204 | int writeback_in_progress(struct backing_dev_info *bdi); |
161 | void writeback_release(struct backing_dev_info *bdi); | ||
162 | 205 | ||
163 | static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits) | 206 | static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits) |
164 | { | 207 | { |
@@ -187,17 +230,32 @@ void clear_bdi_congested(struct backing_dev_info *bdi, int rw); | |||
187 | void set_bdi_congested(struct backing_dev_info *bdi, int rw); | 230 | void set_bdi_congested(struct backing_dev_info *bdi, int rw); |
188 | long congestion_wait(int rw, long timeout); | 231 | long congestion_wait(int rw, long timeout); |
189 | 232 | ||
190 | #define bdi_cap_writeback_dirty(bdi) \ | ||
191 | (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) | ||
192 | 233 | ||
193 | #define bdi_cap_account_dirty(bdi) \ | 234 | static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) |
194 | (!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY)) | 235 | { |
236 | return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK); | ||
237 | } | ||
238 | |||
239 | static inline bool bdi_cap_account_dirty(struct backing_dev_info *bdi) | ||
240 | { | ||
241 | return !(bdi->capabilities & BDI_CAP_NO_ACCT_DIRTY); | ||
242 | } | ||
195 | 243 | ||
196 | #define mapping_cap_writeback_dirty(mapping) \ | 244 | static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi) |
197 | bdi_cap_writeback_dirty((mapping)->backing_dev_info) | 245 | { |
246 | /* Paranoia: BDI_CAP_NO_WRITEBACK implies BDI_CAP_NO_ACCT_WB */ | ||
247 | return !(bdi->capabilities & (BDI_CAP_NO_ACCT_WB | | ||
248 | BDI_CAP_NO_WRITEBACK)); | ||
249 | } | ||
198 | 250 | ||
199 | #define mapping_cap_account_dirty(mapping) \ | 251 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) |
200 | bdi_cap_account_dirty((mapping)->backing_dev_info) | 252 | { |
253 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); | ||
254 | } | ||
201 | 255 | ||
256 | static inline bool mapping_cap_account_dirty(struct address_space *mapping) | ||
257 | { | ||
258 | return bdi_cap_account_dirty(mapping->backing_dev_info); | ||
259 | } | ||
202 | 260 | ||
203 | #endif /* _LINUX_BACKING_DEV_H */ | 261 | #endif /* _LINUX_BACKING_DEV_H */ |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index b7fc55ec8d48..b512e48f6d8e 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -34,7 +34,8 @@ struct linux_binprm{ | |||
34 | #endif | 34 | #endif |
35 | struct mm_struct *mm; | 35 | struct mm_struct *mm; |
36 | unsigned long p; /* current top of mem */ | 36 | unsigned long p; /* current top of mem */ |
37 | int sh_bang; | 37 | unsigned int sh_bang:1, |
38 | misc_bang:1; | ||
38 | struct file * file; | 39 | struct file * file; |
39 | int e_uid, e_gid; | 40 | int e_uid, e_gid; |
40 | kernel_cap_t cap_inheritable, cap_permitted; | 41 | kernel_cap_t cap_inheritable, cap_permitted; |
@@ -48,7 +49,6 @@ struct linux_binprm{ | |||
48 | unsigned interp_flags; | 49 | unsigned interp_flags; |
49 | unsigned interp_data; | 50 | unsigned interp_data; |
50 | unsigned long loader, exec; | 51 | unsigned long loader, exec; |
51 | unsigned long argv_len; | ||
52 | }; | 52 | }; |
53 | 53 | ||
54 | #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 | 54 | #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 |
diff --git a/include/linux/bio.h b/include/linux/bio.h index d259690863fb..61c15eaf3fb3 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -324,6 +324,8 @@ extern struct bio *bio_map_user_iov(struct request_queue *, | |||
324 | extern void bio_unmap_user(struct bio *); | 324 | extern void bio_unmap_user(struct bio *); |
325 | extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, | 325 | extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, |
326 | gfp_t); | 326 | gfp_t); |
327 | extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, | ||
328 | gfp_t, int); | ||
327 | extern void bio_set_pages_dirty(struct bio *bio); | 329 | extern void bio_set_pages_dirty(struct bio *bio); |
328 | extern void bio_check_pages_dirty(struct bio *bio); | 330 | extern void bio_check_pages_dirty(struct bio *bio); |
329 | extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); | 331 | extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); |
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); |
122 | extern int bitmap_bitremap(int oldbit, | 124 | extern 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); |
126 | extern void bitmap_onto(unsigned long *dst, const unsigned long *orig, | ||
127 | const unsigned long *relmap, int bits); | ||
128 | extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, | ||
129 | int sz, int bits); | ||
124 | extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); | 130 | extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); |
125 | extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); | 131 | extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); |
126 | extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); | 132 | extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 48bde600a2db..024f2b027244 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -6,8 +6,8 @@ | |||
6 | #define BIT(nr) (1UL << (nr)) | 6 | #define BIT(nr) (1UL << (nr)) |
7 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) | 7 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) |
8 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) | 8 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) |
9 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG) | ||
10 | #define BITS_PER_BYTE 8 | 9 | #define BITS_PER_BYTE 8 |
10 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) | ||
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | /* | 13 | /* |
@@ -114,8 +114,6 @@ static inline unsigned fls_long(unsigned long l) | |||
114 | 114 | ||
115 | #ifdef __KERNEL__ | 115 | #ifdef __KERNEL__ |
116 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | 116 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT |
117 | extern unsigned long __find_first_bit(const unsigned long *addr, | ||
118 | unsigned long size); | ||
119 | 117 | ||
120 | /** | 118 | /** |
121 | * find_first_bit - find the first set bit in a memory region | 119 | * find_first_bit - find the first set bit in a memory region |
@@ -124,28 +122,8 @@ extern unsigned long __find_first_bit(const unsigned long *addr, | |||
124 | * | 122 | * |
125 | * Returns the bit number of the first set bit. | 123 | * Returns the bit number of the first set bit. |
126 | */ | 124 | */ |
127 | static __always_inline unsigned long | 125 | extern unsigned long find_first_bit(const unsigned long *addr, |
128 | find_first_bit(const unsigned long *addr, unsigned long size) | 126 | unsigned long size); |
129 | { | ||
130 | /* Avoid a function call if the bitmap size is a constant */ | ||
131 | /* and not bigger than BITS_PER_LONG. */ | ||
132 | |||
133 | /* insert a sentinel so that __ffs returns size if there */ | ||
134 | /* are no set bits in the bitmap */ | ||
135 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) | ||
136 | return __ffs((*addr) | (1ul << size)); | ||
137 | |||
138 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
139 | /* handled separately */ | ||
140 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) | ||
141 | return ((*addr) == 0) ? BITS_PER_LONG : __ffs(*addr); | ||
142 | |||
143 | /* size is not constant or too big */ | ||
144 | return __find_first_bit(addr, size); | ||
145 | } | ||
146 | |||
147 | extern unsigned long __find_first_zero_bit(const unsigned long *addr, | ||
148 | unsigned long size); | ||
149 | 127 | ||
150 | /** | 128 | /** |
151 | * find_first_zero_bit - find the first cleared bit in a memory region | 129 | * find_first_zero_bit - find the first cleared bit in a memory region |
@@ -154,31 +132,12 @@ extern unsigned long __find_first_zero_bit(const unsigned long *addr, | |||
154 | * | 132 | * |
155 | * Returns the bit number of the first cleared bit. | 133 | * Returns the bit number of the first cleared bit. |
156 | */ | 134 | */ |
157 | static __always_inline unsigned long | 135 | extern unsigned long find_first_zero_bit(const unsigned long *addr, |
158 | find_first_zero_bit(const unsigned long *addr, unsigned long size) | 136 | unsigned long size); |
159 | { | 137 | |
160 | /* Avoid a function call if the bitmap size is a constant */ | ||
161 | /* and not bigger than BITS_PER_LONG. */ | ||
162 | |||
163 | /* insert a sentinel so that __ffs returns size if there */ | ||
164 | /* are no set bits in the bitmap */ | ||
165 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
166 | return __ffs(~(*addr) | (1ul << size)); | ||
167 | } | ||
168 | |||
169 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
170 | /* handled separately */ | ||
171 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) | ||
172 | return (~(*addr) == 0) ? BITS_PER_LONG : __ffs(~(*addr)); | ||
173 | |||
174 | /* size is not constant or too big */ | ||
175 | return __find_first_zero_bit(addr, size); | ||
176 | } | ||
177 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | 138 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ |
178 | 139 | ||
179 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT | 140 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT |
180 | extern unsigned long __find_next_bit(const unsigned long *addr, | ||
181 | unsigned long size, unsigned long offset); | ||
182 | 141 | ||
183 | /** | 142 | /** |
184 | * find_next_bit - find the next set bit in a memory region | 143 | * find_next_bit - find the next set bit in a memory region |
@@ -186,36 +145,8 @@ extern unsigned long __find_next_bit(const unsigned long *addr, | |||
186 | * @offset: The bitnumber to start searching at | 145 | * @offset: The bitnumber to start searching at |
187 | * @size: The bitmap size in bits | 146 | * @size: The bitmap size in bits |
188 | */ | 147 | */ |
189 | static __always_inline unsigned long | 148 | extern unsigned long find_next_bit(const unsigned long *addr, |
190 | find_next_bit(const unsigned long *addr, unsigned long size, | 149 | unsigned long size, unsigned long offset); |
191 | unsigned long offset) | ||
192 | { | ||
193 | unsigned long value; | ||
194 | |||
195 | /* Avoid a function call if the bitmap size is a constant */ | ||
196 | /* and not bigger than BITS_PER_LONG. */ | ||
197 | |||
198 | /* insert a sentinel so that __ffs returns size if there */ | ||
199 | /* are no set bits in the bitmap */ | ||
200 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
201 | value = (*addr) & ((~0ul) << offset); | ||
202 | value |= (1ul << size); | ||
203 | return __ffs(value); | ||
204 | } | ||
205 | |||
206 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
207 | /* handled separately */ | ||
208 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) { | ||
209 | value = (*addr) & ((~0ul) << offset); | ||
210 | return (value == 0) ? BITS_PER_LONG : __ffs(value); | ||
211 | } | ||
212 | |||
213 | /* size is not constant or too big */ | ||
214 | return __find_next_bit(addr, size, offset); | ||
215 | } | ||
216 | |||
217 | extern unsigned long __find_next_zero_bit(const unsigned long *addr, | ||
218 | unsigned long size, unsigned long offset); | ||
219 | 150 | ||
220 | /** | 151 | /** |
221 | * find_next_zero_bit - find the next cleared bit in a memory region | 152 | * find_next_zero_bit - find the next cleared bit in a memory region |
@@ -223,33 +154,11 @@ extern unsigned long __find_next_zero_bit(const unsigned long *addr, | |||
223 | * @offset: The bitnumber to start searching at | 154 | * @offset: The bitnumber to start searching at |
224 | * @size: The bitmap size in bits | 155 | * @size: The bitmap size in bits |
225 | */ | 156 | */ |
226 | static __always_inline unsigned long | 157 | |
227 | find_next_zero_bit(const unsigned long *addr, unsigned long size, | 158 | extern unsigned long find_next_zero_bit(const unsigned long *addr, |
228 | unsigned long offset) | 159 | unsigned long size, |
229 | { | 160 | unsigned long offset); |
230 | unsigned long value; | 161 | |
231 | |||
232 | /* Avoid a function call if the bitmap size is a constant */ | ||
233 | /* and not bigger than BITS_PER_LONG. */ | ||
234 | |||
235 | /* insert a sentinel so that __ffs returns size if there */ | ||
236 | /* are no set bits in the bitmap */ | ||
237 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
238 | value = (~(*addr)) & ((~0ul) << offset); | ||
239 | value |= (1ul << size); | ||
240 | return __ffs(value); | ||
241 | } | ||
242 | |||
243 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
244 | /* handled separately */ | ||
245 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) { | ||
246 | value = (~(*addr)) & ((~0ul) << offset); | ||
247 | return (value == 0) ? BITS_PER_LONG : __ffs(value); | ||
248 | } | ||
249 | |||
250 | /* size is not constant or too big */ | ||
251 | return __find_next_zero_bit(addr, size, offset); | ||
252 | } | ||
253 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ | 162 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ |
254 | #endif /* __KERNEL__ */ | 163 | #endif /* __KERNEL__ */ |
255 | #endif | 164 | #endif |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c5065e3d2ca9..d2a1b71e93c3 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -215,8 +215,9 @@ struct request { | |||
215 | /* | 215 | /* |
216 | * when request is used as a packet command carrier | 216 | * when request is used as a packet command carrier |
217 | */ | 217 | */ |
218 | unsigned int cmd_len; | 218 | unsigned short cmd_len; |
219 | unsigned char cmd[BLK_MAX_CDB]; | 219 | unsigned char __cmd[BLK_MAX_CDB]; |
220 | unsigned char *cmd; | ||
220 | 221 | ||
221 | unsigned int data_len; | 222 | unsigned int data_len; |
222 | unsigned int extra_len; /* length of alignment and padding */ | 223 | unsigned int extra_len; /* length of alignment and padding */ |
@@ -407,6 +408,41 @@ struct request_queue | |||
407 | #define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ | 408 | #define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ |
408 | #define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ | 409 | #define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ |
409 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ | 410 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ |
411 | #define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ | ||
412 | |||
413 | static inline int queue_is_locked(struct request_queue *q) | ||
414 | { | ||
415 | #ifdef CONFIG_SMP | ||
416 | spinlock_t *lock = q->queue_lock; | ||
417 | return lock && spin_is_locked(lock); | ||
418 | #else | ||
419 | return 1; | ||
420 | #endif | ||
421 | } | ||
422 | |||
423 | static inline void queue_flag_set_unlocked(unsigned int flag, | ||
424 | struct request_queue *q) | ||
425 | { | ||
426 | __set_bit(flag, &q->queue_flags); | ||
427 | } | ||
428 | |||
429 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) | ||
430 | { | ||
431 | WARN_ON_ONCE(!queue_is_locked(q)); | ||
432 | __set_bit(flag, &q->queue_flags); | ||
433 | } | ||
434 | |||
435 | static inline void queue_flag_clear_unlocked(unsigned int flag, | ||
436 | struct request_queue *q) | ||
437 | { | ||
438 | __clear_bit(flag, &q->queue_flags); | ||
439 | } | ||
440 | |||
441 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | ||
442 | { | ||
443 | WARN_ON_ONCE(!queue_is_locked(q)); | ||
444 | __clear_bit(flag, &q->queue_flags); | ||
445 | } | ||
410 | 446 | ||
411 | enum { | 447 | enum { |
412 | /* | 448 | /* |
@@ -451,6 +487,7 @@ enum { | |||
451 | #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) | 487 | #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) |
452 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) | 488 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) |
453 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) | 489 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) |
490 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) | ||
454 | #define blk_queue_flushing(q) ((q)->ordseq) | 491 | #define blk_queue_flushing(q) ((q)->ordseq) |
455 | 492 | ||
456 | #define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) | 493 | #define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) |
@@ -496,17 +533,17 @@ static inline int blk_queue_full(struct request_queue *q, int rw) | |||
496 | static inline void blk_set_queue_full(struct request_queue *q, int rw) | 533 | static inline void blk_set_queue_full(struct request_queue *q, int rw) |
497 | { | 534 | { |
498 | if (rw == READ) | 535 | if (rw == READ) |
499 | set_bit(QUEUE_FLAG_READFULL, &q->queue_flags); | 536 | queue_flag_set(QUEUE_FLAG_READFULL, q); |
500 | else | 537 | else |
501 | set_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); | 538 | queue_flag_set(QUEUE_FLAG_WRITEFULL, q); |
502 | } | 539 | } |
503 | 540 | ||
504 | static inline void blk_clear_queue_full(struct request_queue *q, int rw) | 541 | static inline void blk_clear_queue_full(struct request_queue *q, int rw) |
505 | { | 542 | { |
506 | if (rw == READ) | 543 | if (rw == READ) |
507 | clear_bit(QUEUE_FLAG_READFULL, &q->queue_flags); | 544 | queue_flag_clear(QUEUE_FLAG_READFULL, q); |
508 | else | 545 | else |
509 | clear_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); | 546 | queue_flag_clear(QUEUE_FLAG_WRITEFULL, q); |
510 | } | 547 | } |
511 | 548 | ||
512 | 549 | ||
@@ -583,6 +620,7 @@ extern int blk_register_queue(struct gendisk *disk); | |||
583 | extern void blk_unregister_queue(struct gendisk *disk); | 620 | extern void blk_unregister_queue(struct gendisk *disk); |
584 | extern void register_disk(struct gendisk *dev); | 621 | extern void register_disk(struct gendisk *dev); |
585 | extern void generic_make_request(struct bio *bio); | 622 | extern void generic_make_request(struct bio *bio); |
623 | extern void blk_rq_init(struct request_queue *q, struct request *rq); | ||
586 | extern void blk_put_request(struct request *); | 624 | extern void blk_put_request(struct request *); |
587 | extern void __blk_put_request(struct request_queue *, struct request *); | 625 | extern void __blk_put_request(struct request_queue *, struct request *); |
588 | extern void blk_end_sync_rq(struct request *rq, int error); | 626 | extern void blk_end_sync_rq(struct request *rq, int error); |
@@ -626,6 +664,7 @@ extern void blk_start_queue(struct request_queue *q); | |||
626 | extern void blk_stop_queue(struct request_queue *q); | 664 | extern void blk_stop_queue(struct request_queue *q); |
627 | extern void blk_sync_queue(struct request_queue *q); | 665 | extern void blk_sync_queue(struct request_queue *q); |
628 | extern void __blk_stop_queue(struct request_queue *q); | 666 | extern void __blk_stop_queue(struct request_queue *q); |
667 | extern void __blk_run_queue(struct request_queue *); | ||
629 | extern void blk_run_queue(struct request_queue *); | 668 | extern void blk_run_queue(struct request_queue *); |
630 | extern void blk_start_queueing(struct request_queue *); | 669 | extern void blk_start_queueing(struct request_queue *); |
631 | extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); | 670 | extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); |
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, | |||
101 | extern void free_bootmem_node(pg_data_t *pgdat, | 101 | extern void free_bootmem_node(pg_data_t *pgdat, |
102 | unsigned long addr, | 102 | unsigned long addr, |
103 | unsigned long size); | 103 | unsigned long size); |
104 | extern 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/buffer_head.h b/include/linux/buffer_head.h index 932eb02a2753..82aa36c53ea7 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -225,7 +225,6 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct page *page, | |||
225 | get_block_t get_block); | 225 | get_block_t get_block); |
226 | void block_sync_page(struct page *); | 226 | void block_sync_page(struct page *); |
227 | sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); | 227 | sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); |
228 | int generic_commit_write(struct file *, struct page *, unsigned, unsigned); | ||
229 | int block_truncate_page(struct address_space *, loff_t, get_block_t *); | 228 | int block_truncate_page(struct address_space *, loff_t, get_block_t *); |
230 | int file_fsync(struct file *, struct dentry *, int); | 229 | int file_fsync(struct file *, struct dentry *, int); |
231 | int nobh_write_begin(struct file *, struct address_space *, | 230 | int nobh_write_begin(struct file *, struct address_space *, |
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild index 79bedddfd9ca..1133d5f9d818 100644 --- a/include/linux/byteorder/Kbuild +++ b/include/linux/byteorder/Kbuild | |||
@@ -1,5 +1,3 @@ | |||
1 | header-y += big_endian.h | 1 | unifdef-y += big_endian.h |
2 | header-y += little_endian.h | 2 | unifdef-y += little_endian.h |
3 | |||
4 | unifdef-y += generic.h | ||
5 | unifdef-y += swab.h | 3 | unifdef-y += swab.h |
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index bef87891cb24..961ed4b48d8e 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h | |||
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p) | |||
101 | #define __cpu_to_be16s(x) do {} while (0) | 101 | #define __cpu_to_be16s(x) do {} while (0) |
102 | #define __be16_to_cpus(x) do {} while (0) | 102 | #define __be16_to_cpus(x) do {} while (0) |
103 | 103 | ||
104 | #ifdef __KERNEL__ | ||
104 | #include <linux/byteorder/generic.h> | 105 | #include <linux/byteorder/generic.h> |
106 | #endif | ||
105 | 107 | ||
106 | #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ | 108 | #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ |
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h index d3771551fdd9..0846e6b931ce 100644 --- a/include/linux/byteorder/generic.h +++ b/include/linux/byteorder/generic.h | |||
@@ -82,12 +82,6 @@ | |||
82 | * | 82 | * |
83 | */ | 83 | */ |
84 | 84 | ||
85 | |||
86 | #if defined(__KERNEL__) | ||
87 | /* | ||
88 | * inside the kernel, we can use nicknames; | ||
89 | * outside of it, we must avoid POSIX namespace pollution... | ||
90 | */ | ||
91 | #define cpu_to_le64 __cpu_to_le64 | 85 | #define cpu_to_le64 __cpu_to_le64 |
92 | #define le64_to_cpu __le64_to_cpu | 86 | #define le64_to_cpu __le64_to_cpu |
93 | #define cpu_to_le32 __cpu_to_le32 | 87 | #define cpu_to_le32 __cpu_to_le32 |
@@ -176,6 +170,4 @@ static inline void be64_add_cpu(__be64 *var, u64 val) | |||
176 | *var = cpu_to_be64(be64_to_cpu(*var) + val); | 170 | *var = cpu_to_be64(be64_to_cpu(*var) + val); |
177 | } | 171 | } |
178 | 172 | ||
179 | #endif /* KERNEL */ | ||
180 | |||
181 | #endif /* _LINUX_BYTEORDER_GENERIC_H */ | 173 | #endif /* _LINUX_BYTEORDER_GENERIC_H */ |
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index 86e62b750176..05dc7c35b3b2 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h | |||
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p) | |||
101 | #define __cpu_to_be16s(x) __swab16s((x)) | 101 | #define __cpu_to_be16s(x) __swab16s((x)) |
102 | #define __be16_to_cpus(x) __swab16s((x)) | 102 | #define __be16_to_cpus(x) __swab16s((x)) |
103 | 103 | ||
104 | #ifdef __KERNEL__ | ||
104 | #include <linux/byteorder/generic.h> | 105 | #include <linux/byteorder/generic.h> |
106 | #endif | ||
105 | 107 | ||
106 | #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ | 108 | #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ |
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/calc64.h b/include/linux/calc64.h deleted file mode 100644 index ebf4b8f38d88..000000000000 --- a/include/linux/calc64.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | #ifndef _LINUX_CALC64_H | ||
2 | #define _LINUX_CALC64_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/div64.h> | ||
6 | |||
7 | /* | ||
8 | * This is a generic macro which is used when the architecture | ||
9 | * specific div64.h does not provide a optimized one. | ||
10 | * | ||
11 | * The 64bit dividend is divided by the divisor (data type long), the | ||
12 | * result is returned and the remainder stored in the variable | ||
13 | * referenced by remainder (data type long *). In contrast to the | ||
14 | * do_div macro the dividend is kept intact. | ||
15 | */ | ||
16 | #ifndef div_long_long_rem | ||
17 | #define div_long_long_rem(dividend, divisor, remainder) \ | ||
18 | do_div_llr((dividend), divisor, remainder) | ||
19 | |||
20 | static inline unsigned long do_div_llr(const long long dividend, | ||
21 | const long divisor, long *remainder) | ||
22 | { | ||
23 | u64 result = dividend; | ||
24 | |||
25 | *(remainder) = do_div(result, divisor); | ||
26 | return (unsigned long) result; | ||
27 | } | ||
28 | #endif | ||
29 | |||
30 | /* | ||
31 | * Sign aware variation of the above. On some architectures a | ||
32 | * negative dividend leads to an divide overflow exception, which | ||
33 | * is avoided by the sign check. | ||
34 | */ | ||
35 | static inline long div_long_long_rem_signed(const long long dividend, | ||
36 | const long divisor, long *remainder) | ||
37 | { | ||
38 | long res; | ||
39 | |||
40 | if (unlikely(dividend < 0)) { | ||
41 | res = -div_long_long_rem(-dividend, divisor, remainder); | ||
42 | *remainder = -(*remainder); | ||
43 | } else | ||
44 | res = div_long_long_rem(dividend, divisor, remainder); | ||
45 | |||
46 | return res; | ||
47 | } | ||
48 | |||
49 | #endif | ||
diff --git a/include/linux/capability.h b/include/linux/capability.h index 7d50ff6d269f..f4ea0dd9a618 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 |
@@ -364,12 +365,12 @@ typedef struct kernel_cap_struct { | |||
364 | # error Fix up hand-coded capability macro initializers | 365 | # error Fix up hand-coded capability macro initializers |
365 | #else /* HAND-CODED capability initializers */ | 366 | #else /* HAND-CODED capability initializers */ |
366 | 367 | ||
367 | # define CAP_EMPTY_SET {{ 0, 0 }} | 368 | # define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }}) |
368 | # define CAP_FULL_SET {{ ~0, ~0 }} | 369 | # define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }}) |
369 | # define CAP_INIT_EFF_SET {{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }} | 370 | # define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }}) |
370 | # define CAP_FS_SET {{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } } | 371 | # define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } }) |
371 | # define CAP_NFSD_SET {{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ | 372 | # define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ |
372 | CAP_FS_MASK_B1 } } | 373 | CAP_FS_MASK_B1 } }) |
373 | 374 | ||
374 | #endif /* _LINUX_CAPABILITY_U32S != 2 */ | 375 | #endif /* _LINUX_CAPABILITY_U32S != 2 */ |
375 | 376 | ||
@@ -490,8 +491,6 @@ extern const kernel_cap_t __cap_init_eff_set; | |||
490 | int capable(int cap); | 491 | int capable(int cap); |
491 | int __capable(struct task_struct *t, int cap); | 492 | int __capable(struct task_struct *t, int cap); |
492 | 493 | ||
493 | extern 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/cdev.h b/include/linux/cdev.h index 1e29b13d0062..fb4591977b03 100644 --- a/include/linux/cdev.h +++ b/include/linux/cdev.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #ifndef _LINUX_CDEV_H | 1 | #ifndef _LINUX_CDEV_H |
2 | #define _LINUX_CDEV_H | 2 | #define _LINUX_CDEV_H |
3 | #ifdef __KERNEL__ | ||
4 | 3 | ||
5 | #include <linux/kobject.h> | 4 | #include <linux/kobject.h> |
6 | #include <linux/kdev_t.h> | 5 | #include <linux/kdev_t.h> |
@@ -34,4 +33,3 @@ void cd_forget(struct inode *); | |||
34 | extern struct backing_dev_info directly_mappable_cdev_bdi; | 33 | extern struct backing_dev_info directly_mappable_cdev_bdi; |
35 | 34 | ||
36 | #endif | 35 | #endif |
37 | #endif | ||
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index a6a6035a4e1e..e155aa78d859 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -88,6 +88,17 @@ static inline void css_put(struct cgroup_subsys_state *css) | |||
88 | __css_put(css); | 88 | __css_put(css); |
89 | } | 89 | } |
90 | 90 | ||
91 | /* bits in struct cgroup flags field */ | ||
92 | enum { | ||
93 | /* Control Group is dead */ | ||
94 | CGRP_REMOVED, | ||
95 | /* Control Group has previously had a child cgroup or a task, | ||
96 | * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */ | ||
97 | CGRP_RELEASABLE, | ||
98 | /* Control Group requires release notifications to userspace */ | ||
99 | CGRP_NOTIFY_ON_RELEASE, | ||
100 | }; | ||
101 | |||
91 | struct cgroup { | 102 | struct cgroup { |
92 | unsigned long flags; /* "unsigned long" so bitops work */ | 103 | unsigned long flags; /* "unsigned long" so bitops work */ |
93 | 104 | ||
@@ -139,10 +150,10 @@ struct css_set { | |||
139 | struct kref ref; | 150 | struct kref ref; |
140 | 151 | ||
141 | /* | 152 | /* |
142 | * List running through all cgroup groups. Protected by | 153 | * List running through all cgroup groups in the same hash |
143 | * css_set_lock | 154 | * slot. Protected by css_set_lock |
144 | */ | 155 | */ |
145 | struct list_head list; | 156 | struct hlist_node hlist; |
146 | 157 | ||
147 | /* | 158 | /* |
148 | * List running through all tasks using this cgroup | 159 | * List running through all tasks using this cgroup |
@@ -163,7 +174,16 @@ struct css_set { | |||
163 | * during subsystem registration (at boot time). | 174 | * during subsystem registration (at boot time). |
164 | */ | 175 | */ |
165 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; | 176 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; |
177 | }; | ||
178 | |||
179 | /* | ||
180 | * cgroup_map_cb is an abstract callback API for reporting map-valued | ||
181 | * control files | ||
182 | */ | ||
166 | 183 | ||
184 | struct cgroup_map_cb { | ||
185 | int (*fill)(struct cgroup_map_cb *cb, const char *key, u64 value); | ||
186 | void *state; | ||
167 | }; | 187 | }; |
168 | 188 | ||
169 | /* struct cftype: | 189 | /* struct cftype: |
@@ -190,20 +210,51 @@ struct cftype { | |||
190 | struct file *file, | 210 | struct file *file, |
191 | char __user *buf, size_t nbytes, loff_t *ppos); | 211 | char __user *buf, size_t nbytes, loff_t *ppos); |
192 | /* | 212 | /* |
193 | * read_uint() is a shortcut for the common case of returning a | 213 | * read_u64() is a shortcut for the common case of returning a |
194 | * single integer. Use it in place of read() | 214 | * single integer. Use it in place of read() |
195 | */ | 215 | */ |
196 | u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft); | 216 | u64 (*read_u64) (struct cgroup *cgrp, struct cftype *cft); |
217 | /* | ||
218 | * read_s64() is a signed version of read_u64() | ||
219 | */ | ||
220 | s64 (*read_s64) (struct cgroup *cgrp, struct cftype *cft); | ||
221 | /* | ||
222 | * read_map() is used for defining a map of key/value | ||
223 | * pairs. It should call cb->fill(cb, key, value) for each | ||
224 | * entry. The key/value pairs (and their ordering) should not | ||
225 | * change between reboots. | ||
226 | */ | ||
227 | int (*read_map) (struct cgroup *cont, struct cftype *cft, | ||
228 | struct cgroup_map_cb *cb); | ||
229 | /* | ||
230 | * read_seq_string() is used for outputting a simple sequence | ||
231 | * using seqfile. | ||
232 | */ | ||
233 | int (*read_seq_string) (struct cgroup *cont, struct cftype *cft, | ||
234 | struct seq_file *m); | ||
235 | |||
197 | ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, | 236 | ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, |
198 | struct file *file, | 237 | struct file *file, |
199 | const char __user *buf, size_t nbytes, loff_t *ppos); | 238 | const char __user *buf, size_t nbytes, loff_t *ppos); |
200 | 239 | ||
201 | /* | 240 | /* |
202 | * write_uint() is a shortcut for the common case of accepting | 241 | * write_u64() is a shortcut for the common case of accepting |
203 | * a single integer (as parsed by simple_strtoull) from | 242 | * a single integer (as parsed by simple_strtoull) from |
204 | * userspace. Use in place of write(); return 0 or error. | 243 | * userspace. Use in place of write(); return 0 or error. |
205 | */ | 244 | */ |
206 | int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val); | 245 | int (*write_u64) (struct cgroup *cgrp, struct cftype *cft, u64 val); |
246 | /* | ||
247 | * write_s64() is a signed version of write_u64() | ||
248 | */ | ||
249 | int (*write_s64) (struct cgroup *cgrp, struct cftype *cft, s64 val); | ||
250 | |||
251 | /* | ||
252 | * trigger() callback can be used to get some kick from the | ||
253 | * userspace, when the actual string written is not important | ||
254 | * at all. The private field can be used to determine the | ||
255 | * kick type for multiplexing. | ||
256 | */ | ||
257 | int (*trigger)(struct cgroup *cgrp, unsigned int event); | ||
207 | 258 | ||
208 | int (*release) (struct inode *inode, struct file *file); | 259 | int (*release) (struct inode *inode, struct file *file); |
209 | }; | 260 | }; |
@@ -254,6 +305,12 @@ struct cgroup_subsys { | |||
254 | struct cgroup *cgrp); | 305 | struct cgroup *cgrp); |
255 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 306 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
256 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); | 307 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); |
308 | /* | ||
309 | * This routine is called with the task_lock of mm->owner held | ||
310 | */ | ||
311 | void (*mm_owner_changed)(struct cgroup_subsys *ss, | ||
312 | struct cgroup *old, | ||
313 | struct cgroup *new); | ||
257 | int subsys_id; | 314 | int subsys_id; |
258 | int active; | 315 | int active; |
259 | int disabled; | 316 | int disabled; |
@@ -339,4 +396,13 @@ static inline int cgroupstats_build(struct cgroupstats *stats, | |||
339 | 396 | ||
340 | #endif /* !CONFIG_CGROUPS */ | 397 | #endif /* !CONFIG_CGROUPS */ |
341 | 398 | ||
399 | #ifdef CONFIG_MM_OWNER | ||
400 | extern void | ||
401 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new); | ||
402 | #else /* !CONFIG_MM_OWNER */ | ||
403 | static inline void | ||
404 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new) | ||
405 | { | ||
406 | } | ||
407 | #endif /* CONFIG_MM_OWNER */ | ||
342 | #endif /* _LINUX_CGROUP_H */ | 408 | #endif /* _LINUX_CGROUP_H */ |
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 1ddebfc52565..e2877454ec82 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
@@ -42,3 +42,9 @@ SUBSYS(mem_cgroup) | |||
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | /* */ | 44 | /* */ |
45 | |||
46 | #ifdef CONFIG_CGROUP_DEVICE | ||
47 | SUBSYS(devices) | ||
48 | #endif | ||
49 | |||
50 | /* */ | ||
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 35094479ca55..55e434feec99 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -93,6 +93,8 @@ struct clocksource { | |||
93 | #endif | 93 | #endif |
94 | }; | 94 | }; |
95 | 95 | ||
96 | extern struct clocksource *clock; /* current clocksource */ | ||
97 | |||
96 | /* | 98 | /* |
97 | * Clock source flags bits:: | 99 | * Clock source flags bits:: |
98 | */ | 100 | */ |
diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h index 424fe9cf02c4..b3ef0c461578 100644 --- a/include/linux/coda_fs_i.h +++ b/include/linux/coda_fs_i.h | |||
@@ -8,7 +8,6 @@ | |||
8 | #ifndef _LINUX_CODA_FS_I | 8 | #ifndef _LINUX_CODA_FS_I |
9 | #define _LINUX_CODA_FS_I | 9 | #define _LINUX_CODA_FS_I |
10 | 10 | ||
11 | #ifdef __KERNEL__ | ||
12 | #include <linux/types.h> | 11 | #include <linux/types.h> |
13 | #include <linux/list.h> | 12 | #include <linux/list.h> |
14 | #include <linux/coda.h> | 13 | #include <linux/coda.h> |
@@ -52,4 +51,3 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); | |||
52 | void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); | 51 | void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); |
53 | 52 | ||
54 | #endif | 53 | #endif |
55 | #endif | ||
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h index 1c47a34aa794..31b75311e2ca 100644 --- a/include/linux/coda_linux.h +++ b/include/linux/coda_linux.h | |||
@@ -43,9 +43,6 @@ int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); | |||
43 | int coda_setattr(struct dentry *, struct iattr *); | 43 | int coda_setattr(struct dentry *, struct iattr *); |
44 | 44 | ||
45 | /* this file: heloers */ | 45 | /* this file: heloers */ |
46 | static __inline__ struct CodaFid *coda_i2f(struct inode *); | ||
47 | static __inline__ char *coda_i2s(struct inode *); | ||
48 | static __inline__ void coda_flag_inode(struct inode *, int flag); | ||
49 | char *coda_f2s(struct CodaFid *f); | 46 | char *coda_f2s(struct CodaFid *f); |
50 | int coda_isroot(struct inode *i); | 47 | int coda_isroot(struct inode *i); |
51 | int coda_iscontrol(const char *name, size_t length); | 48 | int coda_iscontrol(const char *name, size_t length); |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 8fa7857e153b..cf8d11cad5ae 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -65,10 +65,11 @@ struct compat_timex { | |||
65 | compat_long_t calcnt; | 65 | compat_long_t calcnt; |
66 | compat_long_t errcnt; | 66 | compat_long_t errcnt; |
67 | compat_long_t stbcnt; | 67 | compat_long_t stbcnt; |
68 | compat_int_t tai; | ||
68 | 69 | ||
69 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 70 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; |
70 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 71 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; |
71 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 72 | compat_int_t :32; compat_int_t :32; compat_int_t :32; |
72 | }; | 73 | }; |
73 | 74 | ||
74 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) | 75 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index b2fd7547b58d..5c8351b859f0 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -29,10 +29,11 @@ | |||
29 | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) | 29 | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Force always-inline if the user requests it so via the .config: | 32 | * Force always-inline if the user requests it so via the .config, |
33 | * or if gcc is too old: | ||
33 | */ | 34 | */ |
34 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ | 35 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ |
35 | !defined(CONFIG_OPTIMIZE_INLINING) && (__GNUC__ >= 4) | 36 | !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) |
36 | # define inline inline __attribute__((always_inline)) | 37 | # define inline inline __attribute__((always_inline)) |
37 | # define __inline__ __inline__ __attribute__((always_inline)) | 38 | # define __inline__ __inline__ __attribute__((always_inline)) |
38 | # define __inline __inline __attribute__((always_inline)) | 39 | # define __inline __inline __attribute__((always_inline)) |
diff --git a/include/linux/concap.h b/include/linux/concap.h index 27304651d700..977acb3d1fb2 100644 --- a/include/linux/concap.h +++ b/include/linux/concap.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #ifndef _LINUX_CONCAP_H | 9 | #ifndef _LINUX_CONCAP_H |
10 | #define _LINUX_CONCAP_H | 10 | #define _LINUX_CONCAP_H |
11 | #ifdef __KERNEL__ | 11 | |
12 | #include <linux/skbuff.h> | 12 | #include <linux/skbuff.h> |
13 | #include <linux/netdevice.h> | 13 | #include <linux/netdevice.h> |
14 | 14 | ||
@@ -110,4 +110,3 @@ extern int concap_nop(struct concap_proto *cprot); | |||
110 | */ | 110 | */ |
111 | extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb); | 111 | extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb); |
112 | #endif | 112 | #endif |
113 | #endif | ||
diff --git a/include/linux/configfs.h b/include/linux/configfs.h index 4b287ad9371a..3ae65b1bf90f 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h | |||
@@ -35,8 +35,6 @@ | |||
35 | #ifndef _CONFIGFS_H_ | 35 | #ifndef _CONFIGFS_H_ |
36 | #define _CONFIGFS_H_ | 36 | #define _CONFIGFS_H_ |
37 | 37 | ||
38 | #ifdef __KERNEL__ | ||
39 | |||
40 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
41 | #include <linux/types.h> | 39 | #include <linux/types.h> |
42 | #include <linux/list.h> | 40 | #include <linux/list.h> |
@@ -194,6 +192,4 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys); | |||
194 | int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target); | 192 | int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target); |
195 | void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target); | 193 | void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target); |
196 | 194 | ||
197 | #endif /* __KERNEL__ */ | ||
198 | |||
199 | #endif /* _CONFIGFS_H_ */ | 195 | #endif /* _CONFIGFS_H_ */ |
diff --git a/include/linux/console.h b/include/linux/console.h index a5f88a6a259d..a4f27fbdf549 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -91,6 +91,7 @@ void give_up_console(const struct consw *sw); | |||
91 | #define CON_ENABLED (4) | 91 | #define CON_ENABLED (4) |
92 | #define CON_BOOT (8) | 92 | #define CON_BOOT (8) |
93 | #define CON_ANYTIME (16) /* Safe to call when cpu is offline */ | 93 | #define CON_ANYTIME (16) /* Safe to call when cpu is offline */ |
94 | #define CON_BRL (32) /* Used for a braille device */ | ||
94 | 95 | ||
95 | struct console { | 96 | struct console { |
96 | char name[16]; | 97 | char name[16]; |
@@ -121,6 +122,9 @@ extern struct tty_driver *console_device(int *); | |||
121 | extern void console_stop(struct console *); | 122 | extern void console_stop(struct console *); |
122 | extern void console_start(struct console *); | 123 | extern void console_start(struct console *); |
123 | extern int is_console_locked(void); | 124 | extern int is_console_locked(void); |
125 | extern int braille_register_console(struct console *, int index, | ||
126 | char *console_options, char *braille_options); | ||
127 | extern int braille_unregister_console(struct console *); | ||
124 | 128 | ||
125 | extern int console_suspend_enabled; | 129 | extern int console_suspend_enabled; |
126 | 130 | ||
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index d71f7c0f931b..b03f80a078be 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
@@ -53,6 +53,7 @@ struct vc_data { | |||
53 | unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ | 53 | unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ |
54 | struct console_font vc_font; /* Current VC font set */ | 54 | struct console_font vc_font; /* Current VC font set */ |
55 | unsigned short vc_video_erase_char; /* Background erase character */ | 55 | unsigned short vc_video_erase_char; /* Background erase character */ |
56 | unsigned short vc_scrl_erase_char; /* Erase character for scroll */ | ||
56 | /* VT terminal data */ | 57 | /* VT terminal data */ |
57 | unsigned int vc_state; /* Escape sequence parser state */ | 58 | unsigned int vc_state; /* Escape sequence parser state */ |
58 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ | 59 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index f212fa98283e..7464ba3b4333 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -108,7 +108,7 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex) | |||
108 | extern void get_online_cpus(void); | 108 | extern void get_online_cpus(void); |
109 | extern void put_online_cpus(void); | 109 | extern void put_online_cpus(void); |
110 | #define hotcpu_notifier(fn, pri) { \ | 110 | #define hotcpu_notifier(fn, pri) { \ |
111 | static struct notifier_block fn##_nb = \ | 111 | static struct notifier_block fn##_nb __cpuinitdata = \ |
112 | { .notifier_call = fn, .priority = pri }; \ | 112 | { .notifier_call = fn, .priority = pri }; \ |
113 | register_cpu_notifier(&fn##_nb); \ | 113 | register_cpu_notifier(&fn##_nb); \ |
114 | } | 114 | } |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ddd8652fc3f3..e7e91dbfde0f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -83,7 +83,8 @@ struct cpufreq_real_policy { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | struct cpufreq_policy { | 85 | struct cpufreq_policy { |
86 | cpumask_t cpus; /* affected CPUs */ | 86 | cpumask_t cpus; /* CPUs requiring sw coordination */ |
87 | cpumask_t related_cpus; /* CPUs with any coordination */ | ||
87 | unsigned int shared_type; /* ANY or ALL affected CPUs | 88 | unsigned int shared_type; /* ANY or ALL affected CPUs |
88 | should set cpufreq */ | 89 | should set cpufreq */ |
89 | unsigned int cpu; /* cpu nr of registered CPU */ | 90 | unsigned int cpu; /* cpu nr of registered CPU */ |
@@ -307,6 +308,9 @@ extern struct cpufreq_governor cpufreq_gov_performance; | |||
307 | #endif | 308 | #endif |
308 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE | 309 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE |
309 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) | 310 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) |
311 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE) | ||
312 | extern struct cpufreq_governor cpufreq_gov_powersave; | ||
313 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_powersave) | ||
310 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) | 314 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) |
311 | extern struct cpufreq_governor cpufreq_gov_userspace; | 315 | extern struct cpufreq_governor cpufreq_gov_userspace; |
312 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace) | 316 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace) |
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) | ||
339 | static 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) | ||
347 | static 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) |
27 | void cpuset_init_current_mems_allowed(void); | 27 | void cpuset_init_current_mems_allowed(void); |
28 | void cpuset_update_task_memory_state(void); | 28 | void cpuset_update_task_memory_state(void); |
29 | int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); | 29 | int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); |
30 | 30 | ||
31 | extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask); | 31 | extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask); |
32 | extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask); | 32 | extern 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) | |||
103 | static inline void cpuset_init_current_mems_allowed(void) {} | 103 | static inline void cpuset_init_current_mems_allowed(void) {} |
104 | static inline void cpuset_update_task_memory_state(void) {} | 104 | static inline void cpuset_update_task_memory_state(void) {} |
105 | 105 | ||
106 | static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) | 106 | static 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/crc-ccitt.h b/include/linux/crc-ccitt.h index 90037617da8f..f52696a1ff0d 100644 --- a/include/linux/crc-ccitt.h +++ b/include/linux/crc-ccitt.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #ifndef _LINUX_CRC_CCITT_H | 1 | #ifndef _LINUX_CRC_CCITT_H |
2 | #define _LINUX_CRC_CCITT_H | 2 | #define _LINUX_CRC_CCITT_H |
3 | #ifdef __KERNEL__ | ||
4 | 3 | ||
5 | #include <linux/types.h> | 4 | #include <linux/types.h> |
6 | 5 | ||
@@ -13,5 +12,4 @@ static inline u16 crc_ccitt_byte(u16 crc, const u8 c) | |||
13 | return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; | 12 | return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; |
14 | } | 13 | } |
15 | 14 | ||
16 | #endif /* __KERNEL__ */ | ||
17 | #endif /* _LINUX_CRC_CCITT_H */ | 15 | #endif /* _LINUX_CRC_CCITT_H */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index cfb1627ac51c..2a6639407c80 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef __LINUX_DCACHE_H | 1 | #ifndef __LINUX_DCACHE_H |
2 | #define __LINUX_DCACHE_H | 2 | #define __LINUX_DCACHE_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <asm/atomic.h> | 4 | #include <asm/atomic.h> |
7 | #include <linux/list.h> | 5 | #include <linux/list.h> |
8 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
@@ -365,6 +363,4 @@ extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); | |||
365 | 363 | ||
366 | extern int sysctl_vfs_cache_pressure; | 364 | extern int sysctl_vfs_cache_pressure; |
367 | 365 | ||
368 | #endif /* __KERNEL__ */ | ||
369 | |||
370 | #endif /* __LINUX_DCACHE_H */ | 366 | #endif /* __LINUX_DCACHE_H */ |
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h new file mode 100644 index 000000000000..8c243aaa86a7 --- /dev/null +++ b/include/linux/debugobjects.h | |||
@@ -0,0 +1,90 @@ | |||
1 | #ifndef _LINUX_DEBUGOBJECTS_H | ||
2 | #define _LINUX_DEBUGOBJECTS_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | #include <linux/spinlock.h> | ||
6 | |||
7 | enum debug_obj_state { | ||
8 | ODEBUG_STATE_NONE, | ||
9 | ODEBUG_STATE_INIT, | ||
10 | ODEBUG_STATE_INACTIVE, | ||
11 | ODEBUG_STATE_ACTIVE, | ||
12 | ODEBUG_STATE_DESTROYED, | ||
13 | ODEBUG_STATE_NOTAVAILABLE, | ||
14 | ODEBUG_STATE_MAX, | ||
15 | }; | ||
16 | |||
17 | struct debug_obj_descr; | ||
18 | |||
19 | /** | ||
20 | * struct debug_obj - representaion of an tracked object | ||
21 | * @node: hlist node to link the object into the tracker list | ||
22 | * @state: tracked object state | ||
23 | * @object: pointer to the real object | ||
24 | * @descr: pointer to an object type specific debug description structure | ||
25 | */ | ||
26 | struct debug_obj { | ||
27 | struct hlist_node node; | ||
28 | enum debug_obj_state state; | ||
29 | void *object; | ||
30 | struct debug_obj_descr *descr; | ||
31 | }; | ||
32 | |||
33 | /** | ||
34 | * struct debug_obj_descr - object type specific debug description structure | ||
35 | * @name: name of the object typee | ||
36 | * @fixup_init: fixup function, which is called when the init check | ||
37 | * fails | ||
38 | * @fixup_activate: fixup function, which is called when the activate check | ||
39 | * fails | ||
40 | * @fixup_destroy: fixup function, which is called when the destroy check | ||
41 | * fails | ||
42 | * @fixup_free: fixup function, which is called when the free check | ||
43 | * fails | ||
44 | */ | ||
45 | struct debug_obj_descr { | ||
46 | const char *name; | ||
47 | |||
48 | int (*fixup_init) (void *addr, enum debug_obj_state state); | ||
49 | int (*fixup_activate) (void *addr, enum debug_obj_state state); | ||
50 | int (*fixup_destroy) (void *addr, enum debug_obj_state state); | ||
51 | int (*fixup_free) (void *addr, enum debug_obj_state state); | ||
52 | }; | ||
53 | |||
54 | #ifdef CONFIG_DEBUG_OBJECTS | ||
55 | extern void debug_object_init (void *addr, struct debug_obj_descr *descr); | ||
56 | extern void | ||
57 | debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr); | ||
58 | extern void debug_object_activate (void *addr, struct debug_obj_descr *descr); | ||
59 | extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); | ||
60 | extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); | ||
61 | extern void debug_object_free (void *addr, struct debug_obj_descr *descr); | ||
62 | |||
63 | extern void debug_objects_early_init(void); | ||
64 | extern void debug_objects_mem_init(void); | ||
65 | #else | ||
66 | static inline void | ||
67 | debug_object_init (void *addr, struct debug_obj_descr *descr) { } | ||
68 | static inline void | ||
69 | debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { } | ||
70 | static inline void | ||
71 | debug_object_activate (void *addr, struct debug_obj_descr *descr) { } | ||
72 | static inline void | ||
73 | debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { } | ||
74 | static inline void | ||
75 | debug_object_destroy (void *addr, struct debug_obj_descr *descr) { } | ||
76 | static inline void | ||
77 | debug_object_free (void *addr, struct debug_obj_descr *descr) { } | ||
78 | |||
79 | static inline void debug_objects_early_init(void) { } | ||
80 | static inline void debug_objects_mem_init(void) { } | ||
81 | #endif | ||
82 | |||
83 | #ifdef CONFIG_DEBUG_OBJECTS_FREE | ||
84 | extern void debug_check_no_obj_freed(const void *address, unsigned long size); | ||
85 | #else | ||
86 | static inline void | ||
87 | debug_check_no_obj_freed(const void *address, unsigned long size) { } | ||
88 | #endif | ||
89 | |||
90 | #endif | ||
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index ad3b787479a4..0d8d419d191a 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -8,8 +8,6 @@ | |||
8 | #ifndef _LINUX_DEVICE_MAPPER_H | 8 | #ifndef _LINUX_DEVICE_MAPPER_H |
9 | #define _LINUX_DEVICE_MAPPER_H | 9 | #define _LINUX_DEVICE_MAPPER_H |
10 | 10 | ||
11 | #ifdef __KERNEL__ | ||
12 | |||
13 | #include <linux/bio.h> | 11 | #include <linux/bio.h> |
14 | 12 | ||
15 | struct dm_target; | 13 | struct dm_target; |
@@ -344,5 +342,4 @@ static inline unsigned long to_bytes(sector_t n) | |||
344 | return (n << SECTOR_SHIFT); | 342 | return (n << SECTOR_SHIFT); |
345 | } | 343 | } |
346 | 344 | ||
347 | #endif /* __KERNEL__ */ | ||
348 | #endif /* _LINUX_DEVICE_MAPPER_H */ | 345 | #endif /* _LINUX_DEVICE_MAPPER_H */ |
diff --git a/include/linux/device.h b/include/linux/device.h index 1a060265acea..8c23e3dfe3ac 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -35,7 +35,6 @@ struct device; | |||
35 | struct device_driver; | 35 | struct device_driver; |
36 | struct driver_private; | 36 | struct driver_private; |
37 | struct class; | 37 | struct class; |
38 | struct class_device; | ||
39 | struct bus_type; | 38 | struct bus_type; |
40 | struct bus_type_private; | 39 | struct bus_type_private; |
41 | 40 | ||
@@ -190,13 +189,10 @@ struct class { | |||
190 | struct kset class_dirs; | 189 | struct kset class_dirs; |
191 | struct semaphore sem; /* locks children, devices, interfaces */ | 190 | struct semaphore sem; /* locks children, devices, interfaces */ |
192 | struct class_attribute *class_attrs; | 191 | struct class_attribute *class_attrs; |
193 | struct class_device_attribute *class_dev_attrs; | ||
194 | struct device_attribute *dev_attrs; | 192 | struct device_attribute *dev_attrs; |
195 | 193 | ||
196 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); | ||
197 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); | 194 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); |
198 | 195 | ||
199 | void (*release)(struct class_device *dev); | ||
200 | void (*class_release)(struct class *class); | 196 | void (*class_release)(struct class *class); |
201 | void (*dev_release)(struct device *dev); | 197 | void (*dev_release)(struct device *dev); |
202 | 198 | ||
@@ -210,9 +206,6 @@ extern int class_for_each_device(struct class *class, void *data, | |||
210 | int (*fn)(struct device *dev, void *data)); | 206 | int (*fn)(struct device *dev, void *data)); |
211 | extern struct device *class_find_device(struct class *class, void *data, | 207 | extern struct device *class_find_device(struct class *class, void *data, |
212 | int (*match)(struct device *, void *)); | 208 | int (*match)(struct device *, void *)); |
213 | extern struct class_device *class_find_child(struct class *class, void *data, | ||
214 | int (*match)(struct class_device *, void *)); | ||
215 | |||
216 | 209 | ||
217 | struct class_attribute { | 210 | struct class_attribute { |
218 | struct attribute attr; | 211 | struct attribute attr; |
@@ -228,92 +221,10 @@ extern int __must_check class_create_file(struct class *class, | |||
228 | extern void class_remove_file(struct class *class, | 221 | extern void class_remove_file(struct class *class, |
229 | const struct class_attribute *attr); | 222 | const struct class_attribute *attr); |
230 | 223 | ||
231 | struct class_device_attribute { | ||
232 | struct attribute attr; | ||
233 | ssize_t (*show)(struct class_device *, char *buf); | ||
234 | ssize_t (*store)(struct class_device *, const char *buf, size_t count); | ||
235 | }; | ||
236 | |||
237 | #define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \ | ||
238 | struct class_device_attribute class_device_attr_##_name = \ | ||
239 | __ATTR(_name, _mode, _show, _store) | ||
240 | |||
241 | extern int __must_check class_device_create_file(struct class_device *, | ||
242 | const struct class_device_attribute *); | ||
243 | |||
244 | /** | ||
245 | * struct class_device - class devices | ||
246 | * @class: pointer to the parent class for this class device. This is required. | ||
247 | * @devt: for internal use by the driver core only. | ||
248 | * @node: for internal use by the driver core only. | ||
249 | * @kobj: for internal use by the driver core only. | ||
250 | * @groups: optional additional groups to be created | ||
251 | * @dev: if set, a symlink to the struct device is created in the sysfs | ||
252 | * directory for this struct class device. | ||
253 | * @class_data: pointer to whatever you want to store here for this struct | ||
254 | * class_device. Use class_get_devdata() and class_set_devdata() to get and | ||
255 | * set this pointer. | ||
256 | * @parent: pointer to a struct class_device that is the parent of this struct | ||
257 | * class_device. If NULL, this class_device will show up at the root of the | ||
258 | * struct class in sysfs (which is probably what you want to have happen.) | ||
259 | * @release: pointer to a release function for this struct class_device. If | ||
260 | * set, this will be called instead of the class specific release function. | ||
261 | * Only use this if you want to override the default release function, like | ||
262 | * when you are nesting class_device structures. | ||
263 | * @uevent: pointer to a uevent function for this struct class_device. If | ||
264 | * set, this will be called instead of the class specific uevent function. | ||
265 | * Only use this if you want to override the default uevent function, like | ||
266 | * when you are nesting class_device structures. | ||
267 | */ | ||
268 | struct class_device { | ||
269 | struct list_head node; | ||
270 | |||
271 | struct kobject kobj; | ||
272 | struct class *class; | ||
273 | dev_t devt; | ||
274 | struct device *dev; | ||
275 | void *class_data; | ||
276 | struct class_device *parent; | ||
277 | struct attribute_group **groups; | ||
278 | |||
279 | void (*release)(struct class_device *dev); | ||
280 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); | ||
281 | char class_id[BUS_ID_SIZE]; | ||
282 | }; | ||
283 | |||
284 | static inline void *class_get_devdata(struct class_device *dev) | ||
285 | { | ||
286 | return dev->class_data; | ||
287 | } | ||
288 | |||
289 | static inline void class_set_devdata(struct class_device *dev, void *data) | ||
290 | { | ||
291 | dev->class_data = data; | ||
292 | } | ||
293 | |||
294 | |||
295 | extern int __must_check class_device_register(struct class_device *); | ||
296 | extern void class_device_unregister(struct class_device *); | ||
297 | extern void class_device_initialize(struct class_device *); | ||
298 | extern int __must_check class_device_add(struct class_device *); | ||
299 | extern void class_device_del(struct class_device *); | ||
300 | |||
301 | extern struct class_device *class_device_get(struct class_device *); | ||
302 | extern void class_device_put(struct class_device *); | ||
303 | |||
304 | extern void class_device_remove_file(struct class_device *, | ||
305 | const struct class_device_attribute *); | ||
306 | extern int __must_check class_device_create_bin_file(struct class_device *, | ||
307 | struct bin_attribute *); | ||
308 | extern void class_device_remove_bin_file(struct class_device *, | ||
309 | struct bin_attribute *); | ||
310 | |||
311 | struct class_interface { | 224 | struct class_interface { |
312 | struct list_head node; | 225 | struct list_head node; |
313 | struct class *class; | 226 | struct class *class; |
314 | 227 | ||
315 | int (*add) (struct class_device *, struct class_interface *); | ||
316 | void (*remove) (struct class_device *, struct class_interface *); | ||
317 | int (*add_dev) (struct device *, struct class_interface *); | 228 | int (*add_dev) (struct device *, struct class_interface *); |
318 | void (*remove_dev) (struct device *, struct class_interface *); | 229 | void (*remove_dev) (struct device *, struct class_interface *); |
319 | }; | 230 | }; |
@@ -323,13 +234,6 @@ extern void class_interface_unregister(struct class_interface *); | |||
323 | 234 | ||
324 | extern struct class *class_create(struct module *owner, const char *name); | 235 | extern struct class *class_create(struct module *owner, const char *name); |
325 | extern void class_destroy(struct class *cls); | 236 | extern void class_destroy(struct class *cls); |
326 | extern struct class_device *class_device_create(struct class *cls, | ||
327 | struct class_device *parent, | ||
328 | dev_t devt, | ||
329 | struct device *device, | ||
330 | const char *fmt, ...) | ||
331 | __attribute__((format(printf, 5, 6))); | ||
332 | extern void class_device_destroy(struct class *cls, dev_t devt); | ||
333 | 237 | ||
334 | /* | 238 | /* |
335 | * The type of device, "struct device" is embedded in. A class | 239 | * The type of device, "struct device" is embedded in. A class |
@@ -465,7 +369,6 @@ struct device { | |||
465 | spinlock_t devres_lock; | 369 | spinlock_t devres_lock; |
466 | struct list_head devres_head; | 370 | struct list_head devres_head; |
467 | 371 | ||
468 | /* class_device migration path */ | ||
469 | struct list_head node; | 372 | struct list_head node; |
470 | struct class *class; | 373 | struct class *class; |
471 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 374 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
@@ -477,6 +380,12 @@ struct device { | |||
477 | /* Get the wakeup routines, which depend on struct device */ | 380 | /* Get the wakeup routines, which depend on struct device */ |
478 | #include <linux/pm_wakeup.h> | 381 | #include <linux/pm_wakeup.h> |
479 | 382 | ||
383 | static inline const char *dev_name(struct device *dev) | ||
384 | { | ||
385 | /* will be changed into kobject_name(&dev->kobj) in the near future */ | ||
386 | return dev->bus_id; | ||
387 | } | ||
388 | |||
480 | #ifdef CONFIG_NUMA | 389 | #ifdef CONFIG_NUMA |
481 | static inline int dev_to_node(struct device *dev) | 390 | static inline int dev_to_node(struct device *dev) |
482 | { | 391 | { |
@@ -575,7 +484,7 @@ extern void sysdev_shutdown(void); | |||
575 | extern const char *dev_driver_string(struct device *dev); | 484 | extern const char *dev_driver_string(struct device *dev); |
576 | #define dev_printk(level, dev, format, arg...) \ | 485 | #define dev_printk(level, dev, format, arg...) \ |
577 | printk(level "%s %s: " format , dev_driver_string(dev) , \ | 486 | printk(level "%s %s: " format , dev_driver_string(dev) , \ |
578 | (dev)->bus_id , ## arg) | 487 | dev_name(dev) , ## arg) |
579 | 488 | ||
580 | #define dev_emerg(dev, format, arg...) \ | 489 | #define dev_emerg(dev, format, arg...) \ |
581 | dev_printk(KERN_EMERG , dev , format , ## arg) | 490 | dev_printk(KERN_EMERG , dev , format , ## arg) |
diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h new file mode 100644 index 000000000000..0b0d9c39ed67 --- /dev/null +++ b/include/linux/device_cgroup.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <linux/fs.h> | ||
3 | |||
4 | #ifdef CONFIG_CGROUP_DEVICE | ||
5 | extern int devcgroup_inode_permission(struct inode *inode, int mask); | ||
6 | extern int devcgroup_inode_mknod(int mode, dev_t dev); | ||
7 | #else | ||
8 | static inline int devcgroup_inode_permission(struct inode *inode, int mask) | ||
9 | { return 0; } | ||
10 | static inline int devcgroup_inode_mknod(int mode, dev_t dev) | ||
11 | { return 0; } | ||
12 | #endif | ||
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h index b672ddc00735..154769cad3f3 100644 --- a/include/linux/devpts_fs.h +++ b/include/linux/devpts_fs.h | |||
@@ -17,6 +17,8 @@ | |||
17 | 17 | ||
18 | #ifdef CONFIG_UNIX98_PTYS | 18 | #ifdef CONFIG_UNIX98_PTYS |
19 | 19 | ||
20 | int devpts_new_index(void); | ||
21 | void devpts_kill_index(int idx); | ||
20 | int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ | 22 | int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ |
21 | struct tty_struct *devpts_get_tty(int number); /* get tty structure */ | 23 | struct tty_struct *devpts_get_tty(int number); /* get tty structure */ |
22 | void devpts_pty_kill(int number); /* unlink */ | 24 | void devpts_pty_kill(int number); /* unlink */ |
@@ -24,6 +26,8 @@ void devpts_pty_kill(int number); /* unlink */ | |||
24 | #else | 26 | #else |
25 | 27 | ||
26 | /* Dummy stubs in the no-pty case */ | 28 | /* Dummy stubs in the no-pty case */ |
29 | static inline int devpts_new_index(void) { return -EINVAL; } | ||
30 | static inline void devpts_kill_index(int idx) { } | ||
27 | static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } | 31 | static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } |
28 | static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } | 32 | static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } |
29 | static inline void devpts_pty_kill(int number) { } | 33 | static inline void devpts_pty_kill(int number) { } |
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h new file mode 100644 index 000000000000..1677e2bfa00c --- /dev/null +++ b/include/linux/dma-attrs.h | |||
@@ -0,0 +1,74 @@ | |||
1 | #ifndef _DMA_ATTR_H | ||
2 | #define _DMA_ATTR_H | ||
3 | |||
4 | #include <linux/bitmap.h> | ||
5 | #include <linux/bitops.h> | ||
6 | #include <linux/bug.h> | ||
7 | |||
8 | /** | ||
9 | * an enum dma_attr represents an attribute associated with a DMA | ||
10 | * mapping. The semantics of each attribute should be defined in | ||
11 | * Documentation/DMA-attributes.txt. | ||
12 | */ | ||
13 | enum dma_attr { | ||
14 | DMA_ATTR_WRITE_BARRIER, | ||
15 | DMA_ATTR_MAX, | ||
16 | }; | ||
17 | |||
18 | #define __DMA_ATTRS_LONGS BITS_TO_LONGS(DMA_ATTR_MAX) | ||
19 | |||
20 | /** | ||
21 | * struct dma_attrs - an opaque container for DMA attributes | ||
22 | * @flags - bitmask representing a collection of enum dma_attr | ||
23 | */ | ||
24 | struct dma_attrs { | ||
25 | unsigned long flags[__DMA_ATTRS_LONGS]; | ||
26 | }; | ||
27 | |||
28 | #define DEFINE_DMA_ATTRS(x) \ | ||
29 | struct dma_attrs x = { \ | ||
30 | .flags = { [0 ... __DMA_ATTRS_LONGS-1] = 0 }, \ | ||
31 | } | ||
32 | |||
33 | static inline void init_dma_attrs(struct dma_attrs *attrs) | ||
34 | { | ||
35 | bitmap_zero(attrs->flags, __DMA_ATTRS_LONGS); | ||
36 | } | ||
37 | |||
38 | #ifdef CONFIG_HAVE_DMA_ATTRS | ||
39 | /** | ||
40 | * dma_set_attr - set a specific attribute | ||
41 | * @attr: attribute to set | ||
42 | * @attrs: struct dma_attrs (may be NULL) | ||
43 | */ | ||
44 | static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs) | ||
45 | { | ||
46 | if (attrs == NULL) | ||
47 | return; | ||
48 | BUG_ON(attr >= DMA_ATTR_MAX); | ||
49 | __set_bit(attr, attrs->flags); | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * dma_get_attr - check for a specific attribute | ||
54 | * @attr: attribute to set | ||
55 | * @attrs: struct dma_attrs (may be NULL) | ||
56 | */ | ||
57 | static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs) | ||
58 | { | ||
59 | if (attrs == NULL) | ||
60 | return 0; | ||
61 | BUG_ON(attr >= DMA_ATTR_MAX); | ||
62 | return test_bit(attr, attrs->flags); | ||
63 | } | ||
64 | #else /* !CONFIG_HAVE_DMA_ATTRS */ | ||
65 | static inline void dma_set_attr(enum dma_attr attr, struct dma_attrs *attrs) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | static inline int dma_get_attr(enum dma_attr attr, struct dma_attrs *attrs) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
73 | #endif /* CONFIG_HAVE_DMA_ATTRS */ | ||
74 | #endif /* _DMA_ATTR_H */ | ||
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 332030709623..952e0f857ac9 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -146,4 +146,21 @@ static inline void dmam_release_declared_memory(struct device *dev) | |||
146 | } | 146 | } |
147 | #endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ | 147 | #endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ |
148 | 148 | ||
149 | #ifndef CONFIG_HAVE_DMA_ATTRS | ||
150 | struct dma_attrs; | ||
151 | |||
152 | #define dma_map_single_attrs(dev, cpu_addr, size, dir, attrs) \ | ||
153 | dma_map_single(dev, cpu_addr, size, dir) | ||
154 | |||
155 | #define dma_unmap_single_attrs(dev, dma_addr, size, dir, attrs) \ | ||
156 | dma_unmap_single(dev, dma_addr, size, dir) | ||
157 | |||
158 | #define dma_map_sg_attrs(dev, sgl, nents, dir, attrs) \ | ||
159 | dma_map_sg(dev, sgl, nents, dir) | ||
160 | |||
161 | #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ | ||
162 | dma_unmap_sg(dev, sgl, nents, dir) | ||
163 | |||
164 | #endif /* CONFIG_HAVE_DMA_ATTRS */ | ||
165 | |||
149 | #endif | 166 | #endif |
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; | |||
90 | static inline const char * dmi_get_system_info(int field) { return NULL; } | 90 | static inline const char * dmi_get_system_info(int field) { return NULL; } |
91 | static inline const struct dmi_device * dmi_find_device(int type, const char *name, | 91 | static 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; } |
93 | static inline void dmi_scan_machine(void) { return; } | ||
93 | static inline int dmi_get_year(int year) { return 0; } | 94 | static inline int dmi_get_year(int year) { return 0; } |
94 | static inline int dmi_name_in_vendors(const char *s) { return 0; } | 95 | static 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/edac.h b/include/linux/edac.h index eab451e69a91..7cf92e8a4196 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Author: Dave Jiang <djiang@mvista.com> | 4 | * Author: Dave Jiang <djiang@mvista.com> |
5 | * | 5 | * |
6 | * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under | 6 | * 2006-2008 (c) MontaVista Software, Inc. This file is licensed under |
7 | * the terms of the GNU General Public License version 2. This program | 7 | * the terms of the GNU General Public License version 2. This program |
8 | * is licensed "as is" without any warranty of any kind, whether express | 8 | * is licensed "as is" without any warranty of any kind, whether express |
9 | * or implied. | 9 | * or implied. |
@@ -26,4 +26,16 @@ extern atomic_t edac_handlers; | |||
26 | extern int edac_handler_set(void); | 26 | extern int edac_handler_set(void); |
27 | extern void edac_atomic_assert_error(void); | 27 | extern void edac_atomic_assert_error(void); |
28 | 28 | ||
29 | static inline void opstate_init(void) | ||
30 | { | ||
31 | switch (edac_op_state) { | ||
32 | case EDAC_OPSTATE_POLL: | ||
33 | case EDAC_OPSTATE_NMI: | ||
34 | break; | ||
35 | default: | ||
36 | edac_op_state = EDAC_OPSTATE_POLL; | ||
37 | } | ||
38 | return; | ||
39 | } | ||
40 | |||
29 | #endif | 41 | #endif |
diff --git a/include/linux/elf.h b/include/linux/elf.h index bad1b16ec49a..ff9fbed90123 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
@@ -208,7 +208,7 @@ typedef struct elf32_hdr{ | |||
208 | } Elf32_Ehdr; | 208 | } Elf32_Ehdr; |
209 | 209 | ||
210 | typedef struct elf64_hdr { | 210 | typedef struct elf64_hdr { |
211 | unsigned char e_ident[16]; /* ELF "magic number" */ | 211 | unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ |
212 | Elf64_Half e_type; | 212 | Elf64_Half e_type; |
213 | Elf64_Half e_machine; | 213 | Elf64_Half e_machine; |
214 | Elf64_Word e_version; | 214 | Elf64_Word e_version; |
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index b489fc6d0b62..a701399b7fed 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h | |||
@@ -8,9 +8,6 @@ | |||
8 | #ifndef _LINUX_EVENTFD_H | 8 | #ifndef _LINUX_EVENTFD_H |
9 | #define _LINUX_EVENTFD_H | 9 | #define _LINUX_EVENTFD_H |
10 | 10 | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #ifdef CONFIG_EVENTFD | 11 | #ifdef CONFIG_EVENTFD |
15 | 12 | ||
16 | struct file *eventfd_fget(int fd); | 13 | struct file *eventfd_fget(int fd); |
@@ -24,7 +21,5 @@ static inline int eventfd_signal(struct file *file, int n) | |||
24 | 21 | ||
25 | #endif /* CONFIG_EVENTFD */ | 22 | #endif /* CONFIG_EVENTFD */ |
26 | 23 | ||
27 | #endif /* __KERNEL__ */ | ||
28 | |||
29 | #endif /* _LINUX_EVENTFD_H */ | 24 | #endif /* _LINUX_EVENTFD_H */ |
30 | 25 | ||
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h deleted file mode 100644 index 250032548597..000000000000 --- a/include/linux/ext4_fs.h +++ /dev/null | |||
@@ -1,1207 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext4_fs.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT4_FS_H | ||
17 | #define _LINUX_EXT4_FS_H | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/blkdev.h> | ||
21 | #include <linux/magic.h> | ||
22 | |||
23 | #include <linux/ext4_fs_i.h> | ||
24 | |||
25 | /* | ||
26 | * The second extended filesystem constants/structures | ||
27 | */ | ||
28 | |||
29 | /* | ||
30 | * Define EXT4FS_DEBUG to produce debug messages | ||
31 | */ | ||
32 | #undef EXT4FS_DEBUG | ||
33 | |||
34 | /* | ||
35 | * Define EXT4_RESERVATION to reserve data blocks for expanding files | ||
36 | */ | ||
37 | #define EXT4_DEFAULT_RESERVE_BLOCKS 8 | ||
38 | /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ | ||
39 | #define EXT4_MAX_RESERVE_BLOCKS 1027 | ||
40 | #define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0 | ||
41 | |||
42 | /* | ||
43 | * Debug code | ||
44 | */ | ||
45 | #ifdef EXT4FS_DEBUG | ||
46 | #define ext4_debug(f, a...) \ | ||
47 | do { \ | ||
48 | printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \ | ||
49 | __FILE__, __LINE__, __FUNCTION__); \ | ||
50 | printk (KERN_DEBUG f, ## a); \ | ||
51 | } while (0) | ||
52 | #else | ||
53 | #define ext4_debug(f, a...) do {} while (0) | ||
54 | #endif | ||
55 | |||
56 | #define EXT4_MULTIBLOCK_ALLOCATOR 1 | ||
57 | |||
58 | /* prefer goal again. length */ | ||
59 | #define EXT4_MB_HINT_MERGE 1 | ||
60 | /* blocks already reserved */ | ||
61 | #define EXT4_MB_HINT_RESERVED 2 | ||
62 | /* metadata is being allocated */ | ||
63 | #define EXT4_MB_HINT_METADATA 4 | ||
64 | /* first blocks in the file */ | ||
65 | #define EXT4_MB_HINT_FIRST 8 | ||
66 | /* search for the best chunk */ | ||
67 | #define EXT4_MB_HINT_BEST 16 | ||
68 | /* data is being allocated */ | ||
69 | #define EXT4_MB_HINT_DATA 32 | ||
70 | /* don't preallocate (for tails) */ | ||
71 | #define EXT4_MB_HINT_NOPREALLOC 64 | ||
72 | /* allocate for locality group */ | ||
73 | #define EXT4_MB_HINT_GROUP_ALLOC 128 | ||
74 | /* allocate goal blocks or none */ | ||
75 | #define EXT4_MB_HINT_GOAL_ONLY 256 | ||
76 | /* goal is meaningful */ | ||
77 | #define EXT4_MB_HINT_TRY_GOAL 512 | ||
78 | |||
79 | struct ext4_allocation_request { | ||
80 | /* target inode for block we're allocating */ | ||
81 | struct inode *inode; | ||
82 | /* logical block in target inode */ | ||
83 | ext4_lblk_t logical; | ||
84 | /* phys. target (a hint) */ | ||
85 | ext4_fsblk_t goal; | ||
86 | /* the closest logical allocated block to the left */ | ||
87 | ext4_lblk_t lleft; | ||
88 | /* phys. block for ^^^ */ | ||
89 | ext4_fsblk_t pleft; | ||
90 | /* the closest logical allocated block to the right */ | ||
91 | ext4_lblk_t lright; | ||
92 | /* phys. block for ^^^ */ | ||
93 | ext4_fsblk_t pright; | ||
94 | /* how many blocks we want to allocate */ | ||
95 | unsigned long len; | ||
96 | /* flags. see above EXT4_MB_HINT_* */ | ||
97 | unsigned long flags; | ||
98 | }; | ||
99 | |||
100 | /* | ||
101 | * Special inodes numbers | ||
102 | */ | ||
103 | #define EXT4_BAD_INO 1 /* Bad blocks inode */ | ||
104 | #define EXT4_ROOT_INO 2 /* Root inode */ | ||
105 | #define EXT4_BOOT_LOADER_INO 5 /* Boot loader inode */ | ||
106 | #define EXT4_UNDEL_DIR_INO 6 /* Undelete directory inode */ | ||
107 | #define EXT4_RESIZE_INO 7 /* Reserved group descriptors inode */ | ||
108 | #define EXT4_JOURNAL_INO 8 /* Journal inode */ | ||
109 | |||
110 | /* First non-reserved inode for old ext4 filesystems */ | ||
111 | #define EXT4_GOOD_OLD_FIRST_INO 11 | ||
112 | |||
113 | /* | ||
114 | * Maximal count of links to a file | ||
115 | */ | ||
116 | #define EXT4_LINK_MAX 65000 | ||
117 | |||
118 | /* | ||
119 | * Macro-instructions used to manage several block sizes | ||
120 | */ | ||
121 | #define EXT4_MIN_BLOCK_SIZE 1024 | ||
122 | #define EXT4_MAX_BLOCK_SIZE 65536 | ||
123 | #define EXT4_MIN_BLOCK_LOG_SIZE 10 | ||
124 | #ifdef __KERNEL__ | ||
125 | # define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize) | ||
126 | #else | ||
127 | # define EXT4_BLOCK_SIZE(s) (EXT4_MIN_BLOCK_SIZE << (s)->s_log_block_size) | ||
128 | #endif | ||
129 | #define EXT4_ADDR_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / sizeof (__u32)) | ||
130 | #ifdef __KERNEL__ | ||
131 | # define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) | ||
132 | #else | ||
133 | # define EXT4_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) | ||
134 | #endif | ||
135 | #ifdef __KERNEL__ | ||
136 | #define EXT4_ADDR_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_addr_per_block_bits) | ||
137 | #define EXT4_INODE_SIZE(s) (EXT4_SB(s)->s_inode_size) | ||
138 | #define EXT4_FIRST_INO(s) (EXT4_SB(s)->s_first_ino) | ||
139 | #else | ||
140 | #define EXT4_INODE_SIZE(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \ | ||
141 | EXT4_GOOD_OLD_INODE_SIZE : \ | ||
142 | (s)->s_inode_size) | ||
143 | #define EXT4_FIRST_INO(s) (((s)->s_rev_level == EXT4_GOOD_OLD_REV) ? \ | ||
144 | EXT4_GOOD_OLD_FIRST_INO : \ | ||
145 | (s)->s_first_ino) | ||
146 | #endif | ||
147 | #define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits))) | ||
148 | |||
149 | /* | ||
150 | * Structure of a blocks group descriptor | ||
151 | */ | ||
152 | struct ext4_group_desc | ||
153 | { | ||
154 | __le32 bg_block_bitmap_lo; /* Blocks bitmap block */ | ||
155 | __le32 bg_inode_bitmap_lo; /* Inodes bitmap block */ | ||
156 | __le32 bg_inode_table_lo; /* Inodes table block */ | ||
157 | __le16 bg_free_blocks_count; /* Free blocks count */ | ||
158 | __le16 bg_free_inodes_count; /* Free inodes count */ | ||
159 | __le16 bg_used_dirs_count; /* Directories count */ | ||
160 | __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ | ||
161 | __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */ | ||
162 | __le16 bg_itable_unused; /* Unused inodes count */ | ||
163 | __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ | ||
164 | __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ | ||
165 | __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ | ||
166 | __le32 bg_inode_table_hi; /* Inodes table block MSB */ | ||
167 | __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */ | ||
168 | __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */ | ||
169 | __le16 bg_used_dirs_count_hi; /* Directories count MSB */ | ||
170 | __le16 bg_itable_unused_hi; /* Unused inodes count MSB */ | ||
171 | __u32 bg_reserved2[3]; | ||
172 | }; | ||
173 | |||
174 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ | ||
175 | #define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */ | ||
176 | #define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ | ||
177 | |||
178 | #ifdef __KERNEL__ | ||
179 | #include <linux/ext4_fs_i.h> | ||
180 | #include <linux/ext4_fs_sb.h> | ||
181 | #endif | ||
182 | /* | ||
183 | * Macro-instructions used to manage group descriptors | ||
184 | */ | ||
185 | #define EXT4_MIN_DESC_SIZE 32 | ||
186 | #define EXT4_MIN_DESC_SIZE_64BIT 64 | ||
187 | #define EXT4_MAX_DESC_SIZE EXT4_MIN_BLOCK_SIZE | ||
188 | #define EXT4_DESC_SIZE(s) (EXT4_SB(s)->s_desc_size) | ||
189 | #ifdef __KERNEL__ | ||
190 | # define EXT4_BLOCKS_PER_GROUP(s) (EXT4_SB(s)->s_blocks_per_group) | ||
191 | # define EXT4_DESC_PER_BLOCK(s) (EXT4_SB(s)->s_desc_per_block) | ||
192 | # define EXT4_INODES_PER_GROUP(s) (EXT4_SB(s)->s_inodes_per_group) | ||
193 | # define EXT4_DESC_PER_BLOCK_BITS(s) (EXT4_SB(s)->s_desc_per_block_bits) | ||
194 | #else | ||
195 | # define EXT4_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) | ||
196 | # define EXT4_DESC_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / EXT4_DESC_SIZE(s)) | ||
197 | # define EXT4_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) | ||
198 | #endif | ||
199 | |||
200 | /* | ||
201 | * Constants relative to the data blocks | ||
202 | */ | ||
203 | #define EXT4_NDIR_BLOCKS 12 | ||
204 | #define EXT4_IND_BLOCK EXT4_NDIR_BLOCKS | ||
205 | #define EXT4_DIND_BLOCK (EXT4_IND_BLOCK + 1) | ||
206 | #define EXT4_TIND_BLOCK (EXT4_DIND_BLOCK + 1) | ||
207 | #define EXT4_N_BLOCKS (EXT4_TIND_BLOCK + 1) | ||
208 | |||
209 | /* | ||
210 | * Inode flags | ||
211 | */ | ||
212 | #define EXT4_SECRM_FL 0x00000001 /* Secure deletion */ | ||
213 | #define EXT4_UNRM_FL 0x00000002 /* Undelete */ | ||
214 | #define EXT4_COMPR_FL 0x00000004 /* Compress file */ | ||
215 | #define EXT4_SYNC_FL 0x00000008 /* Synchronous updates */ | ||
216 | #define EXT4_IMMUTABLE_FL 0x00000010 /* Immutable file */ | ||
217 | #define EXT4_APPEND_FL 0x00000020 /* writes to file may only append */ | ||
218 | #define EXT4_NODUMP_FL 0x00000040 /* do not dump file */ | ||
219 | #define EXT4_NOATIME_FL 0x00000080 /* do not update atime */ | ||
220 | /* Reserved for compression usage... */ | ||
221 | #define EXT4_DIRTY_FL 0x00000100 | ||
222 | #define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ | ||
223 | #define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */ | ||
224 | #define EXT4_ECOMPR_FL 0x00000800 /* Compression error */ | ||
225 | /* End compression flags --- maybe not all used */ | ||
226 | #define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */ | ||
227 | #define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */ | ||
228 | #define EXT4_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ | ||
229 | #define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */ | ||
230 | #define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ | ||
231 | #define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | ||
232 | #define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */ | ||
233 | #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ | ||
234 | #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ | ||
235 | |||
236 | #define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */ | ||
237 | #define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ | ||
238 | |||
239 | /* | ||
240 | * Inode dynamic state flags | ||
241 | */ | ||
242 | #define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */ | ||
243 | #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ | ||
244 | #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ | ||
245 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ | ||
246 | |||
247 | /* Used to pass group descriptor data when online resize is done */ | ||
248 | struct ext4_new_group_input { | ||
249 | __u32 group; /* Group number for this data */ | ||
250 | __u64 block_bitmap; /* Absolute block number of block bitmap */ | ||
251 | __u64 inode_bitmap; /* Absolute block number of inode bitmap */ | ||
252 | __u64 inode_table; /* Absolute block number of inode table start */ | ||
253 | __u32 blocks_count; /* Total number of blocks in this group */ | ||
254 | __u16 reserved_blocks; /* Number of reserved blocks in this group */ | ||
255 | __u16 unused; | ||
256 | }; | ||
257 | |||
258 | /* The struct ext4_new_group_input in kernel space, with free_blocks_count */ | ||
259 | struct ext4_new_group_data { | ||
260 | __u32 group; | ||
261 | __u64 block_bitmap; | ||
262 | __u64 inode_bitmap; | ||
263 | __u64 inode_table; | ||
264 | __u32 blocks_count; | ||
265 | __u16 reserved_blocks; | ||
266 | __u16 unused; | ||
267 | __u32 free_blocks_count; | ||
268 | }; | ||
269 | |||
270 | /* | ||
271 | * Following is used by preallocation code to tell get_blocks() that we | ||
272 | * want uninitialzed extents. | ||
273 | */ | ||
274 | #define EXT4_CREATE_UNINITIALIZED_EXT 2 | ||
275 | |||
276 | /* | ||
277 | * ioctl commands | ||
278 | */ | ||
279 | #define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS | ||
280 | #define EXT4_IOC_SETFLAGS FS_IOC_SETFLAGS | ||
281 | #define EXT4_IOC_GETVERSION _IOR('f', 3, long) | ||
282 | #define EXT4_IOC_SETVERSION _IOW('f', 4, long) | ||
283 | #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) | ||
284 | #define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) | ||
285 | #define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION | ||
286 | #define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION | ||
287 | #ifdef CONFIG_JBD2_DEBUG | ||
288 | #define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) | ||
289 | #endif | ||
290 | #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) | ||
291 | #define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) | ||
292 | #define EXT4_IOC_MIGRATE _IO('f', 7) | ||
293 | |||
294 | /* | ||
295 | * ioctl commands in 32 bit emulation | ||
296 | */ | ||
297 | #define EXT4_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
298 | #define EXT4_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
299 | #define EXT4_IOC32_GETVERSION _IOR('f', 3, int) | ||
300 | #define EXT4_IOC32_SETVERSION _IOW('f', 4, int) | ||
301 | #define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int) | ||
302 | #define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) | ||
303 | #define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) | ||
304 | #ifdef CONFIG_JBD2_DEBUG | ||
305 | #define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) | ||
306 | #endif | ||
307 | #define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION | ||
308 | #define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION | ||
309 | |||
310 | |||
311 | /* | ||
312 | * Mount options | ||
313 | */ | ||
314 | struct ext4_mount_options { | ||
315 | unsigned long s_mount_opt; | ||
316 | uid_t s_resuid; | ||
317 | gid_t s_resgid; | ||
318 | unsigned long s_commit_interval; | ||
319 | #ifdef CONFIG_QUOTA | ||
320 | int s_jquota_fmt; | ||
321 | char *s_qf_names[MAXQUOTAS]; | ||
322 | #endif | ||
323 | }; | ||
324 | |||
325 | /* | ||
326 | * Structure of an inode on the disk | ||
327 | */ | ||
328 | struct ext4_inode { | ||
329 | __le16 i_mode; /* File mode */ | ||
330 | __le16 i_uid; /* Low 16 bits of Owner Uid */ | ||
331 | __le32 i_size_lo; /* Size in bytes */ | ||
332 | __le32 i_atime; /* Access time */ | ||
333 | __le32 i_ctime; /* Inode Change time */ | ||
334 | __le32 i_mtime; /* Modification time */ | ||
335 | __le32 i_dtime; /* Deletion Time */ | ||
336 | __le16 i_gid; /* Low 16 bits of Group Id */ | ||
337 | __le16 i_links_count; /* Links count */ | ||
338 | __le32 i_blocks_lo; /* Blocks count */ | ||
339 | __le32 i_flags; /* File flags */ | ||
340 | union { | ||
341 | struct { | ||
342 | __le32 l_i_version; | ||
343 | } linux1; | ||
344 | struct { | ||
345 | __u32 h_i_translator; | ||
346 | } hurd1; | ||
347 | struct { | ||
348 | __u32 m_i_reserved1; | ||
349 | } masix1; | ||
350 | } osd1; /* OS dependent 1 */ | ||
351 | __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */ | ||
352 | __le32 i_generation; /* File version (for NFS) */ | ||
353 | __le32 i_file_acl_lo; /* File ACL */ | ||
354 | __le32 i_size_high; | ||
355 | __le32 i_obso_faddr; /* Obsoleted fragment address */ | ||
356 | union { | ||
357 | struct { | ||
358 | __le16 l_i_blocks_high; /* were l_i_reserved1 */ | ||
359 | __le16 l_i_file_acl_high; | ||
360 | __le16 l_i_uid_high; /* these 2 fields */ | ||
361 | __le16 l_i_gid_high; /* were reserved2[0] */ | ||
362 | __u32 l_i_reserved2; | ||
363 | } linux2; | ||
364 | struct { | ||
365 | __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ | ||
366 | __u16 h_i_mode_high; | ||
367 | __u16 h_i_uid_high; | ||
368 | __u16 h_i_gid_high; | ||
369 | __u32 h_i_author; | ||
370 | } hurd2; | ||
371 | struct { | ||
372 | __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ | ||
373 | __le16 m_i_file_acl_high; | ||
374 | __u32 m_i_reserved2[2]; | ||
375 | } masix2; | ||
376 | } osd2; /* OS dependent 2 */ | ||
377 | __le16 i_extra_isize; | ||
378 | __le16 i_pad1; | ||
379 | __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ | ||
380 | __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */ | ||
381 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ | ||
382 | __le32 i_crtime; /* File Creation time */ | ||
383 | __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ | ||
384 | __le32 i_version_hi; /* high 32 bits for 64-bit version */ | ||
385 | }; | ||
386 | |||
387 | |||
388 | #define EXT4_EPOCH_BITS 2 | ||
389 | #define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) | ||
390 | #define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS) | ||
391 | |||
392 | /* | ||
393 | * Extended fields will fit into an inode if the filesystem was formatted | ||
394 | * with large inodes (-I 256 or larger) and there are not currently any EAs | ||
395 | * consuming all of the available space. For new inodes we always reserve | ||
396 | * enough space for the kernel's known extended fields, but for inodes | ||
397 | * created with an old kernel this might not have been the case. None of | ||
398 | * the extended inode fields is critical for correct filesystem operation. | ||
399 | * This macro checks if a certain field fits in the inode. Note that | ||
400 | * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize | ||
401 | */ | ||
402 | #define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \ | ||
403 | ((offsetof(typeof(*ext4_inode), field) + \ | ||
404 | sizeof((ext4_inode)->field)) \ | ||
405 | <= (EXT4_GOOD_OLD_INODE_SIZE + \ | ||
406 | (einode)->i_extra_isize)) \ | ||
407 | |||
408 | static inline __le32 ext4_encode_extra_time(struct timespec *time) | ||
409 | { | ||
410 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? | ||
411 | time->tv_sec >> 32 : 0) | | ||
412 | ((time->tv_nsec << 2) & EXT4_NSEC_MASK)); | ||
413 | } | ||
414 | |||
415 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | ||
416 | { | ||
417 | if (sizeof(time->tv_sec) > 4) | ||
418 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) | ||
419 | << 32; | ||
420 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2; | ||
421 | } | ||
422 | |||
423 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ | ||
424 | do { \ | ||
425 | (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ | ||
426 | if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ | ||
427 | (raw_inode)->xtime ## _extra = \ | ||
428 | ext4_encode_extra_time(&(inode)->xtime); \ | ||
429 | } while (0) | ||
430 | |||
431 | #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \ | ||
432 | do { \ | ||
433 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ | ||
434 | (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \ | ||
435 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ | ||
436 | (raw_inode)->xtime ## _extra = \ | ||
437 | ext4_encode_extra_time(&(einode)->xtime); \ | ||
438 | } while (0) | ||
439 | |||
440 | #define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \ | ||
441 | do { \ | ||
442 | (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \ | ||
443 | if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ | ||
444 | ext4_decode_extra_time(&(inode)->xtime, \ | ||
445 | raw_inode->xtime ## _extra); \ | ||
446 | } while (0) | ||
447 | |||
448 | #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ | ||
449 | do { \ | ||
450 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \ | ||
451 | (einode)->xtime.tv_sec = \ | ||
452 | (signed)le32_to_cpu((raw_inode)->xtime); \ | ||
453 | if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ | ||
454 | ext4_decode_extra_time(&(einode)->xtime, \ | ||
455 | raw_inode->xtime ## _extra); \ | ||
456 | } while (0) | ||
457 | |||
458 | #define i_disk_version osd1.linux1.l_i_version | ||
459 | |||
460 | #if defined(__KERNEL__) || defined(__linux__) | ||
461 | #define i_reserved1 osd1.linux1.l_i_reserved1 | ||
462 | #define i_file_acl_high osd2.linux2.l_i_file_acl_high | ||
463 | #define i_blocks_high osd2.linux2.l_i_blocks_high | ||
464 | #define i_uid_low i_uid | ||
465 | #define i_gid_low i_gid | ||
466 | #define i_uid_high osd2.linux2.l_i_uid_high | ||
467 | #define i_gid_high osd2.linux2.l_i_gid_high | ||
468 | #define i_reserved2 osd2.linux2.l_i_reserved2 | ||
469 | |||
470 | #elif defined(__GNU__) | ||
471 | |||
472 | #define i_translator osd1.hurd1.h_i_translator | ||
473 | #define i_uid_high osd2.hurd2.h_i_uid_high | ||
474 | #define i_gid_high osd2.hurd2.h_i_gid_high | ||
475 | #define i_author osd2.hurd2.h_i_author | ||
476 | |||
477 | #elif defined(__masix__) | ||
478 | |||
479 | #define i_reserved1 osd1.masix1.m_i_reserved1 | ||
480 | #define i_file_acl_high osd2.masix2.m_i_file_acl_high | ||
481 | #define i_reserved2 osd2.masix2.m_i_reserved2 | ||
482 | |||
483 | #endif /* defined(__KERNEL__) || defined(__linux__) */ | ||
484 | |||
485 | /* | ||
486 | * File system states | ||
487 | */ | ||
488 | #define EXT4_VALID_FS 0x0001 /* Unmounted cleanly */ | ||
489 | #define EXT4_ERROR_FS 0x0002 /* Errors detected */ | ||
490 | #define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */ | ||
491 | |||
492 | /* | ||
493 | * Misc. filesystem flags | ||
494 | */ | ||
495 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */ | ||
496 | #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */ | ||
497 | #define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */ | ||
498 | |||
499 | /* | ||
500 | * Mount flags | ||
501 | */ | ||
502 | #define EXT4_MOUNT_CHECK 0x00001 /* Do mount-time checks */ | ||
503 | #define EXT4_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */ | ||
504 | #define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */ | ||
505 | #define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */ | ||
506 | #define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */ | ||
507 | #define EXT4_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */ | ||
508 | #define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */ | ||
509 | #define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ | ||
510 | #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ | ||
511 | #define EXT4_MOUNT_ABORT 0x00200 /* Fatal error detected */ | ||
512 | #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ | ||
513 | #define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */ | ||
514 | #define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */ | ||
515 | #define EXT4_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */ | ||
516 | #define EXT4_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */ | ||
517 | #define EXT4_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */ | ||
518 | #define EXT4_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */ | ||
519 | #define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ | ||
520 | #define EXT4_MOUNT_RESERVATION 0x10000 /* Preallocation */ | ||
521 | #define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */ | ||
522 | #define EXT4_MOUNT_NOBH 0x40000 /* No bufferheads */ | ||
523 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ | ||
524 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | ||
525 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | ||
526 | #define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */ | ||
527 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ | ||
528 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | ||
529 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | ||
530 | #define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */ | ||
531 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ | ||
532 | #ifndef _LINUX_EXT2_FS_H | ||
533 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt | ||
534 | #define set_opt(o, opt) o |= EXT4_MOUNT_##opt | ||
535 | #define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \ | ||
536 | EXT4_MOUNT_##opt) | ||
537 | #else | ||
538 | #define EXT2_MOUNT_NOLOAD EXT4_MOUNT_NOLOAD | ||
539 | #define EXT2_MOUNT_ABORT EXT4_MOUNT_ABORT | ||
540 | #define EXT2_MOUNT_DATA_FLAGS EXT4_MOUNT_DATA_FLAGS | ||
541 | #endif | ||
542 | |||
543 | #define ext4_set_bit ext2_set_bit | ||
544 | #define ext4_set_bit_atomic ext2_set_bit_atomic | ||
545 | #define ext4_clear_bit ext2_clear_bit | ||
546 | #define ext4_clear_bit_atomic ext2_clear_bit_atomic | ||
547 | #define ext4_test_bit ext2_test_bit | ||
548 | #define ext4_find_first_zero_bit ext2_find_first_zero_bit | ||
549 | #define ext4_find_next_zero_bit ext2_find_next_zero_bit | ||
550 | #define ext4_find_next_bit ext2_find_next_bit | ||
551 | |||
552 | /* | ||
553 | * Maximal mount counts between two filesystem checks | ||
554 | */ | ||
555 | #define EXT4_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ | ||
556 | #define EXT4_DFL_CHECKINTERVAL 0 /* Don't use interval check */ | ||
557 | |||
558 | /* | ||
559 | * Behaviour when detecting errors | ||
560 | */ | ||
561 | #define EXT4_ERRORS_CONTINUE 1 /* Continue execution */ | ||
562 | #define EXT4_ERRORS_RO 2 /* Remount fs read-only */ | ||
563 | #define EXT4_ERRORS_PANIC 3 /* Panic */ | ||
564 | #define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE | ||
565 | |||
566 | /* | ||
567 | * Structure of the super block | ||
568 | */ | ||
569 | struct ext4_super_block { | ||
570 | /*00*/ __le32 s_inodes_count; /* Inodes count */ | ||
571 | __le32 s_blocks_count_lo; /* Blocks count */ | ||
572 | __le32 s_r_blocks_count_lo; /* Reserved blocks count */ | ||
573 | __le32 s_free_blocks_count_lo; /* Free blocks count */ | ||
574 | /*10*/ __le32 s_free_inodes_count; /* Free inodes count */ | ||
575 | __le32 s_first_data_block; /* First Data Block */ | ||
576 | __le32 s_log_block_size; /* Block size */ | ||
577 | __le32 s_obso_log_frag_size; /* Obsoleted fragment size */ | ||
578 | /*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ | ||
579 | __le32 s_obso_frags_per_group; /* Obsoleted fragments per group */ | ||
580 | __le32 s_inodes_per_group; /* # Inodes per group */ | ||
581 | __le32 s_mtime; /* Mount time */ | ||
582 | /*30*/ __le32 s_wtime; /* Write time */ | ||
583 | __le16 s_mnt_count; /* Mount count */ | ||
584 | __le16 s_max_mnt_count; /* Maximal mount count */ | ||
585 | __le16 s_magic; /* Magic signature */ | ||
586 | __le16 s_state; /* File system state */ | ||
587 | __le16 s_errors; /* Behaviour when detecting errors */ | ||
588 | __le16 s_minor_rev_level; /* minor revision level */ | ||
589 | /*40*/ __le32 s_lastcheck; /* time of last check */ | ||
590 | __le32 s_checkinterval; /* max. time between checks */ | ||
591 | __le32 s_creator_os; /* OS */ | ||
592 | __le32 s_rev_level; /* Revision level */ | ||
593 | /*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */ | ||
594 | __le16 s_def_resgid; /* Default gid for reserved blocks */ | ||
595 | /* | ||
596 | * These fields are for EXT4_DYNAMIC_REV superblocks only. | ||
597 | * | ||
598 | * Note: the difference between the compatible feature set and | ||
599 | * the incompatible feature set is that if there is a bit set | ||
600 | * in the incompatible feature set that the kernel doesn't | ||
601 | * know about, it should refuse to mount the filesystem. | ||
602 | * | ||
603 | * e2fsck's requirements are more strict; if it doesn't know | ||
604 | * about a feature in either the compatible or incompatible | ||
605 | * feature set, it must abort and not try to meddle with | ||
606 | * things it doesn't understand... | ||
607 | */ | ||
608 | __le32 s_first_ino; /* First non-reserved inode */ | ||
609 | __le16 s_inode_size; /* size of inode structure */ | ||
610 | __le16 s_block_group_nr; /* block group # of this superblock */ | ||
611 | __le32 s_feature_compat; /* compatible feature set */ | ||
612 | /*60*/ __le32 s_feature_incompat; /* incompatible feature set */ | ||
613 | __le32 s_feature_ro_compat; /* readonly-compatible feature set */ | ||
614 | /*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ | ||
615 | /*78*/ char s_volume_name[16]; /* volume name */ | ||
616 | /*88*/ char s_last_mounted[64]; /* directory where last mounted */ | ||
617 | /*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */ | ||
618 | /* | ||
619 | * Performance hints. Directory preallocation should only | ||
620 | * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on. | ||
621 | */ | ||
622 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ | ||
623 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ | ||
624 | __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */ | ||
625 | /* | ||
626 | * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set. | ||
627 | */ | ||
628 | /*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ | ||
629 | /*E0*/ __le32 s_journal_inum; /* inode number of journal file */ | ||
630 | __le32 s_journal_dev; /* device number of journal file */ | ||
631 | __le32 s_last_orphan; /* start of list of inodes to delete */ | ||
632 | __le32 s_hash_seed[4]; /* HTREE hash seed */ | ||
633 | __u8 s_def_hash_version; /* Default hash version to use */ | ||
634 | __u8 s_reserved_char_pad; | ||
635 | __le16 s_desc_size; /* size of group descriptor */ | ||
636 | /*100*/ __le32 s_default_mount_opts; | ||
637 | __le32 s_first_meta_bg; /* First metablock block group */ | ||
638 | __le32 s_mkfs_time; /* When the filesystem was created */ | ||
639 | __le32 s_jnl_blocks[17]; /* Backup of the journal inode */ | ||
640 | /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */ | ||
641 | /*150*/ __le32 s_blocks_count_hi; /* Blocks count */ | ||
642 | __le32 s_r_blocks_count_hi; /* Reserved blocks count */ | ||
643 | __le32 s_free_blocks_count_hi; /* Free blocks count */ | ||
644 | __le16 s_min_extra_isize; /* All inodes have at least # bytes */ | ||
645 | __le16 s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
646 | __le32 s_flags; /* Miscellaneous flags */ | ||
647 | __le16 s_raid_stride; /* RAID stride */ | ||
648 | __le16 s_mmp_interval; /* # seconds to wait in MMP checking */ | ||
649 | __le64 s_mmp_block; /* Block for multi-mount protection */ | ||
650 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ | ||
651 | __u32 s_reserved[163]; /* Padding to the end of the block */ | ||
652 | }; | ||
653 | |||
654 | #ifdef __KERNEL__ | ||
655 | static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb) | ||
656 | { | ||
657 | return sb->s_fs_info; | ||
658 | } | ||
659 | static inline struct ext4_inode_info *EXT4_I(struct inode *inode) | ||
660 | { | ||
661 | return container_of(inode, struct ext4_inode_info, vfs_inode); | ||
662 | } | ||
663 | |||
664 | static inline struct timespec ext4_current_time(struct inode *inode) | ||
665 | { | ||
666 | return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ? | ||
667 | current_fs_time(inode->i_sb) : CURRENT_TIME_SEC; | ||
668 | } | ||
669 | |||
670 | |||
671 | static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | ||
672 | { | ||
673 | return ino == EXT4_ROOT_INO || | ||
674 | ino == EXT4_JOURNAL_INO || | ||
675 | ino == EXT4_RESIZE_INO || | ||
676 | (ino >= EXT4_FIRST_INO(sb) && | ||
677 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); | ||
678 | } | ||
679 | #else | ||
680 | /* Assume that user mode programs are passing in an ext4fs superblock, not | ||
681 | * a kernel struct super_block. This will allow us to call the feature-test | ||
682 | * macros from user land. */ | ||
683 | #define EXT4_SB(sb) (sb) | ||
684 | #endif | ||
685 | |||
686 | #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime | ||
687 | |||
688 | /* | ||
689 | * Codes for operating systems | ||
690 | */ | ||
691 | #define EXT4_OS_LINUX 0 | ||
692 | #define EXT4_OS_HURD 1 | ||
693 | #define EXT4_OS_MASIX 2 | ||
694 | #define EXT4_OS_FREEBSD 3 | ||
695 | #define EXT4_OS_LITES 4 | ||
696 | |||
697 | /* | ||
698 | * Revision levels | ||
699 | */ | ||
700 | #define EXT4_GOOD_OLD_REV 0 /* The good old (original) format */ | ||
701 | #define EXT4_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ | ||
702 | |||
703 | #define EXT4_CURRENT_REV EXT4_GOOD_OLD_REV | ||
704 | #define EXT4_MAX_SUPP_REV EXT4_DYNAMIC_REV | ||
705 | |||
706 | #define EXT4_GOOD_OLD_INODE_SIZE 128 | ||
707 | |||
708 | /* | ||
709 | * Feature set definitions | ||
710 | */ | ||
711 | |||
712 | #define EXT4_HAS_COMPAT_FEATURE(sb,mask) \ | ||
713 | ( EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) | ||
714 | #define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \ | ||
715 | ( EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) | ||
716 | #define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \ | ||
717 | ( EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) | ||
718 | #define EXT4_SET_COMPAT_FEATURE(sb,mask) \ | ||
719 | EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) | ||
720 | #define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \ | ||
721 | EXT4_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) | ||
722 | #define EXT4_SET_INCOMPAT_FEATURE(sb,mask) \ | ||
723 | EXT4_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) | ||
724 | #define EXT4_CLEAR_COMPAT_FEATURE(sb,mask) \ | ||
725 | EXT4_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) | ||
726 | #define EXT4_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ | ||
727 | EXT4_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) | ||
728 | #define EXT4_CLEAR_INCOMPAT_FEATURE(sb,mask) \ | ||
729 | EXT4_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) | ||
730 | |||
731 | #define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x0001 | ||
732 | #define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x0002 | ||
733 | #define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x0004 | ||
734 | #define EXT4_FEATURE_COMPAT_EXT_ATTR 0x0008 | ||
735 | #define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010 | ||
736 | #define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020 | ||
737 | |||
738 | #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 | ||
739 | #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 | ||
740 | #define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 | ||
741 | #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 | ||
742 | #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 | ||
743 | #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 | ||
744 | #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 | ||
745 | |||
746 | #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 | ||
747 | #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 | ||
748 | #define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ | ||
749 | #define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ | ||
750 | #define EXT4_FEATURE_INCOMPAT_META_BG 0x0010 | ||
751 | #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ | ||
752 | #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 | ||
753 | #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 | ||
754 | #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 | ||
755 | |||
756 | #define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR | ||
757 | #define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ | ||
758 | EXT4_FEATURE_INCOMPAT_RECOVER| \ | ||
759 | EXT4_FEATURE_INCOMPAT_META_BG| \ | ||
760 | EXT4_FEATURE_INCOMPAT_EXTENTS| \ | ||
761 | EXT4_FEATURE_INCOMPAT_64BIT| \ | ||
762 | EXT4_FEATURE_INCOMPAT_FLEX_BG) | ||
763 | #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ | ||
764 | EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ | ||
765 | EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ | ||
766 | EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ | ||
767 | EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ | ||
768 | EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\ | ||
769 | EXT4_FEATURE_RO_COMPAT_HUGE_FILE) | ||
770 | |||
771 | /* | ||
772 | * Default values for user and/or group using reserved blocks | ||
773 | */ | ||
774 | #define EXT4_DEF_RESUID 0 | ||
775 | #define EXT4_DEF_RESGID 0 | ||
776 | |||
777 | /* | ||
778 | * Default mount options | ||
779 | */ | ||
780 | #define EXT4_DEFM_DEBUG 0x0001 | ||
781 | #define EXT4_DEFM_BSDGROUPS 0x0002 | ||
782 | #define EXT4_DEFM_XATTR_USER 0x0004 | ||
783 | #define EXT4_DEFM_ACL 0x0008 | ||
784 | #define EXT4_DEFM_UID16 0x0010 | ||
785 | #define EXT4_DEFM_JMODE 0x0060 | ||
786 | #define EXT4_DEFM_JMODE_DATA 0x0020 | ||
787 | #define EXT4_DEFM_JMODE_ORDERED 0x0040 | ||
788 | #define EXT4_DEFM_JMODE_WBACK 0x0060 | ||
789 | |||
790 | /* | ||
791 | * Structure of a directory entry | ||
792 | */ | ||
793 | #define EXT4_NAME_LEN 255 | ||
794 | |||
795 | struct ext4_dir_entry { | ||
796 | __le32 inode; /* Inode number */ | ||
797 | __le16 rec_len; /* Directory entry length */ | ||
798 | __le16 name_len; /* Name length */ | ||
799 | char name[EXT4_NAME_LEN]; /* File name */ | ||
800 | }; | ||
801 | |||
802 | /* | ||
803 | * The new version of the directory entry. Since EXT4 structures are | ||
804 | * stored in intel byte order, and the name_len field could never be | ||
805 | * bigger than 255 chars, it's safe to reclaim the extra byte for the | ||
806 | * file_type field. | ||
807 | */ | ||
808 | struct ext4_dir_entry_2 { | ||
809 | __le32 inode; /* Inode number */ | ||
810 | __le16 rec_len; /* Directory entry length */ | ||
811 | __u8 name_len; /* Name length */ | ||
812 | __u8 file_type; | ||
813 | char name[EXT4_NAME_LEN]; /* File name */ | ||
814 | }; | ||
815 | |||
816 | /* | ||
817 | * Ext4 directory file types. Only the low 3 bits are used. The | ||
818 | * other bits are reserved for now. | ||
819 | */ | ||
820 | #define EXT4_FT_UNKNOWN 0 | ||
821 | #define EXT4_FT_REG_FILE 1 | ||
822 | #define EXT4_FT_DIR 2 | ||
823 | #define EXT4_FT_CHRDEV 3 | ||
824 | #define EXT4_FT_BLKDEV 4 | ||
825 | #define EXT4_FT_FIFO 5 | ||
826 | #define EXT4_FT_SOCK 6 | ||
827 | #define EXT4_FT_SYMLINK 7 | ||
828 | |||
829 | #define EXT4_FT_MAX 8 | ||
830 | |||
831 | /* | ||
832 | * EXT4_DIR_PAD defines the directory entries boundaries | ||
833 | * | ||
834 | * NOTE: It must be a multiple of 4 | ||
835 | */ | ||
836 | #define EXT4_DIR_PAD 4 | ||
837 | #define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1) | ||
838 | #define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \ | ||
839 | ~EXT4_DIR_ROUND) | ||
840 | #define EXT4_MAX_REC_LEN ((1<<16)-1) | ||
841 | |||
842 | static inline unsigned ext4_rec_len_from_disk(__le16 dlen) | ||
843 | { | ||
844 | unsigned len = le16_to_cpu(dlen); | ||
845 | |||
846 | if (len == EXT4_MAX_REC_LEN) | ||
847 | return 1 << 16; | ||
848 | return len; | ||
849 | } | ||
850 | |||
851 | static inline __le16 ext4_rec_len_to_disk(unsigned len) | ||
852 | { | ||
853 | if (len == (1 << 16)) | ||
854 | return cpu_to_le16(EXT4_MAX_REC_LEN); | ||
855 | else if (len > (1 << 16)) | ||
856 | BUG(); | ||
857 | return cpu_to_le16(len); | ||
858 | } | ||
859 | |||
860 | /* | ||
861 | * Hash Tree Directory indexing | ||
862 | * (c) Daniel Phillips, 2001 | ||
863 | */ | ||
864 | |||
865 | #define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \ | ||
866 | EXT4_FEATURE_COMPAT_DIR_INDEX) && \ | ||
867 | (EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) | ||
868 | #define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX) | ||
869 | #define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1) | ||
870 | |||
871 | /* Legal values for the dx_root hash_version field: */ | ||
872 | |||
873 | #define DX_HASH_LEGACY 0 | ||
874 | #define DX_HASH_HALF_MD4 1 | ||
875 | #define DX_HASH_TEA 2 | ||
876 | |||
877 | #ifdef __KERNEL__ | ||
878 | |||
879 | /* hash info structure used by the directory hash */ | ||
880 | struct dx_hash_info | ||
881 | { | ||
882 | u32 hash; | ||
883 | u32 minor_hash; | ||
884 | int hash_version; | ||
885 | u32 *seed; | ||
886 | }; | ||
887 | |||
888 | #define EXT4_HTREE_EOF 0x7fffffff | ||
889 | |||
890 | /* | ||
891 | * Control parameters used by ext4_htree_next_block | ||
892 | */ | ||
893 | #define HASH_NB_ALWAYS 1 | ||
894 | |||
895 | |||
896 | /* | ||
897 | * Describe an inode's exact location on disk and in memory | ||
898 | */ | ||
899 | struct ext4_iloc | ||
900 | { | ||
901 | struct buffer_head *bh; | ||
902 | unsigned long offset; | ||
903 | ext4_group_t block_group; | ||
904 | }; | ||
905 | |||
906 | static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc) | ||
907 | { | ||
908 | return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset); | ||
909 | } | ||
910 | |||
911 | /* | ||
912 | * This structure is stuffed into the struct file's private_data field | ||
913 | * for directories. It is where we put information so that we can do | ||
914 | * readdir operations in hash tree order. | ||
915 | */ | ||
916 | struct dir_private_info { | ||
917 | struct rb_root root; | ||
918 | struct rb_node *curr_node; | ||
919 | struct fname *extra_fname; | ||
920 | loff_t last_pos; | ||
921 | __u32 curr_hash; | ||
922 | __u32 curr_minor_hash; | ||
923 | __u32 next_hash; | ||
924 | }; | ||
925 | |||
926 | /* calculate the first block number of the group */ | ||
927 | static inline ext4_fsblk_t | ||
928 | ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no) | ||
929 | { | ||
930 | return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + | ||
931 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); | ||
932 | } | ||
933 | |||
934 | /* | ||
935 | * Special error return code only used by dx_probe() and its callers. | ||
936 | */ | ||
937 | #define ERR_BAD_DX_DIR -75000 | ||
938 | |||
939 | void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, | ||
940 | unsigned long *blockgrpp, ext4_grpblk_t *offsetp); | ||
941 | |||
942 | /* | ||
943 | * Function prototypes | ||
944 | */ | ||
945 | |||
946 | /* | ||
947 | * Ok, these declarations are also in <linux/kernel.h> but none of the | ||
948 | * ext4 source programs needs to include it so they are duplicated here. | ||
949 | */ | ||
950 | # define NORET_TYPE /**/ | ||
951 | # define ATTRIB_NORET __attribute__((noreturn)) | ||
952 | # define NORET_AND noreturn, | ||
953 | |||
954 | /* balloc.c */ | ||
955 | extern unsigned int ext4_block_group(struct super_block *sb, | ||
956 | ext4_fsblk_t blocknr); | ||
957 | extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, | ||
958 | ext4_fsblk_t blocknr); | ||
959 | extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group); | ||
960 | extern unsigned long ext4_bg_num_gdb(struct super_block *sb, | ||
961 | ext4_group_t group); | ||
962 | extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, | ||
963 | ext4_fsblk_t goal, int *errp); | ||
964 | extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, | ||
965 | ext4_fsblk_t goal, unsigned long *count, int *errp); | ||
966 | extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode, | ||
967 | ext4_fsblk_t goal, unsigned long *count, int *errp); | ||
968 | extern void ext4_free_blocks (handle_t *handle, struct inode *inode, | ||
969 | ext4_fsblk_t block, unsigned long count, int metadata); | ||
970 | extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, | ||
971 | ext4_fsblk_t block, unsigned long count, | ||
972 | unsigned long *pdquot_freed_blocks); | ||
973 | extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *); | ||
974 | extern void ext4_check_blocks_bitmap (struct super_block *); | ||
975 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | ||
976 | ext4_group_t block_group, | ||
977 | struct buffer_head ** bh); | ||
978 | extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); | ||
979 | extern void ext4_init_block_alloc_info(struct inode *); | ||
980 | extern void ext4_rsv_window_add(struct super_block *sb, struct ext4_reserve_window_node *rsv); | ||
981 | |||
982 | /* dir.c */ | ||
983 | extern int ext4_check_dir_entry(const char *, struct inode *, | ||
984 | struct ext4_dir_entry_2 *, | ||
985 | struct buffer_head *, unsigned long); | ||
986 | extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, | ||
987 | __u32 minor_hash, | ||
988 | struct ext4_dir_entry_2 *dirent); | ||
989 | extern void ext4_htree_free_dir_info(struct dir_private_info *p); | ||
990 | |||
991 | /* fsync.c */ | ||
992 | extern int ext4_sync_file (struct file *, struct dentry *, int); | ||
993 | |||
994 | /* hash.c */ | ||
995 | extern int ext4fs_dirhash(const char *name, int len, struct | ||
996 | dx_hash_info *hinfo); | ||
997 | |||
998 | /* ialloc.c */ | ||
999 | extern struct inode * ext4_new_inode (handle_t *, struct inode *, int); | ||
1000 | extern void ext4_free_inode (handle_t *, struct inode *); | ||
1001 | extern struct inode * ext4_orphan_get (struct super_block *, unsigned long); | ||
1002 | extern unsigned long ext4_count_free_inodes (struct super_block *); | ||
1003 | extern unsigned long ext4_count_dirs (struct super_block *); | ||
1004 | extern void ext4_check_inodes_bitmap (struct super_block *); | ||
1005 | extern unsigned long ext4_count_free (struct buffer_head *, unsigned); | ||
1006 | |||
1007 | /* mballoc.c */ | ||
1008 | extern long ext4_mb_stats; | ||
1009 | extern long ext4_mb_max_to_scan; | ||
1010 | extern int ext4_mb_init(struct super_block *, int); | ||
1011 | extern int ext4_mb_release(struct super_block *); | ||
1012 | extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, | ||
1013 | struct ext4_allocation_request *, int *); | ||
1014 | extern int ext4_mb_reserve_blocks(struct super_block *, int); | ||
1015 | extern void ext4_mb_discard_inode_preallocations(struct inode *); | ||
1016 | extern int __init init_ext4_mballoc(void); | ||
1017 | extern void exit_ext4_mballoc(void); | ||
1018 | extern void ext4_mb_free_blocks(handle_t *, struct inode *, | ||
1019 | unsigned long, unsigned long, int, unsigned long *); | ||
1020 | |||
1021 | |||
1022 | /* inode.c */ | ||
1023 | int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, | ||
1024 | struct buffer_head *bh, ext4_fsblk_t blocknr); | ||
1025 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, | ||
1026 | ext4_lblk_t, int, int *); | ||
1027 | struct buffer_head *ext4_bread(handle_t *, struct inode *, | ||
1028 | ext4_lblk_t, int, int *); | ||
1029 | int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, | ||
1030 | ext4_lblk_t iblock, unsigned long maxblocks, | ||
1031 | struct buffer_head *bh_result, | ||
1032 | int create, int extend_disksize); | ||
1033 | |||
1034 | extern struct inode *ext4_iget(struct super_block *, unsigned long); | ||
1035 | extern int ext4_write_inode (struct inode *, int); | ||
1036 | extern int ext4_setattr (struct dentry *, struct iattr *); | ||
1037 | extern void ext4_delete_inode (struct inode *); | ||
1038 | extern int ext4_sync_inode (handle_t *, struct inode *); | ||
1039 | extern void ext4_discard_reservation (struct inode *); | ||
1040 | extern void ext4_dirty_inode(struct inode *); | ||
1041 | extern int ext4_change_inode_journal_flag(struct inode *, int); | ||
1042 | extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); | ||
1043 | extern void ext4_truncate (struct inode *); | ||
1044 | extern void ext4_set_inode_flags(struct inode *); | ||
1045 | extern void ext4_get_inode_flags(struct ext4_inode_info *); | ||
1046 | extern void ext4_set_aops(struct inode *inode); | ||
1047 | extern int ext4_writepage_trans_blocks(struct inode *); | ||
1048 | extern int ext4_block_truncate_page(handle_t *handle, struct page *page, | ||
1049 | struct address_space *mapping, loff_t from); | ||
1050 | |||
1051 | /* ioctl.c */ | ||
1052 | extern int ext4_ioctl (struct inode *, struct file *, unsigned int, | ||
1053 | unsigned long); | ||
1054 | extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long); | ||
1055 | |||
1056 | /* migrate.c */ | ||
1057 | extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int, | ||
1058 | unsigned long); | ||
1059 | /* namei.c */ | ||
1060 | extern int ext4_orphan_add(handle_t *, struct inode *); | ||
1061 | extern int ext4_orphan_del(handle_t *, struct inode *); | ||
1062 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, | ||
1063 | __u32 start_minor_hash, __u32 *next_hash); | ||
1064 | |||
1065 | /* resize.c */ | ||
1066 | extern int ext4_group_add(struct super_block *sb, | ||
1067 | struct ext4_new_group_data *input); | ||
1068 | extern int ext4_group_extend(struct super_block *sb, | ||
1069 | struct ext4_super_block *es, | ||
1070 | ext4_fsblk_t n_blocks_count); | ||
1071 | |||
1072 | /* super.c */ | ||
1073 | extern void ext4_error (struct super_block *, const char *, const char *, ...) | ||
1074 | __attribute__ ((format (printf, 3, 4))); | ||
1075 | extern void __ext4_std_error (struct super_block *, const char *, int); | ||
1076 | extern void ext4_abort (struct super_block *, const char *, const char *, ...) | ||
1077 | __attribute__ ((format (printf, 3, 4))); | ||
1078 | extern void ext4_warning (struct super_block *, const char *, const char *, ...) | ||
1079 | __attribute__ ((format (printf, 3, 4))); | ||
1080 | extern void ext4_update_dynamic_rev (struct super_block *sb); | ||
1081 | extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb, | ||
1082 | __u32 compat); | ||
1083 | extern int ext4_update_rocompat_feature(handle_t *handle, | ||
1084 | struct super_block *sb, __u32 rocompat); | ||
1085 | extern int ext4_update_incompat_feature(handle_t *handle, | ||
1086 | struct super_block *sb, __u32 incompat); | ||
1087 | extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, | ||
1088 | struct ext4_group_desc *bg); | ||
1089 | extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, | ||
1090 | struct ext4_group_desc *bg); | ||
1091 | extern ext4_fsblk_t ext4_inode_table(struct super_block *sb, | ||
1092 | struct ext4_group_desc *bg); | ||
1093 | extern void ext4_block_bitmap_set(struct super_block *sb, | ||
1094 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | ||
1095 | extern void ext4_inode_bitmap_set(struct super_block *sb, | ||
1096 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | ||
1097 | extern void ext4_inode_table_set(struct super_block *sb, | ||
1098 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | ||
1099 | |||
1100 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) | ||
1101 | { | ||
1102 | return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) | | ||
1103 | le32_to_cpu(es->s_blocks_count_lo); | ||
1104 | } | ||
1105 | |||
1106 | static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es) | ||
1107 | { | ||
1108 | return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) | | ||
1109 | le32_to_cpu(es->s_r_blocks_count_lo); | ||
1110 | } | ||
1111 | |||
1112 | static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es) | ||
1113 | { | ||
1114 | return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) | | ||
1115 | le32_to_cpu(es->s_free_blocks_count_lo); | ||
1116 | } | ||
1117 | |||
1118 | static inline void ext4_blocks_count_set(struct ext4_super_block *es, | ||
1119 | ext4_fsblk_t blk) | ||
1120 | { | ||
1121 | es->s_blocks_count_lo = cpu_to_le32((u32)blk); | ||
1122 | es->s_blocks_count_hi = cpu_to_le32(blk >> 32); | ||
1123 | } | ||
1124 | |||
1125 | static inline void ext4_free_blocks_count_set(struct ext4_super_block *es, | ||
1126 | ext4_fsblk_t blk) | ||
1127 | { | ||
1128 | es->s_free_blocks_count_lo = cpu_to_le32((u32)blk); | ||
1129 | es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32); | ||
1130 | } | ||
1131 | |||
1132 | static inline void ext4_r_blocks_count_set(struct ext4_super_block *es, | ||
1133 | ext4_fsblk_t blk) | ||
1134 | { | ||
1135 | es->s_r_blocks_count_lo = cpu_to_le32((u32)blk); | ||
1136 | es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32); | ||
1137 | } | ||
1138 | |||
1139 | static inline loff_t ext4_isize(struct ext4_inode *raw_inode) | ||
1140 | { | ||
1141 | return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) | | ||
1142 | le32_to_cpu(raw_inode->i_size_lo); | ||
1143 | } | ||
1144 | |||
1145 | static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size) | ||
1146 | { | ||
1147 | raw_inode->i_size_lo = cpu_to_le32(i_size); | ||
1148 | raw_inode->i_size_high = cpu_to_le32(i_size >> 32); | ||
1149 | } | ||
1150 | |||
1151 | static inline | ||
1152 | struct ext4_group_info *ext4_get_group_info(struct super_block *sb, | ||
1153 | ext4_group_t group) | ||
1154 | { | ||
1155 | struct ext4_group_info ***grp_info; | ||
1156 | long indexv, indexh; | ||
1157 | grp_info = EXT4_SB(sb)->s_group_info; | ||
1158 | indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb)); | ||
1159 | indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1); | ||
1160 | return grp_info[indexv][indexh]; | ||
1161 | } | ||
1162 | |||
1163 | |||
1164 | #define ext4_std_error(sb, errno) \ | ||
1165 | do { \ | ||
1166 | if ((errno)) \ | ||
1167 | __ext4_std_error((sb), __FUNCTION__, (errno)); \ | ||
1168 | } while (0) | ||
1169 | |||
1170 | /* | ||
1171 | * Inodes and files operations | ||
1172 | */ | ||
1173 | |||
1174 | /* dir.c */ | ||
1175 | extern const struct file_operations ext4_dir_operations; | ||
1176 | |||
1177 | /* file.c */ | ||
1178 | extern const struct inode_operations ext4_file_inode_operations; | ||
1179 | extern const struct file_operations ext4_file_operations; | ||
1180 | |||
1181 | /* namei.c */ | ||
1182 | extern const struct inode_operations ext4_dir_inode_operations; | ||
1183 | extern const struct inode_operations ext4_special_inode_operations; | ||
1184 | |||
1185 | /* symlink.c */ | ||
1186 | extern const struct inode_operations ext4_symlink_inode_operations; | ||
1187 | extern const struct inode_operations ext4_fast_symlink_inode_operations; | ||
1188 | |||
1189 | /* extents.c */ | ||
1190 | extern int ext4_ext_tree_init(handle_t *handle, struct inode *); | ||
1191 | extern int ext4_ext_writepage_trans_blocks(struct inode *, int); | ||
1192 | extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | ||
1193 | ext4_lblk_t iblock, | ||
1194 | unsigned long max_blocks, struct buffer_head *bh_result, | ||
1195 | int create, int extend_disksize); | ||
1196 | extern void ext4_ext_truncate(struct inode *, struct page *); | ||
1197 | extern void ext4_ext_init(struct super_block *); | ||
1198 | extern void ext4_ext_release(struct super_block *); | ||
1199 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | ||
1200 | loff_t len); | ||
1201 | extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, | ||
1202 | sector_t block, unsigned long max_blocks, | ||
1203 | struct buffer_head *bh, int create, | ||
1204 | int extend_disksize); | ||
1205 | #endif /* __KERNEL__ */ | ||
1206 | |||
1207 | #endif /* _LINUX_EXT4_FS_H */ | ||
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h deleted file mode 100644 index 1285c583b2d8..000000000000 --- a/include/linux/ext4_fs_extents.h +++ /dev/null | |||
@@ -1,232 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com | ||
3 | * Written by Alex Tomas <alex@clusterfs.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public Licens | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- | ||
17 | */ | ||
18 | |||
19 | #ifndef _LINUX_EXT4_EXTENTS | ||
20 | #define _LINUX_EXT4_EXTENTS | ||
21 | |||
22 | #include <linux/ext4_fs.h> | ||
23 | |||
24 | /* | ||
25 | * With AGGRESSIVE_TEST defined, the capacity of index/leaf blocks | ||
26 | * becomes very small, so index split, in-depth growing and | ||
27 | * other hard changes happen much more often. | ||
28 | * This is for debug purposes only. | ||
29 | */ | ||
30 | #define AGGRESSIVE_TEST_ | ||
31 | |||
32 | /* | ||
33 | * With EXTENTS_STATS defined, the number of blocks and extents | ||
34 | * are collected in the truncate path. They'll be shown at | ||
35 | * umount time. | ||
36 | */ | ||
37 | #define EXTENTS_STATS__ | ||
38 | |||
39 | /* | ||
40 | * If CHECK_BINSEARCH is defined, then the results of the binary search | ||
41 | * will also be checked by linear search. | ||
42 | */ | ||
43 | #define CHECK_BINSEARCH__ | ||
44 | |||
45 | /* | ||
46 | * If EXT_DEBUG is defined you can use the 'extdebug' mount option | ||
47 | * to get lots of info about what's going on. | ||
48 | */ | ||
49 | #define EXT_DEBUG__ | ||
50 | #ifdef EXT_DEBUG | ||
51 | #define ext_debug(a...) printk(a) | ||
52 | #else | ||
53 | #define ext_debug(a...) | ||
54 | #endif | ||
55 | |||
56 | /* | ||
57 | * If EXT_STATS is defined then stats numbers are collected. | ||
58 | * These number will be displayed at umount time. | ||
59 | */ | ||
60 | #define EXT_STATS_ | ||
61 | |||
62 | |||
63 | /* | ||
64 | * ext4_inode has i_block array (60 bytes total). | ||
65 | * The first 12 bytes store ext4_extent_header; | ||
66 | * the remainder stores an array of ext4_extent. | ||
67 | */ | ||
68 | |||
69 | /* | ||
70 | * This is the extent on-disk structure. | ||
71 | * It's used at the bottom of the tree. | ||
72 | */ | ||
73 | struct ext4_extent { | ||
74 | __le32 ee_block; /* first logical block extent covers */ | ||
75 | __le16 ee_len; /* number of blocks covered by extent */ | ||
76 | __le16 ee_start_hi; /* high 16 bits of physical block */ | ||
77 | __le32 ee_start_lo; /* low 32 bits of physical block */ | ||
78 | }; | ||
79 | |||
80 | /* | ||
81 | * This is index on-disk structure. | ||
82 | * It's used at all the levels except the bottom. | ||
83 | */ | ||
84 | struct ext4_extent_idx { | ||
85 | __le32 ei_block; /* index covers logical blocks from 'block' */ | ||
86 | __le32 ei_leaf_lo; /* pointer to the physical block of the next * | ||
87 | * level. leaf or next index could be there */ | ||
88 | __le16 ei_leaf_hi; /* high 16 bits of physical block */ | ||
89 | __u16 ei_unused; | ||
90 | }; | ||
91 | |||
92 | /* | ||
93 | * Each block (leaves and indexes), even inode-stored has header. | ||
94 | */ | ||
95 | struct ext4_extent_header { | ||
96 | __le16 eh_magic; /* probably will support different formats */ | ||
97 | __le16 eh_entries; /* number of valid entries */ | ||
98 | __le16 eh_max; /* capacity of store in entries */ | ||
99 | __le16 eh_depth; /* has tree real underlying blocks? */ | ||
100 | __le32 eh_generation; /* generation of the tree */ | ||
101 | }; | ||
102 | |||
103 | #define EXT4_EXT_MAGIC cpu_to_le16(0xf30a) | ||
104 | |||
105 | /* | ||
106 | * Array of ext4_ext_path contains path to some extent. | ||
107 | * Creation/lookup routines use it for traversal/splitting/etc. | ||
108 | * Truncate uses it to simulate recursive walking. | ||
109 | */ | ||
110 | struct ext4_ext_path { | ||
111 | ext4_fsblk_t p_block; | ||
112 | __u16 p_depth; | ||
113 | struct ext4_extent *p_ext; | ||
114 | struct ext4_extent_idx *p_idx; | ||
115 | struct ext4_extent_header *p_hdr; | ||
116 | struct buffer_head *p_bh; | ||
117 | }; | ||
118 | |||
119 | /* | ||
120 | * structure for external API | ||
121 | */ | ||
122 | |||
123 | #define EXT4_EXT_CACHE_NO 0 | ||
124 | #define EXT4_EXT_CACHE_GAP 1 | ||
125 | #define EXT4_EXT_CACHE_EXTENT 2 | ||
126 | |||
127 | |||
128 | #define EXT_MAX_BLOCK 0xffffffff | ||
129 | |||
130 | /* | ||
131 | * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an | ||
132 | * initialized extent. This is 2^15 and not (2^16 - 1), since we use the | ||
133 | * MSB of ee_len field in the extent datastructure to signify if this | ||
134 | * particular extent is an initialized extent or an uninitialized (i.e. | ||
135 | * preallocated). | ||
136 | * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an | ||
137 | * uninitialized extent. | ||
138 | * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an | ||
139 | * uninitialized one. In other words, if MSB of ee_len is set, it is an | ||
140 | * uninitialized extent with only one special scenario when ee_len = 0x8000. | ||
141 | * In this case we can not have an uninitialized extent of zero length and | ||
142 | * thus we make it as a special case of initialized extent with 0x8000 length. | ||
143 | * This way we get better extent-to-group alignment for initialized extents. | ||
144 | * Hence, the maximum number of blocks we can have in an *initialized* | ||
145 | * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767). | ||
146 | */ | ||
147 | #define EXT_INIT_MAX_LEN (1UL << 15) | ||
148 | #define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1) | ||
149 | |||
150 | |||
151 | #define EXT_FIRST_EXTENT(__hdr__) \ | ||
152 | ((struct ext4_extent *) (((char *) (__hdr__)) + \ | ||
153 | sizeof(struct ext4_extent_header))) | ||
154 | #define EXT_FIRST_INDEX(__hdr__) \ | ||
155 | ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \ | ||
156 | sizeof(struct ext4_extent_header))) | ||
157 | #define EXT_HAS_FREE_INDEX(__path__) \ | ||
158 | (le16_to_cpu((__path__)->p_hdr->eh_entries) \ | ||
159 | < le16_to_cpu((__path__)->p_hdr->eh_max)) | ||
160 | #define EXT_LAST_EXTENT(__hdr__) \ | ||
161 | (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) | ||
162 | #define EXT_LAST_INDEX(__hdr__) \ | ||
163 | (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) | ||
164 | #define EXT_MAX_EXTENT(__hdr__) \ | ||
165 | (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) | ||
166 | #define EXT_MAX_INDEX(__hdr__) \ | ||
167 | (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) | ||
168 | |||
169 | static inline struct ext4_extent_header *ext_inode_hdr(struct inode *inode) | ||
170 | { | ||
171 | return (struct ext4_extent_header *) EXT4_I(inode)->i_data; | ||
172 | } | ||
173 | |||
174 | static inline struct ext4_extent_header *ext_block_hdr(struct buffer_head *bh) | ||
175 | { | ||
176 | return (struct ext4_extent_header *) bh->b_data; | ||
177 | } | ||
178 | |||
179 | static inline unsigned short ext_depth(struct inode *inode) | ||
180 | { | ||
181 | return le16_to_cpu(ext_inode_hdr(inode)->eh_depth); | ||
182 | } | ||
183 | |||
184 | static inline void ext4_ext_tree_changed(struct inode *inode) | ||
185 | { | ||
186 | EXT4_I(inode)->i_ext_generation++; | ||
187 | } | ||
188 | |||
189 | static inline void | ||
190 | ext4_ext_invalidate_cache(struct inode *inode) | ||
191 | { | ||
192 | EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO; | ||
193 | } | ||
194 | |||
195 | static inline void ext4_ext_mark_uninitialized(struct ext4_extent *ext) | ||
196 | { | ||
197 | /* We can not have an uninitialized extent of zero length! */ | ||
198 | BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0); | ||
199 | ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN); | ||
200 | } | ||
201 | |||
202 | static inline int ext4_ext_is_uninitialized(struct ext4_extent *ext) | ||
203 | { | ||
204 | /* Extent with ee_len of 0x8000 is treated as an initialized extent */ | ||
205 | return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN); | ||
206 | } | ||
207 | |||
208 | static inline int ext4_ext_get_actual_len(struct ext4_extent *ext) | ||
209 | { | ||
210 | return (le16_to_cpu(ext->ee_len) <= EXT_INIT_MAX_LEN ? | ||
211 | le16_to_cpu(ext->ee_len) : | ||
212 | (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN)); | ||
213 | } | ||
214 | |||
215 | extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *); | ||
216 | extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t); | ||
217 | extern int ext4_extent_tree_init(handle_t *, struct inode *); | ||
218 | extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); | ||
219 | extern int ext4_ext_try_to_merge(struct inode *inode, | ||
220 | struct ext4_ext_path *path, | ||
221 | struct ext4_extent *); | ||
222 | extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); | ||
223 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); | ||
224 | extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t, | ||
225 | struct ext4_ext_path *); | ||
226 | extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *, | ||
227 | ext4_lblk_t *, ext4_fsblk_t *); | ||
228 | extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *, | ||
229 | ext4_lblk_t *, ext4_fsblk_t *); | ||
230 | extern void ext4_ext_drop_refs(struct ext4_ext_path *); | ||
231 | #endif /* _LINUX_EXT4_EXTENTS */ | ||
232 | |||
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h deleted file mode 100644 index d5508d3cf290..000000000000 --- a/include/linux/ext4_fs_i.h +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext4_fs_i.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_i.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT4_FS_I | ||
17 | #define _LINUX_EXT4_FS_I | ||
18 | |||
19 | #include <linux/rwsem.h> | ||
20 | #include <linux/rbtree.h> | ||
21 | #include <linux/seqlock.h> | ||
22 | #include <linux/mutex.h> | ||
23 | |||
24 | /* data type for block offset of block group */ | ||
25 | typedef int ext4_grpblk_t; | ||
26 | |||
27 | /* data type for filesystem-wide blocks number */ | ||
28 | typedef unsigned long long ext4_fsblk_t; | ||
29 | |||
30 | /* data type for file logical block number */ | ||
31 | typedef __u32 ext4_lblk_t; | ||
32 | |||
33 | /* data type for block group number */ | ||
34 | typedef unsigned long ext4_group_t; | ||
35 | |||
36 | struct ext4_reserve_window { | ||
37 | ext4_fsblk_t _rsv_start; /* First byte reserved */ | ||
38 | ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | ||
39 | }; | ||
40 | |||
41 | struct ext4_reserve_window_node { | ||
42 | struct rb_node rsv_node; | ||
43 | __u32 rsv_goal_size; | ||
44 | __u32 rsv_alloc_hit; | ||
45 | struct ext4_reserve_window rsv_window; | ||
46 | }; | ||
47 | |||
48 | struct ext4_block_alloc_info { | ||
49 | /* information about reservation window */ | ||
50 | struct ext4_reserve_window_node rsv_window_node; | ||
51 | /* | ||
52 | * was i_next_alloc_block in ext4_inode_info | ||
53 | * is the logical (file-relative) number of the | ||
54 | * most-recently-allocated block in this file. | ||
55 | * We use this for detecting linearly ascending allocation requests. | ||
56 | */ | ||
57 | ext4_lblk_t last_alloc_logical_block; | ||
58 | /* | ||
59 | * Was i_next_alloc_goal in ext4_inode_info | ||
60 | * is the *physical* companion to i_next_alloc_block. | ||
61 | * it the physical block number of the block which was most-recentl | ||
62 | * allocated to this file. This give us the goal (target) for the next | ||
63 | * allocation when we detect linearly ascending requests. | ||
64 | */ | ||
65 | ext4_fsblk_t last_alloc_physical_block; | ||
66 | }; | ||
67 | |||
68 | #define rsv_start rsv_window._rsv_start | ||
69 | #define rsv_end rsv_window._rsv_end | ||
70 | |||
71 | /* | ||
72 | * storage for cached extent | ||
73 | */ | ||
74 | struct ext4_ext_cache { | ||
75 | ext4_fsblk_t ec_start; | ||
76 | ext4_lblk_t ec_block; | ||
77 | __u32 ec_len; /* must be 32bit to return holes */ | ||
78 | __u32 ec_type; | ||
79 | }; | ||
80 | |||
81 | /* | ||
82 | * third extended file system inode data in memory | ||
83 | */ | ||
84 | struct ext4_inode_info { | ||
85 | __le32 i_data[15]; /* unconverted */ | ||
86 | __u32 i_flags; | ||
87 | ext4_fsblk_t i_file_acl; | ||
88 | __u32 i_dtime; | ||
89 | |||
90 | /* | ||
91 | * i_block_group is the number of the block group which contains | ||
92 | * this file's inode. Constant across the lifetime of the inode, | ||
93 | * it is ued for making block allocation decisions - we try to | ||
94 | * place a file's data blocks near its inode block, and new inodes | ||
95 | * near to their parent directory's inode. | ||
96 | */ | ||
97 | ext4_group_t i_block_group; | ||
98 | __u32 i_state; /* Dynamic state flags for ext4 */ | ||
99 | |||
100 | /* block reservation info */ | ||
101 | struct ext4_block_alloc_info *i_block_alloc_info; | ||
102 | |||
103 | ext4_lblk_t i_dir_start_lookup; | ||
104 | #ifdef CONFIG_EXT4DEV_FS_XATTR | ||
105 | /* | ||
106 | * Extended attributes can be read independently of the main file | ||
107 | * data. Taking i_mutex even when reading would cause contention | ||
108 | * between readers of EAs and writers of regular file data, so | ||
109 | * instead we synchronize on xattr_sem when reading or changing | ||
110 | * EAs. | ||
111 | */ | ||
112 | struct rw_semaphore xattr_sem; | ||
113 | #endif | ||
114 | #ifdef CONFIG_EXT4DEV_FS_POSIX_ACL | ||
115 | struct posix_acl *i_acl; | ||
116 | struct posix_acl *i_default_acl; | ||
117 | #endif | ||
118 | |||
119 | struct list_head i_orphan; /* unlinked but open inodes */ | ||
120 | |||
121 | /* | ||
122 | * i_disksize keeps track of what the inode size is ON DISK, not | ||
123 | * in memory. During truncate, i_size is set to the new size by | ||
124 | * the VFS prior to calling ext4_truncate(), but the filesystem won't | ||
125 | * set i_disksize to 0 until the truncate is actually under way. | ||
126 | * | ||
127 | * The intent is that i_disksize always represents the blocks which | ||
128 | * are used by this file. This allows recovery to restart truncate | ||
129 | * on orphans if we crash during truncate. We actually write i_disksize | ||
130 | * into the on-disk inode when writing inodes out, instead of i_size. | ||
131 | * | ||
132 | * The only time when i_disksize and i_size may be different is when | ||
133 | * a truncate is in progress. The only things which change i_disksize | ||
134 | * are ext4_get_block (growth) and ext4_truncate (shrinkth). | ||
135 | */ | ||
136 | loff_t i_disksize; | ||
137 | |||
138 | /* on-disk additional length */ | ||
139 | __u16 i_extra_isize; | ||
140 | |||
141 | /* | ||
142 | * i_data_sem is for serialising ext4_truncate() against | ||
143 | * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's | ||
144 | * data tree are chopped off during truncate. We can't do that in | ||
145 | * ext4 because whenever we perform intermediate commits during | ||
146 | * truncate, the inode and all the metadata blocks *must* be in a | ||
147 | * consistent state which allows truncation of the orphans to restart | ||
148 | * during recovery. Hence we must fix the get_block-vs-truncate race | ||
149 | * by other means, so we have i_data_sem. | ||
150 | */ | ||
151 | struct rw_semaphore i_data_sem; | ||
152 | struct inode vfs_inode; | ||
153 | |||
154 | unsigned long i_ext_generation; | ||
155 | struct ext4_ext_cache i_cached_extent; | ||
156 | /* | ||
157 | * File creation time. Its function is same as that of | ||
158 | * struct timespec i_{a,c,m}time in the generic inode. | ||
159 | */ | ||
160 | struct timespec i_crtime; | ||
161 | |||
162 | /* mballoc */ | ||
163 | struct list_head i_prealloc_list; | ||
164 | spinlock_t i_prealloc_lock; | ||
165 | }; | ||
166 | |||
167 | #endif /* _LINUX_EXT4_FS_I */ | ||
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h deleted file mode 100644 index abaae2c8cccf..000000000000 --- a/include/linux/ext4_fs_sb.h +++ /dev/null | |||
@@ -1,148 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext4_fs_sb.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_sb.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT4_FS_SB | ||
17 | #define _LINUX_EXT4_FS_SB | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/wait.h> | ||
22 | #include <linux/blockgroup_lock.h> | ||
23 | #include <linux/percpu_counter.h> | ||
24 | #endif | ||
25 | #include <linux/rbtree.h> | ||
26 | |||
27 | /* | ||
28 | * third extended-fs super-block data in memory | ||
29 | */ | ||
30 | struct ext4_sb_info { | ||
31 | unsigned long s_desc_size; /* Size of a group descriptor in bytes */ | ||
32 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
33 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
34 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
35 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
36 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
37 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
38 | ext4_group_t s_groups_count; /* Number of groups in the fs */ | ||
39 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
40 | unsigned long s_blocks_last; /* Last seen block count */ | ||
41 | loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */ | ||
42 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
43 | struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ | ||
44 | struct buffer_head ** s_group_desc; | ||
45 | unsigned long s_mount_opt; | ||
46 | ext4_fsblk_t s_sb_block; | ||
47 | uid_t s_resuid; | ||
48 | gid_t s_resgid; | ||
49 | unsigned short s_mount_state; | ||
50 | unsigned short s_pad; | ||
51 | int s_addr_per_block_bits; | ||
52 | int s_desc_per_block_bits; | ||
53 | int s_inode_size; | ||
54 | int s_first_ino; | ||
55 | spinlock_t s_next_gen_lock; | ||
56 | u32 s_next_generation; | ||
57 | u32 s_hash_seed[4]; | ||
58 | int s_def_hash_version; | ||
59 | struct percpu_counter s_freeblocks_counter; | ||
60 | struct percpu_counter s_freeinodes_counter; | ||
61 | struct percpu_counter s_dirs_counter; | ||
62 | struct blockgroup_lock s_blockgroup_lock; | ||
63 | |||
64 | /* root of the per fs reservation window tree */ | ||
65 | spinlock_t s_rsv_window_lock; | ||
66 | struct rb_root s_rsv_window_root; | ||
67 | struct ext4_reserve_window_node s_rsv_window_head; | ||
68 | |||
69 | /* Journaling */ | ||
70 | struct inode * s_journal_inode; | ||
71 | struct journal_s * s_journal; | ||
72 | struct list_head s_orphan; | ||
73 | unsigned long s_commit_interval; | ||
74 | struct block_device *journal_bdev; | ||
75 | #ifdef CONFIG_JBD2_DEBUG | ||
76 | struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ | ||
77 | wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ | ||
78 | #endif | ||
79 | #ifdef CONFIG_QUOTA | ||
80 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | ||
81 | int s_jquota_fmt; /* Format of quota to use */ | ||
82 | #endif | ||
83 | unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
84 | |||
85 | #ifdef EXTENTS_STATS | ||
86 | /* ext4 extents stats */ | ||
87 | unsigned long s_ext_min; | ||
88 | unsigned long s_ext_max; | ||
89 | unsigned long s_depth_max; | ||
90 | spinlock_t s_ext_stats_lock; | ||
91 | unsigned long s_ext_blocks; | ||
92 | unsigned long s_ext_extents; | ||
93 | #endif | ||
94 | |||
95 | /* for buddy allocator */ | ||
96 | struct ext4_group_info ***s_group_info; | ||
97 | struct inode *s_buddy_cache; | ||
98 | long s_blocks_reserved; | ||
99 | spinlock_t s_reserve_lock; | ||
100 | struct list_head s_active_transaction; | ||
101 | struct list_head s_closed_transaction; | ||
102 | struct list_head s_committed_transaction; | ||
103 | spinlock_t s_md_lock; | ||
104 | tid_t s_last_transaction; | ||
105 | unsigned short *s_mb_offsets, *s_mb_maxs; | ||
106 | |||
107 | /* tunables */ | ||
108 | unsigned long s_stripe; | ||
109 | unsigned long s_mb_stream_request; | ||
110 | unsigned long s_mb_max_to_scan; | ||
111 | unsigned long s_mb_min_to_scan; | ||
112 | unsigned long s_mb_stats; | ||
113 | unsigned long s_mb_order2_reqs; | ||
114 | unsigned long s_mb_group_prealloc; | ||
115 | /* where last allocation was done - for stream allocation */ | ||
116 | unsigned long s_mb_last_group; | ||
117 | unsigned long s_mb_last_start; | ||
118 | |||
119 | /* history to debug policy */ | ||
120 | struct ext4_mb_history *s_mb_history; | ||
121 | int s_mb_history_cur; | ||
122 | int s_mb_history_max; | ||
123 | int s_mb_history_num; | ||
124 | struct proc_dir_entry *s_mb_proc; | ||
125 | spinlock_t s_mb_history_lock; | ||
126 | int s_mb_history_filter; | ||
127 | |||
128 | /* stats for buddy allocator */ | ||
129 | spinlock_t s_mb_pa_lock; | ||
130 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ | ||
131 | atomic_t s_bal_success; /* we found long enough chunks */ | ||
132 | atomic_t s_bal_allocated; /* in blocks */ | ||
133 | atomic_t s_bal_ex_scanned; /* total extents scanned */ | ||
134 | atomic_t s_bal_goals; /* goal hits */ | ||
135 | atomic_t s_bal_breaks; /* too long searches */ | ||
136 | atomic_t s_bal_2orders; /* 2^order hits */ | ||
137 | spinlock_t s_bal_lock; | ||
138 | unsigned long s_mb_buddies_generated; | ||
139 | unsigned long long s_mb_generation_time; | ||
140 | atomic_t s_mb_lost_chunks; | ||
141 | atomic_t s_mb_preallocated; | ||
142 | atomic_t s_mb_discarded; | ||
143 | |||
144 | /* locality groups */ | ||
145 | struct ext4_locality_group *s_locality_groups; | ||
146 | }; | ||
147 | |||
148 | #endif /* _LINUX_EXT4_FS_SB */ | ||
diff --git a/include/linux/ext4_jbd2.h b/include/linux/ext4_jbd2.h deleted file mode 100644 index 38c71d3c8dbf..000000000000 --- a/include/linux/ext4_jbd2.h +++ /dev/null | |||
@@ -1,231 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext4_jbd2.h | ||
3 | * | ||
4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 | ||
5 | * | ||
6 | * Copyright 1998--1999 Red Hat corp --- All Rights Reserved | ||
7 | * | ||
8 | * This file is part of the Linux kernel and is made available under | ||
9 | * the terms of the GNU General Public License, version 2, or at your | ||
10 | * option, any later version, incorporated herein by reference. | ||
11 | * | ||
12 | * Ext4-specific journaling extensions. | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_EXT4_JBD2_H | ||
16 | #define _LINUX_EXT4_JBD2_H | ||
17 | |||
18 | #include <linux/fs.h> | ||
19 | #include <linux/jbd2.h> | ||
20 | #include <linux/ext4_fs.h> | ||
21 | |||
22 | #define EXT4_JOURNAL(inode) (EXT4_SB((inode)->i_sb)->s_journal) | ||
23 | |||
24 | /* Define the number of blocks we need to account to a transaction to | ||
25 | * modify one block of data. | ||
26 | * | ||
27 | * We may have to touch one inode, one bitmap buffer, up to three | ||
28 | * indirection blocks, the group and superblock summaries, and the data | ||
29 | * block to complete the transaction. | ||
30 | * | ||
31 | * For extents-enabled fs we may have to allocate and modify up to | ||
32 | * 5 levels of tree + root which are stored in the inode. */ | ||
33 | |||
34 | #define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \ | ||
35 | (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \ | ||
36 | || test_opt(sb, EXTENTS) ? 27U : 8U) | ||
37 | |||
38 | /* Extended attribute operations touch at most two data buffers, | ||
39 | * two bitmap buffers, and two group summaries, in addition to the inode | ||
40 | * and the superblock, which are already accounted for. */ | ||
41 | |||
42 | #define EXT4_XATTR_TRANS_BLOCKS 6U | ||
43 | |||
44 | /* Define the minimum size for a transaction which modifies data. This | ||
45 | * needs to take into account the fact that we may end up modifying two | ||
46 | * quota files too (one for the group, one for the user quota). The | ||
47 | * superblock only gets updated once, of course, so don't bother | ||
48 | * counting that again for the quota updates. */ | ||
49 | |||
50 | #define EXT4_DATA_TRANS_BLOCKS(sb) (EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + \ | ||
51 | EXT4_XATTR_TRANS_BLOCKS - 2 + \ | ||
52 | 2*EXT4_QUOTA_TRANS_BLOCKS(sb)) | ||
53 | |||
54 | /* Delete operations potentially hit one directory's namespace plus an | ||
55 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | ||
56 | * generous. We can grow the delete transaction later if necessary. */ | ||
57 | |||
58 | #define EXT4_DELETE_TRANS_BLOCKS(sb) (2 * EXT4_DATA_TRANS_BLOCKS(sb) + 64) | ||
59 | |||
60 | /* Define an arbitrary limit for the amount of data we will anticipate | ||
61 | * writing to any given transaction. For unbounded transactions such as | ||
62 | * write(2) and truncate(2) we can write more than this, but we always | ||
63 | * start off at the maximum transaction size and grow the transaction | ||
64 | * optimistically as we go. */ | ||
65 | |||
66 | #define EXT4_MAX_TRANS_DATA 64U | ||
67 | |||
68 | /* We break up a large truncate or write transaction once the handle's | ||
69 | * buffer credits gets this low, we need either to extend the | ||
70 | * transaction or to start a new one. Reserve enough space here for | ||
71 | * inode, bitmap, superblock, group and indirection updates for at least | ||
72 | * one block, plus two quota updates. Quota allocations are not | ||
73 | * needed. */ | ||
74 | |||
75 | #define EXT4_RESERVE_TRANS_BLOCKS 12U | ||
76 | |||
77 | #define EXT4_INDEX_EXTRA_TRANS_BLOCKS 8 | ||
78 | |||
79 | #ifdef CONFIG_QUOTA | ||
80 | /* Amount of blocks needed for quota update - we know that the structure was | ||
81 | * allocated so we need to update only inode+data */ | ||
82 | #define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) | ||
83 | /* Amount of blocks needed for quota insert/delete - we do some block writes | ||
84 | * but inode, sb and group updates are done only once */ | ||
85 | #define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ | ||
86 | (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0) | ||
87 | #define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ | ||
88 | (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0) | ||
89 | #else | ||
90 | #define EXT4_QUOTA_TRANS_BLOCKS(sb) 0 | ||
91 | #define EXT4_QUOTA_INIT_BLOCKS(sb) 0 | ||
92 | #define EXT4_QUOTA_DEL_BLOCKS(sb) 0 | ||
93 | #endif | ||
94 | |||
95 | int | ||
96 | ext4_mark_iloc_dirty(handle_t *handle, | ||
97 | struct inode *inode, | ||
98 | struct ext4_iloc *iloc); | ||
99 | |||
100 | /* | ||
101 | * On success, We end up with an outstanding reference count against | ||
102 | * iloc->bh. This _must_ be cleaned up later. | ||
103 | */ | ||
104 | |||
105 | int ext4_reserve_inode_write(handle_t *handle, struct inode *inode, | ||
106 | struct ext4_iloc *iloc); | ||
107 | |||
108 | int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); | ||
109 | |||
110 | /* | ||
111 | * Wrapper functions with which ext4 calls into JBD. The intent here is | ||
112 | * to allow these to be turned into appropriate stubs so ext4 can control | ||
113 | * ext2 filesystems, so ext2+ext4 systems only nee one fs. This work hasn't | ||
114 | * been done yet. | ||
115 | */ | ||
116 | |||
117 | static inline void ext4_journal_release_buffer(handle_t *handle, | ||
118 | struct buffer_head *bh) | ||
119 | { | ||
120 | jbd2_journal_release_buffer(handle, bh); | ||
121 | } | ||
122 | |||
123 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, | ||
124 | struct buffer_head *bh, handle_t *handle, int err); | ||
125 | |||
126 | int __ext4_journal_get_undo_access(const char *where, handle_t *handle, | ||
127 | struct buffer_head *bh); | ||
128 | |||
129 | int __ext4_journal_get_write_access(const char *where, handle_t *handle, | ||
130 | struct buffer_head *bh); | ||
131 | |||
132 | int __ext4_journal_forget(const char *where, handle_t *handle, | ||
133 | struct buffer_head *bh); | ||
134 | |||
135 | int __ext4_journal_revoke(const char *where, handle_t *handle, | ||
136 | ext4_fsblk_t blocknr, struct buffer_head *bh); | ||
137 | |||
138 | int __ext4_journal_get_create_access(const char *where, | ||
139 | handle_t *handle, struct buffer_head *bh); | ||
140 | |||
141 | int __ext4_journal_dirty_metadata(const char *where, | ||
142 | handle_t *handle, struct buffer_head *bh); | ||
143 | |||
144 | #define ext4_journal_get_undo_access(handle, bh) \ | ||
145 | __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh)) | ||
146 | #define ext4_journal_get_write_access(handle, bh) \ | ||
147 | __ext4_journal_get_write_access(__FUNCTION__, (handle), (bh)) | ||
148 | #define ext4_journal_revoke(handle, blocknr, bh) \ | ||
149 | __ext4_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh)) | ||
150 | #define ext4_journal_get_create_access(handle, bh) \ | ||
151 | __ext4_journal_get_create_access(__FUNCTION__, (handle), (bh)) | ||
152 | #define ext4_journal_dirty_metadata(handle, bh) \ | ||
153 | __ext4_journal_dirty_metadata(__FUNCTION__, (handle), (bh)) | ||
154 | #define ext4_journal_forget(handle, bh) \ | ||
155 | __ext4_journal_forget(__FUNCTION__, (handle), (bh)) | ||
156 | |||
157 | int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh); | ||
158 | |||
159 | handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks); | ||
160 | int __ext4_journal_stop(const char *where, handle_t *handle); | ||
161 | |||
162 | static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks) | ||
163 | { | ||
164 | return ext4_journal_start_sb(inode->i_sb, nblocks); | ||
165 | } | ||
166 | |||
167 | #define ext4_journal_stop(handle) \ | ||
168 | __ext4_journal_stop(__FUNCTION__, (handle)) | ||
169 | |||
170 | static inline handle_t *ext4_journal_current_handle(void) | ||
171 | { | ||
172 | return journal_current_handle(); | ||
173 | } | ||
174 | |||
175 | static inline int ext4_journal_extend(handle_t *handle, int nblocks) | ||
176 | { | ||
177 | return jbd2_journal_extend(handle, nblocks); | ||
178 | } | ||
179 | |||
180 | static inline int ext4_journal_restart(handle_t *handle, int nblocks) | ||
181 | { | ||
182 | return jbd2_journal_restart(handle, nblocks); | ||
183 | } | ||
184 | |||
185 | static inline int ext4_journal_blocks_per_page(struct inode *inode) | ||
186 | { | ||
187 | return jbd2_journal_blocks_per_page(inode); | ||
188 | } | ||
189 | |||
190 | static inline int ext4_journal_force_commit(journal_t *journal) | ||
191 | { | ||
192 | return jbd2_journal_force_commit(journal); | ||
193 | } | ||
194 | |||
195 | /* super.c */ | ||
196 | int ext4_force_commit(struct super_block *sb); | ||
197 | |||
198 | static inline int ext4_should_journal_data(struct inode *inode) | ||
199 | { | ||
200 | if (!S_ISREG(inode->i_mode)) | ||
201 | return 1; | ||
202 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) | ||
203 | return 1; | ||
204 | if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) | ||
205 | return 1; | ||
206 | return 0; | ||
207 | } | ||
208 | |||
209 | static inline int ext4_should_order_data(struct inode *inode) | ||
210 | { | ||
211 | if (!S_ISREG(inode->i_mode)) | ||
212 | return 0; | ||
213 | if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) | ||
214 | return 0; | ||
215 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) | ||
216 | return 1; | ||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | static inline int ext4_should_writeback_data(struct inode *inode) | ||
221 | { | ||
222 | if (!S_ISREG(inode->i_mode)) | ||
223 | return 0; | ||
224 | if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) | ||
225 | return 0; | ||
226 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA) | ||
227 | return 1; | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | #endif /* _LINUX_EXT4_JBD2_H */ | ||
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 | |||
794 | struct fb_info { | 805 | struct 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); | |||
970 | extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, | 977 | extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, |
971 | int datasync); | 978 | int datasync); |
972 | 979 | ||
980 | static 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 */ |
974 | extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); | 1000 | extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); |
975 | extern void framebuffer_release(struct fb_info *info); | 1001 | extern void framebuffer_release(struct fb_info *info); |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h new file mode 100644 index 000000000000..a118f3c0b240 --- /dev/null +++ b/include/linux/fdtable.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * descriptor table internals; you almost certainly want file.h instead. | ||
3 | */ | ||
4 | |||
5 | #ifndef __LINUX_FDTABLE_H | ||
6 | #define __LINUX_FDTABLE_H | ||
7 | |||
8 | #include <asm/atomic.h> | ||
9 | #include <linux/posix_types.h> | ||
10 | #include <linux/compiler.h> | ||
11 | #include <linux/spinlock.h> | ||
12 | #include <linux/rcupdate.h> | ||
13 | #include <linux/types.h> | ||
14 | |||
15 | /* | ||
16 | * The default fd array needs to be at least BITS_PER_LONG, | ||
17 | * as this is the granularity returned by copy_fdset(). | ||
18 | */ | ||
19 | #define NR_OPEN_DEFAULT BITS_PER_LONG | ||
20 | |||
21 | /* | ||
22 | * The embedded_fd_set is a small fd_set, | ||
23 | * suitable for most tasks (which open <= BITS_PER_LONG files) | ||
24 | */ | ||
25 | struct embedded_fd_set { | ||
26 | unsigned long fds_bits[1]; | ||
27 | }; | ||
28 | |||
29 | struct fdtable { | ||
30 | unsigned int max_fds; | ||
31 | struct file ** fd; /* current fd array */ | ||
32 | fd_set *close_on_exec; | ||
33 | fd_set *open_fds; | ||
34 | struct rcu_head rcu; | ||
35 | struct fdtable *next; | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * Open file table structure | ||
40 | */ | ||
41 | struct files_struct { | ||
42 | /* | ||
43 | * read mostly part | ||
44 | */ | ||
45 | atomic_t count; | ||
46 | struct fdtable *fdt; | ||
47 | struct fdtable fdtab; | ||
48 | /* | ||
49 | * written part on a separate cache line in SMP | ||
50 | */ | ||
51 | spinlock_t file_lock ____cacheline_aligned_in_smp; | ||
52 | int next_fd; | ||
53 | struct embedded_fd_set close_on_exec_init; | ||
54 | struct embedded_fd_set open_fds_init; | ||
55 | struct file * fd_array[NR_OPEN_DEFAULT]; | ||
56 | }; | ||
57 | |||
58 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) | ||
59 | |||
60 | extern struct kmem_cache *filp_cachep; | ||
61 | |||
62 | struct file_operations; | ||
63 | struct vfsmount; | ||
64 | struct dentry; | ||
65 | |||
66 | extern int expand_files(struct files_struct *, int nr); | ||
67 | extern void free_fdtable_rcu(struct rcu_head *rcu); | ||
68 | extern void __init files_defer_init(void); | ||
69 | |||
70 | static inline void free_fdtable(struct fdtable *fdt) | ||
71 | { | ||
72 | call_rcu(&fdt->rcu, free_fdtable_rcu); | ||
73 | } | ||
74 | |||
75 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) | ||
76 | { | ||
77 | struct file * file = NULL; | ||
78 | struct fdtable *fdt = files_fdtable(files); | ||
79 | |||
80 | if (fd < fdt->max_fds) | ||
81 | file = rcu_dereference(fdt->fd[fd]); | ||
82 | return file; | ||
83 | } | ||
84 | |||
85 | /* | ||
86 | * Check whether the specified fd has an open file. | ||
87 | */ | ||
88 | #define fcheck(fd) fcheck_files(current->files, fd) | ||
89 | |||
90 | struct task_struct; | ||
91 | |||
92 | struct files_struct *get_files_struct(struct task_struct *); | ||
93 | void put_files_struct(struct files_struct *fs); | ||
94 | void reset_files_struct(struct files_struct *); | ||
95 | int unshare_files(struct files_struct **); | ||
96 | |||
97 | extern struct kmem_cache *files_cachep; | ||
98 | |||
99 | #endif /* __LINUX_FDTABLE_H */ | ||
diff --git a/include/linux/file.h b/include/linux/file.h index 69baf5a4f0a5..27c64bdc68c9 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -5,59 +5,11 @@ | |||
5 | #ifndef __LINUX_FILE_H | 5 | #ifndef __LINUX_FILE_H |
6 | #define __LINUX_FILE_H | 6 | #define __LINUX_FILE_H |
7 | 7 | ||
8 | #include <asm/atomic.h> | ||
9 | #include <linux/posix_types.h> | ||
10 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
11 | #include <linux/spinlock.h> | ||
12 | #include <linux/rcupdate.h> | ||
13 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/posix_types.h> | ||
14 | 11 | ||
15 | /* | 12 | struct file; |
16 | * The default fd array needs to be at least BITS_PER_LONG, | ||
17 | * as this is the granularity returned by copy_fdset(). | ||
18 | */ | ||
19 | #define NR_OPEN_DEFAULT BITS_PER_LONG | ||
20 | |||
21 | /* | ||
22 | * The embedded_fd_set is a small fd_set, | ||
23 | * suitable for most tasks (which open <= BITS_PER_LONG files) | ||
24 | */ | ||
25 | struct embedded_fd_set { | ||
26 | unsigned long fds_bits[1]; | ||
27 | }; | ||
28 | |||
29 | struct fdtable { | ||
30 | unsigned int max_fds; | ||
31 | struct file ** fd; /* current fd array */ | ||
32 | fd_set *close_on_exec; | ||
33 | fd_set *open_fds; | ||
34 | struct rcu_head rcu; | ||
35 | struct fdtable *next; | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * Open file table structure | ||
40 | */ | ||
41 | struct files_struct { | ||
42 | /* | ||
43 | * read mostly part | ||
44 | */ | ||
45 | atomic_t count; | ||
46 | struct fdtable *fdt; | ||
47 | struct fdtable fdtab; | ||
48 | /* | ||
49 | * written part on a separate cache line in SMP | ||
50 | */ | ||
51 | spinlock_t file_lock ____cacheline_aligned_in_smp; | ||
52 | int next_fd; | ||
53 | struct embedded_fd_set close_on_exec_init; | ||
54 | struct embedded_fd_set open_fds_init; | ||
55 | struct file * fd_array[NR_OPEN_DEFAULT]; | ||
56 | }; | ||
57 | |||
58 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) | ||
59 | |||
60 | extern struct kmem_cache *filp_cachep; | ||
61 | 13 | ||
62 | extern void __fput(struct file *); | 14 | extern void __fput(struct file *); |
63 | extern void fput(struct file *); | 15 | extern void fput(struct file *); |
@@ -85,41 +37,7 @@ extern void put_filp(struct file *); | |||
85 | extern int get_unused_fd(void); | 37 | extern int get_unused_fd(void); |
86 | extern int get_unused_fd_flags(int flags); | 38 | extern int get_unused_fd_flags(int flags); |
87 | extern void put_unused_fd(unsigned int fd); | 39 | extern void put_unused_fd(unsigned int fd); |
88 | struct kmem_cache; | ||
89 | |||
90 | extern int expand_files(struct files_struct *, int nr); | ||
91 | extern void free_fdtable_rcu(struct rcu_head *rcu); | ||
92 | extern void __init files_defer_init(void); | ||
93 | |||
94 | static inline void free_fdtable(struct fdtable *fdt) | ||
95 | { | ||
96 | call_rcu(&fdt->rcu, free_fdtable_rcu); | ||
97 | } | ||
98 | |||
99 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) | ||
100 | { | ||
101 | struct file * file = NULL; | ||
102 | struct fdtable *fdt = files_fdtable(files); | ||
103 | |||
104 | if (fd < fdt->max_fds) | ||
105 | file = rcu_dereference(fdt->fd[fd]); | ||
106 | return file; | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * Check whether the specified fd has an open file. | ||
111 | */ | ||
112 | #define fcheck(fd) fcheck_files(current->files, fd) | ||
113 | 40 | ||
114 | extern void fd_install(unsigned int fd, struct file *file); | 41 | extern void fd_install(unsigned int fd, struct file *file); |
115 | 42 | ||
116 | struct task_struct; | ||
117 | |||
118 | struct files_struct *get_files_struct(struct task_struct *); | ||
119 | void put_files_struct(struct files_struct *fs); | ||
120 | void reset_files_struct(struct files_struct *); | ||
121 | int unshare_files(struct files_struct **); | ||
122 | |||
123 | extern struct kmem_cache *files_cachep; | ||
124 | |||
125 | #endif /* __LINUX_FILE_H */ | 43 | #endif /* __LINUX_FILE_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index d6d7c52055c6..a1ba005d08e7 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 *); |
@@ -1520,7 +1521,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *, | |||
1520 | const struct super_operations *ops, unsigned long, | 1521 | const struct super_operations *ops, unsigned long, |
1521 | struct vfsmount *mnt); | 1522 | struct vfsmount *mnt); |
1522 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1523 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1523 | int __put_super(struct super_block *sb); | ||
1524 | int __put_super_and_need_restart(struct super_block *sb); | 1524 | int __put_super_and_need_restart(struct super_block *sb); |
1525 | void unnamed_dev_init(void); | 1525 | void unnamed_dev_init(void); |
1526 | 1526 | ||
@@ -1964,7 +1964,6 @@ extern int vfs_stat_fd(int dfd, char __user *, struct kstat *); | |||
1964 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); | 1964 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); |
1965 | extern int vfs_fstat(unsigned int, struct kstat *); | 1965 | extern int vfs_fstat(unsigned int, struct kstat *); |
1966 | 1966 | ||
1967 | extern long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | ||
1968 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 1967 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
1969 | unsigned long arg); | 1968 | unsigned long arg); |
1970 | 1969 | ||
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 2cad5c67397e..c415a496de3a 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -14,7 +14,6 @@ | |||
14 | * option) any later version. | 14 | * option) any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifdef __KERNEL__ | ||
18 | #ifndef _FSL_DEVICE_H_ | 17 | #ifndef _FSL_DEVICE_H_ |
19 | #define _FSL_DEVICE_H_ | 18 | #define _FSL_DEVICE_H_ |
20 | 19 | ||
@@ -127,4 +126,3 @@ struct mpc8xx_pcmcia_ops { | |||
127 | }; | 126 | }; |
128 | 127 | ||
129 | #endif /* _FSL_DEVICE_H_ */ | 128 | #endif /* _FSL_DEVICE_H_ */ |
130 | #endif /* __KERNEL__ */ | ||
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index d4b7c4ac72e6..a89513188ce7 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -11,8 +11,6 @@ | |||
11 | * (C) Copyright 2005 Robert Love | 11 | * (C) Copyright 2005 Robert Love |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <linux/dnotify.h> | 14 | #include <linux/dnotify.h> |
17 | #include <linux/inotify.h> | 15 | #include <linux/inotify.h> |
18 | #include <linux/audit.h> | 16 | #include <linux/audit.h> |
@@ -296,6 +294,4 @@ static inline void fsnotify_oldname_free(const char *old_name) | |||
296 | 294 | ||
297 | #endif /* ! CONFIG_INOTIFY */ | 295 | #endif /* ! CONFIG_INOTIFY */ |
298 | 296 | ||
299 | #endif /* __KERNEL__ */ | ||
300 | |||
301 | #endif /* _LINUX_FS_NOTIFY_H */ | 297 | #endif /* _LINUX_FS_NOTIFY_H */ |
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h index 5412da28fa47..110833666e37 100644 --- a/include/linux/generic_serial.h +++ b/include/linux/generic_serial.h | |||
@@ -78,7 +78,7 @@ struct gs_port { | |||
78 | #define GS_DEBUG_WRITE 0x00000040 | 78 | #define GS_DEBUG_WRITE 0x00000040 |
79 | 79 | ||
80 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
81 | void gs_put_char(struct tty_struct *tty, unsigned char ch); | 81 | int gs_put_char(struct tty_struct *tty, unsigned char ch); |
82 | int gs_write(struct tty_struct *tty, | 82 | int gs_write(struct tty_struct *tty, |
83 | const unsigned char *buf, int count); | 83 | const unsigned char *buf, int count); |
84 | int gs_write_room(struct tty_struct *tty); | 84 | int gs_write_room(struct tty_struct *tty); |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 164be9da3c1b..b414be387180 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -40,9 +40,9 @@ struct vm_area_struct; | |||
40 | #define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ | 40 | #define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ |
41 | #define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ | 41 | #define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ |
42 | #define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ | 42 | #define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ |
43 | #define __GFP_REPEAT ((__force gfp_t)0x400u) /* Retry the allocation. Might fail */ | 43 | #define __GFP_REPEAT ((__force gfp_t)0x400u) /* See above */ |
44 | #define __GFP_NOFAIL ((__force gfp_t)0x800u) /* Retry for ever. Cannot fail */ | 44 | #define __GFP_NOFAIL ((__force gfp_t)0x800u) /* See above */ |
45 | #define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */ | 45 | #define __GFP_NORETRY ((__force gfp_t)0x1000u)/* See above */ |
46 | #define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ | 46 | #define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ |
47 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ | 47 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ |
48 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ | 48 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ |
@@ -119,35 +119,22 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags) | |||
119 | 119 | ||
120 | static inline enum zone_type gfp_zone(gfp_t flags) | 120 | static 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 | |||
147 | static 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 | ||
147 | static 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 | */ |
164 | static 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 |
169 | static inline void arch_free_page(struct page *page, int order) { } | 170 | static 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 | ||
175 | extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *); | 176 | extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *); |
176 | 177 | ||
178 | extern struct page * | ||
179 | __alloc_pages_nodemask(gfp_t, unsigned int, | ||
180 | struct zonelist *, nodemask_t *nodemask); | ||
181 | |||
177 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | 182 | static 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 | ||
499 | struct hid_class_descriptor { | 499 | struct hid_class_descriptor { |
500 | __u8 bDescriptorType; | 500 | __u8 bDescriptorType; |
501 | __u16 wDescriptorLength; | 501 | __le16 wDescriptorLength; |
502 | } __attribute__ ((packed)); | 502 | } __attribute__ ((packed)); |
503 | 503 | ||
504 | struct hid_descriptor { | 504 | struct 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/hrtimer.h b/include/linux/hrtimer.h index 56f3236da829..31a4d653389f 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -266,6 +266,21 @@ extern ktime_t ktime_get_real(void); | |||
266 | extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, | 266 | extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, |
267 | enum hrtimer_mode mode); | 267 | enum hrtimer_mode mode); |
268 | 268 | ||
269 | #ifdef CONFIG_DEBUG_OBJECTS_TIMERS | ||
270 | extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock, | ||
271 | enum hrtimer_mode mode); | ||
272 | |||
273 | extern void destroy_hrtimer_on_stack(struct hrtimer *timer); | ||
274 | #else | ||
275 | static inline void hrtimer_init_on_stack(struct hrtimer *timer, | ||
276 | clockid_t which_clock, | ||
277 | enum hrtimer_mode mode) | ||
278 | { | ||
279 | hrtimer_init(timer, which_clock, mode); | ||
280 | } | ||
281 | static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } | ||
282 | #endif | ||
283 | |||
269 | /* Basic timer operations: */ | 284 | /* Basic timer operations: */ |
270 | extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, | 285 | extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, |
271 | const enum hrtimer_mode mode); | 286 | const enum hrtimer_mode mode); |
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 | ||
12 | struct ctl_table; | 13 | struct ctl_table; |
13 | 14 | ||
@@ -51,51 +52,6 @@ int pmd_huge(pmd_t pmd); | |||
51 | void hugetlb_change_protection(struct vm_area_struct *vma, | 52 | void 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 | ||
61 | void 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 | */ | ||
71 | static 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 | ||
80 | int 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 | ||
87 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
88 | pte_t *ptep, pte_t pte); | ||
89 | pte_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 | ||
96 | void hugetlb_prefault_arch_hook(struct mm_struct *mm); | ||
97 | #endif | ||
98 | |||
99 | #else /* !CONFIG_HUGETLB_PAGE */ | 55 | #else /* !CONFIG_HUGETLB_PAGE */ |
100 | 56 | ||
101 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | 57 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index 85d11916e9ea..7244456e7e65 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #ifndef LINUX_HWRANDOM_H_ | 12 | #ifndef LINUX_HWRANDOM_H_ |
13 | #define LINUX_HWRANDOM_H_ | 13 | #define LINUX_HWRANDOM_H_ |
14 | #ifdef __KERNEL__ | ||
15 | 14 | ||
16 | #include <linux/types.h> | 15 | #include <linux/types.h> |
17 | #include <linux/list.h> | 16 | #include <linux/list.h> |
@@ -46,5 +45,4 @@ extern int hwrng_register(struct hwrng *rng); | |||
46 | /** Unregister a Hardware Random Number Generator driver. */ | 45 | /** Unregister a Hardware Random Number Generator driver. */ |
47 | extern void hwrng_unregister(struct hwrng *rng); | 46 | extern void hwrng_unregister(struct hwrng *rng); |
48 | 47 | ||
49 | #endif /* __KERNEL__ */ | ||
50 | #endif /* LINUX_HWRANDOM_H_ */ | 48 | #endif /* LINUX_HWRANDOM_H_ */ |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 32eb8bbe4831..580acc93903e 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -79,12 +79,9 @@ | |||
79 | #define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ | 79 | #define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ |
80 | #define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ | 80 | #define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ |
81 | #define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ | 81 | #define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ |
82 | #define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */ | ||
83 | #define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */ | ||
84 | #define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ | 82 | #define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ |
85 | #define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ | 83 | #define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ |
86 | #define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ | 84 | #define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ |
87 | #define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */ | ||
88 | #define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ | 85 | #define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ |
89 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ | 86 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ |
90 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ | 87 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 365e0df3646b..cb63da5c2139 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -126,7 +126,7 @@ struct i2c_driver { | |||
126 | * With the driver model, device enumeration is NEVER done by drivers; | 126 | * With the driver model, device enumeration is NEVER done by drivers; |
127 | * it's done by infrastructure. (NEW STYLE DRIVERS ONLY) | 127 | * it's done by infrastructure. (NEW STYLE DRIVERS ONLY) |
128 | */ | 128 | */ |
129 | int (*probe)(struct i2c_client *); | 129 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); |
130 | int (*remove)(struct i2c_client *); | 130 | int (*remove)(struct i2c_client *); |
131 | 131 | ||
132 | /* driver model interfaces that don't relate to enumeration */ | 132 | /* driver model interfaces that don't relate to enumeration */ |
@@ -140,11 +140,10 @@ struct i2c_driver { | |||
140 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); | 140 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); |
141 | 141 | ||
142 | struct device_driver driver; | 142 | struct device_driver driver; |
143 | const struct i2c_device_id *id_table; | ||
143 | }; | 144 | }; |
144 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) | 145 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) |
145 | 146 | ||
146 | #define I2C_NAME_SIZE 20 | ||
147 | |||
148 | /** | 147 | /** |
149 | * struct i2c_client - represent an I2C slave device | 148 | * struct i2c_client - represent an I2C slave device |
150 | * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; | 149 | * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; |
@@ -230,17 +229,17 @@ struct i2c_board_info { | |||
230 | }; | 229 | }; |
231 | 230 | ||
232 | /** | 231 | /** |
233 | * I2C_BOARD_INFO - macro used to list an i2c device and its driver | 232 | * I2C_BOARD_INFO - macro used to list an i2c device and its address |
234 | * @driver: identifies the driver to use with the device | 233 | * @dev_type: identifies the device type |
235 | * @dev_addr: the device's address on the bus. | 234 | * @dev_addr: the device's address on the bus. |
236 | * | 235 | * |
237 | * This macro initializes essential fields of a struct i2c_board_info, | 236 | * This macro initializes essential fields of a struct i2c_board_info, |
238 | * declaring what has been provided on a particular board. Optional | 237 | * declaring what has been provided on a particular board. Optional |
239 | * fields (such as the chip type, its associated irq, or device-specific | 238 | * fields (such as associated irq, or device-specific platform_data) |
240 | * platform_data) are provided using conventional syntax. | 239 | * are provided using conventional syntax. |
241 | */ | 240 | */ |
242 | #define I2C_BOARD_INFO(driver,dev_addr) \ | 241 | #define I2C_BOARD_INFO(dev_type,dev_addr) \ |
243 | .driver_name = (driver), .addr = (dev_addr) | 242 | .type = (dev_type), .addr = (dev_addr) |
244 | 243 | ||
245 | 244 | ||
246 | /* Add-on boards should register/unregister their devices; e.g. a board | 245 | /* Add-on boards should register/unregister their devices; e.g. a board |
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index e92170dda245..7d51cbca49ab 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -18,8 +18,6 @@ | |||
18 | #ifndef _I2O_H | 18 | #ifndef _I2O_H |
19 | #define _I2O_H | 19 | #define _I2O_H |
20 | 20 | ||
21 | #ifdef __KERNEL__ /* This file to be included by kernel only */ | ||
22 | |||
23 | #include <linux/i2o-dev.h> | 21 | #include <linux/i2o-dev.h> |
24 | 22 | ||
25 | /* How many different OSM's are we allowing */ | 23 | /* How many different OSM's are we allowing */ |
@@ -613,14 +611,9 @@ struct i2o_sys_tbl { | |||
613 | extern struct list_head i2o_controllers; | 611 | extern struct list_head i2o_controllers; |
614 | 612 | ||
615 | /* Message functions */ | 613 | /* Message functions */ |
616 | static inline struct i2o_message *i2o_msg_get(struct i2o_controller *); | ||
617 | extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int); | 614 | extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int); |
618 | static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *); | ||
619 | static inline int i2o_msg_post_wait(struct i2o_controller *, | ||
620 | struct i2o_message *, unsigned long); | ||
621 | extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *, | 615 | extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *, |
622 | unsigned long, struct i2o_dma *); | 616 | unsigned long, struct i2o_dma *); |
623 | static inline void i2o_flush_reply(struct i2o_controller *, u32); | ||
624 | 617 | ||
625 | /* IOP functions */ | 618 | /* IOP functions */ |
626 | extern int i2o_status_get(struct i2o_controller *); | 619 | extern int i2o_status_get(struct i2o_controller *); |
@@ -1260,5 +1253,4 @@ extern void i2o_dump_message(struct i2o_message *); | |||
1260 | extern void i2o_dump_hrt(struct i2o_controller *c); | 1253 | extern void i2o_dump_hrt(struct i2o_controller *c); |
1261 | extern void i2o_debug_state(struct i2o_controller *c); | 1254 | extern void i2o_debug_state(struct i2o_controller *c); |
1262 | 1255 | ||
1263 | #endif /* __KERNEL__ */ | ||
1264 | #endif /* _I2O_H */ | 1256 | #endif /* _I2O_H */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 32fd77bb4436..b0135b0c3a04 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -427,6 +427,8 @@ struct ide_dma_ops { | |||
427 | void (*dma_timeout)(struct ide_drive_s *); | 427 | void (*dma_timeout)(struct ide_drive_s *); |
428 | }; | 428 | }; |
429 | 429 | ||
430 | struct ide_task_s; | ||
431 | |||
430 | typedef struct hwif_s { | 432 | typedef struct hwif_s { |
431 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ | 433 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ |
432 | struct hwif_s *mate; /* other hwif from same PCI chip */ | 434 | struct hwif_s *mate; /* other hwif from same PCI chip */ |
@@ -467,24 +469,18 @@ typedef struct hwif_s { | |||
467 | const struct ide_port_ops *port_ops; | 469 | const struct ide_port_ops *port_ops; |
468 | const struct ide_dma_ops *dma_ops; | 470 | const struct ide_dma_ops *dma_ops; |
469 | 471 | ||
470 | void (*ata_input_data)(ide_drive_t *, void *, u32); | 472 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); |
471 | void (*ata_output_data)(ide_drive_t *, void *, u32); | 473 | void (*tf_read)(ide_drive_t *, struct ide_task_s *); |
472 | 474 | ||
473 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); | 475 | void (*input_data)(ide_drive_t *, struct request *, void *, unsigned); |
474 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); | 476 | void (*output_data)(ide_drive_t *, struct request *, void *, unsigned); |
475 | 477 | ||
476 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | 478 | void (*ide_dma_clear_irq)(ide_drive_t *drive); |
477 | 479 | ||
478 | void (*OUTB)(u8 addr, unsigned long port); | 480 | void (*OUTB)(u8 addr, unsigned long port); |
479 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); | 481 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); |
480 | void (*OUTW)(u16 addr, unsigned long port); | ||
481 | void (*OUTSW)(unsigned long port, void *addr, u32 count); | ||
482 | void (*OUTSL)(unsigned long port, void *addr, u32 count); | ||
483 | 482 | ||
484 | u8 (*INB)(unsigned long port); | 483 | u8 (*INB)(unsigned long port); |
485 | u16 (*INW)(unsigned long port); | ||
486 | void (*INSW)(unsigned long port, void *addr, u32 count); | ||
487 | void (*INSL)(unsigned long port, void *addr, u32 count); | ||
488 | 484 | ||
489 | /* dma physical region descriptor table (cpu view) */ | 485 | /* dma physical region descriptor table (cpu view) */ |
490 | unsigned int *dmatable_cpu; | 486 | unsigned int *dmatable_cpu; |
@@ -509,10 +505,7 @@ typedef struct hwif_s { | |||
509 | 505 | ||
510 | unsigned long dma_base; /* base addr for dma ports */ | 506 | unsigned long dma_base; /* base addr for dma ports */ |
511 | unsigned long dma_command; /* dma command register */ | 507 | unsigned long dma_command; /* dma command register */ |
512 | unsigned long dma_vendor1; /* dma vendor 1 register */ | ||
513 | unsigned long dma_status; /* dma status register */ | 508 | unsigned long dma_status; /* dma status register */ |
514 | unsigned long dma_vendor3; /* dma vendor 3 register */ | ||
515 | unsigned long dma_prdtable; /* actual prd table address */ | ||
516 | 509 | ||
517 | unsigned long config_data; /* for use by chipset-specific code */ | 510 | unsigned long config_data; /* for use by chipset-specific code */ |
518 | unsigned long select_data; /* for use by chipset-specific code */ | 511 | unsigned long select_data; /* for use by chipset-specific code */ |
@@ -547,7 +540,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); | |||
547 | typedef int (ide_expiry_t)(ide_drive_t *); | 540 | typedef int (ide_expiry_t)(ide_drive_t *); |
548 | 541 | ||
549 | /* used by ide-cd, ide-floppy, etc. */ | 542 | /* used by ide-cd, ide-floppy, etc. */ |
550 | typedef void (xfer_func_t)(ide_drive_t *, void *, u32); | 543 | typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); |
551 | 544 | ||
552 | typedef struct hwgroup_s { | 545 | typedef struct hwgroup_s { |
553 | /* irq handler, if active */ | 546 | /* irq handler, if active */ |
@@ -829,6 +822,10 @@ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigne | |||
829 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, | 822 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, |
830 | ide_expiry_t *); | 823 | ide_expiry_t *); |
831 | 824 | ||
825 | void ide_execute_pkt_cmd(ide_drive_t *); | ||
826 | |||
827 | void ide_pad_transfer(ide_drive_t *, int, int); | ||
828 | |||
832 | ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | 829 | ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); |
833 | 830 | ||
834 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 831 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
@@ -965,8 +962,7 @@ typedef struct ide_task_s { | |||
965 | void *special; /* valid_t generally */ | 962 | void *special; /* valid_t generally */ |
966 | } ide_task_t; | 963 | } ide_task_t; |
967 | 964 | ||
968 | void ide_tf_load(ide_drive_t *, ide_task_t *); | 965 | void ide_tf_dump(const char *, struct ide_taskfile *); |
969 | void ide_tf_read(ide_drive_t *, ide_task_t *); | ||
970 | 966 | ||
971 | extern void SELECT_DRIVE(ide_drive_t *); | 967 | extern void SELECT_DRIVE(ide_drive_t *); |
972 | extern void SELECT_MASK(ide_drive_t *, int); | 968 | extern void SELECT_MASK(ide_drive_t *, int); |
@@ -1072,6 +1068,8 @@ enum { | |||
1072 | IDE_HFLAG_NO_DMA = (1 << 14), | 1068 | IDE_HFLAG_NO_DMA = (1 << 14), |
1073 | /* check if host is PCI IDE device before allowing DMA */ | 1069 | /* check if host is PCI IDE device before allowing DMA */ |
1074 | IDE_HFLAG_NO_AUTODMA = (1 << 15), | 1070 | IDE_HFLAG_NO_AUTODMA = (1 << 15), |
1071 | /* host uses MMIO */ | ||
1072 | IDE_HFLAG_MMIO = (1 << 16), | ||
1075 | /* host is CS5510/CS5520 */ | 1073 | /* host is CS5510/CS5520 */ |
1076 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, | 1074 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, |
1077 | /* no LBA48 */ | 1075 | /* no LBA48 */ |
@@ -1360,27 +1358,4 @@ static inline u8 ide_read_error(ide_drive_t *drive) | |||
1360 | 1358 | ||
1361 | return hwif->INB(hwif->io_ports.error_addr); | 1359 | return hwif->INB(hwif->io_ports.error_addr); |
1362 | } | 1360 | } |
1363 | |||
1364 | /* | ||
1365 | * Too bad. The drive wants to send us data which we are not ready to accept. | ||
1366 | * Just throw it away. | ||
1367 | */ | ||
1368 | static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount) | ||
1369 | { | ||
1370 | ide_hwif_t *hwif = drive->hwif; | ||
1371 | |||
1372 | /* FIXME: use ->atapi_input_bytes */ | ||
1373 | while (bcount--) | ||
1374 | (void)hwif->INB(hwif->io_ports.data_addr); | ||
1375 | } | ||
1376 | |||
1377 | static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) | ||
1378 | { | ||
1379 | ide_hwif_t *hwif = drive->hwif; | ||
1380 | |||
1381 | /* FIXME: use ->atapi_output_bytes */ | ||
1382 | while (bcount--) | ||
1383 | hwif->OUTB(0, hwif->io_ports.data_addr); | ||
1384 | } | ||
1385 | |||
1386 | #endif /* _IDE_H */ | 1361 | #endif /* _IDE_H */ |
diff --git a/include/linux/idr.h b/include/linux/idr.h index 0edda411959c..9a2d762124de 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
17 | #include <linux/init.h> | ||
17 | 18 | ||
18 | #if BITS_PER_LONG == 32 | 19 | #if BITS_PER_LONG == 32 |
19 | # define IDR_BITS 5 | 20 | # define IDR_BITS 5 |
@@ -115,4 +116,6 @@ void ida_remove(struct ida *ida, int id); | |||
115 | void ida_destroy(struct ida *ida); | 116 | void ida_destroy(struct ida *ida); |
116 | void ida_init(struct ida *ida); | 117 | void ida_init(struct ida *ida); |
117 | 118 | ||
119 | void __init idr_init_cache(void); | ||
120 | |||
118 | #endif /* __IDR_H__ */ | 121 | #endif /* __IDR_H__ */ |
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index 0d9d7ea2c1cc..5f200bac3749 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h | |||
@@ -1,9 +1,6 @@ | |||
1 | #ifndef _LINUX_IF_MACVLAN_H | 1 | #ifndef _LINUX_IF_MACVLAN_H |
2 | #define _LINUX_IF_MACVLAN_H | 2 | #define _LINUX_IF_MACVLAN_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); | 4 | extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); |
7 | 5 | ||
8 | #endif /* __KERNEL__ */ | ||
9 | #endif /* _LINUX_IF_MACVLAN_H */ | 6 | #endif /* _LINUX_IF_MACVLAN_H */ |
diff --git a/include/linux/inet.h b/include/linux/inet.h index 675a7dbe86f8..1354080cf8cf 100644 --- a/include/linux/inet.h +++ b/include/linux/inet.h | |||
@@ -42,11 +42,9 @@ | |||
42 | #ifndef _LINUX_INET_H | 42 | #ifndef _LINUX_INET_H |
43 | #define _LINUX_INET_H | 43 | #define _LINUX_INET_H |
44 | 44 | ||
45 | #ifdef __KERNEL__ | ||
46 | #include <linux/types.h> | 45 | #include <linux/types.h> |
47 | 46 | ||
48 | extern __be32 in_aton(const char *str); | 47 | extern __be32 in_aton(const char *str); |
49 | extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); | 48 | extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); |
50 | extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); | 49 | extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end); |
51 | #endif | ||
52 | #endif /* _LINUX_INET_H */ | 50 | #endif /* _LINUX_INET_H */ |
diff --git a/include/linux/init.h b/include/linux/init.h index fb58c0493cf2..21d658cdfa27 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -147,6 +147,8 @@ extern unsigned int reset_devices; | |||
147 | void setup_arch(char **); | 147 | void setup_arch(char **); |
148 | void prepare_namespace(void); | 148 | void prepare_namespace(void); |
149 | 149 | ||
150 | extern void (*late_time_init)(void); | ||
151 | |||
150 | #endif | 152 | #endif |
151 | 153 | ||
152 | #ifndef MODULE | 154 | #ifndef MODULE |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 37a6f5bc4a92..b24c2875aa05 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _LINUX__INIT_TASK_H | 1 | #ifndef _LINUX__INIT_TASK_H |
2 | #define _LINUX__INIT_TASK_H | 2 | #define _LINUX__INIT_TASK_H |
3 | 3 | ||
4 | #include <linux/file.h> | 4 | #include <linux/fdtable.h> |
5 | #include <linux/rcupdate.h> | 5 | #include <linux/rcupdate.h> |
6 | #include <linux/irqflags.h> | 6 | #include <linux/irqflags.h> |
7 | #include <linux/utsname.h> | 7 | #include <linux/utsname.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/interrupt.h b/include/linux/interrupt.h index b5fef13148bd..f1fc7470d26c 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -289,6 +289,7 @@ struct softirq_action | |||
289 | }; | 289 | }; |
290 | 290 | ||
291 | asmlinkage void do_softirq(void); | 291 | asmlinkage void do_softirq(void); |
292 | asmlinkage void __do_softirq(void); | ||
292 | extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); | 293 | extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); |
293 | extern void softirq_init(void); | 294 | extern void softirq_init(void); |
294 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) | 295 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) |
diff --git a/include/linux/io.h b/include/linux/io.h index e3b2dda6c8eb..3a03a3604cce 100644 --- a/include/linux/io.h +++ b/include/linux/io.h | |||
@@ -58,9 +58,9 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) | |||
58 | } | 58 | } |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | void __iomem * devm_ioremap(struct device *dev, unsigned long offset, | 61 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, |
62 | unsigned long size); | 62 | unsigned long size); |
63 | void __iomem * devm_ioremap_nocache(struct device *dev, unsigned long offset, | 63 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, |
64 | unsigned long size); | 64 | unsigned long size); |
65 | void devm_iounmap(struct device *dev, void __iomem *addr); | 65 | void devm_iounmap(struct device *dev, void __iomem *addr); |
66 | int check_signature(const volatile void __iomem *io_addr, | 66 | int check_signature(const volatile void __iomem *io_addr, |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index e4451d1da753..ea6c18a8b0d4 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -4,6 +4,17 @@ | |||
4 | #include <linux/err.h> | 4 | #include <linux/err.h> |
5 | #include <linux/idr.h> | 5 | #include <linux/idr.h> |
6 | #include <linux/rwsem.h> | 6 | #include <linux/rwsem.h> |
7 | #include <linux/notifier.h> | ||
8 | |||
9 | /* | ||
10 | * ipc namespace events | ||
11 | */ | ||
12 | #define IPCNS_MEMCHANGED 0x00000001 /* Notify lowmem size changed */ | ||
13 | #define IPCNS_CREATED 0x00000002 /* Notify new ipc namespace created */ | ||
14 | #define IPCNS_REMOVED 0x00000003 /* Notify ipc namespace removed */ | ||
15 | |||
16 | #define IPCNS_CALLBACK_PRI 0 | ||
17 | |||
7 | 18 | ||
8 | struct ipc_ids { | 19 | struct ipc_ids { |
9 | int in_use; | 20 | int in_use; |
@@ -30,15 +41,24 @@ struct ipc_namespace { | |||
30 | size_t shm_ctlall; | 41 | size_t shm_ctlall; |
31 | int shm_ctlmni; | 42 | int shm_ctlmni; |
32 | int shm_tot; | 43 | int shm_tot; |
44 | |||
45 | struct notifier_block ipcns_nb; | ||
33 | }; | 46 | }; |
34 | 47 | ||
35 | extern struct ipc_namespace init_ipc_ns; | 48 | extern struct ipc_namespace init_ipc_ns; |
49 | extern atomic_t nr_ipc_ns; | ||
36 | 50 | ||
37 | #ifdef CONFIG_SYSVIPC | 51 | #ifdef CONFIG_SYSVIPC |
38 | #define INIT_IPC_NS(ns) .ns = &init_ipc_ns, | 52 | #define INIT_IPC_NS(ns) .ns = &init_ipc_ns, |
39 | #else | 53 | |
54 | extern int register_ipcns_notifier(struct ipc_namespace *); | ||
55 | extern int cond_register_ipcns_notifier(struct ipc_namespace *); | ||
56 | extern int unregister_ipcns_notifier(struct ipc_namespace *); | ||
57 | extern int ipcns_notify(unsigned long); | ||
58 | |||
59 | #else /* CONFIG_SYSVIPC */ | ||
40 | #define INIT_IPC_NS(ns) | 60 | #define INIT_IPC_NS(ns) |
41 | #endif | 61 | #endif /* CONFIG_SYSVIPC */ |
42 | 62 | ||
43 | #if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) | 63 | #if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) |
44 | extern void free_ipc_ns(struct kref *kref); | 64 | extern void free_ipc_ns(struct kref *kref); |
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index c5bd28b69aec..7ebdb4fb4e54 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
@@ -64,7 +64,7 @@ | |||
64 | * applications and another for userland applications. The | 64 | * applications and another for userland applications. The |
65 | * capabilities are basically the same for both interface, although | 65 | * capabilities are basically the same for both interface, although |
66 | * the interfaces are somewhat different. The stuff in the | 66 | * the interfaces are somewhat different. The stuff in the |
67 | * #ifdef KERNEL below is the in-kernel interface. The userland | 67 | * #ifdef __KERNEL__ below is the in-kernel interface. The userland |
68 | * interface is defined later in the file. */ | 68 | * interface is defined later in the file. */ |
69 | 69 | ||
70 | 70 | ||
@@ -75,8 +75,7 @@ | |||
75 | * work for sockets. | 75 | * work for sockets. |
76 | */ | 76 | */ |
77 | #define IPMI_MAX_ADDR_SIZE 32 | 77 | #define IPMI_MAX_ADDR_SIZE 32 |
78 | struct ipmi_addr | 78 | struct ipmi_addr { |
79 | { | ||
80 | /* Try to take these from the "Channel Medium Type" table | 79 | /* Try to take these from the "Channel Medium Type" table |
81 | in section 6.5 of the IPMI 1.5 manual. */ | 80 | in section 6.5 of the IPMI 1.5 manual. */ |
82 | int addr_type; | 81 | int addr_type; |
@@ -90,8 +89,7 @@ struct ipmi_addr | |||
90 | * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC. | 89 | * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC. |
91 | */ | 90 | */ |
92 | #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c | 91 | #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c |
93 | struct ipmi_system_interface_addr | 92 | struct ipmi_system_interface_addr { |
94 | { | ||
95 | int addr_type; | 93 | int addr_type; |
96 | short channel; | 94 | short channel; |
97 | unsigned char lun; | 95 | unsigned char lun; |
@@ -100,10 +98,9 @@ struct ipmi_system_interface_addr | |||
100 | /* An IPMB Address. */ | 98 | /* An IPMB Address. */ |
101 | #define IPMI_IPMB_ADDR_TYPE 0x01 | 99 | #define IPMI_IPMB_ADDR_TYPE 0x01 |
102 | /* Used for broadcast get device id as described in section 17.9 of the | 100 | /* Used for broadcast get device id as described in section 17.9 of the |
103 | IPMI 1.5 manual. */ | 101 | IPMI 1.5 manual. */ |
104 | #define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 | 102 | #define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 |
105 | struct ipmi_ipmb_addr | 103 | struct ipmi_ipmb_addr { |
106 | { | ||
107 | int addr_type; | 104 | int addr_type; |
108 | short channel; | 105 | short channel; |
109 | unsigned char slave_addr; | 106 | unsigned char slave_addr; |
@@ -128,8 +125,7 @@ struct ipmi_ipmb_addr | |||
128 | * message is a little weird, but this is required. | 125 | * message is a little weird, but this is required. |
129 | */ | 126 | */ |
130 | #define IPMI_LAN_ADDR_TYPE 0x04 | 127 | #define IPMI_LAN_ADDR_TYPE 0x04 |
131 | struct ipmi_lan_addr | 128 | struct ipmi_lan_addr { |
132 | { | ||
133 | int addr_type; | 129 | int addr_type; |
134 | short channel; | 130 | short channel; |
135 | unsigned char privilege; | 131 | unsigned char privilege; |
@@ -162,16 +158,14 @@ struct ipmi_lan_addr | |||
162 | * byte of data in the response (as the spec shows the messages laid | 158 | * byte of data in the response (as the spec shows the messages laid |
163 | * out). | 159 | * out). |
164 | */ | 160 | */ |
165 | struct ipmi_msg | 161 | struct ipmi_msg { |
166 | { | ||
167 | unsigned char netfn; | 162 | unsigned char netfn; |
168 | unsigned char cmd; | 163 | unsigned char cmd; |
169 | unsigned short data_len; | 164 | unsigned short data_len; |
170 | unsigned char __user *data; | 165 | unsigned char __user *data; |
171 | }; | 166 | }; |
172 | 167 | ||
173 | struct kernel_ipmi_msg | 168 | struct kernel_ipmi_msg { |
174 | { | ||
175 | unsigned char netfn; | 169 | unsigned char netfn; |
176 | unsigned char cmd; | 170 | unsigned char cmd; |
177 | unsigned short data_len; | 171 | unsigned short data_len; |
@@ -239,12 +233,11 @@ typedef struct ipmi_user *ipmi_user_t; | |||
239 | * used after the message is delivered, so the upper layer may use the | 233 | * used after the message is delivered, so the upper layer may use the |
240 | * link to build a linked list, if it likes. | 234 | * link to build a linked list, if it likes. |
241 | */ | 235 | */ |
242 | struct ipmi_recv_msg | 236 | struct ipmi_recv_msg { |
243 | { | ||
244 | struct list_head link; | 237 | struct list_head link; |
245 | 238 | ||
246 | /* The type of message as defined in the "Receive Types" | 239 | /* The type of message as defined in the "Receive Types" |
247 | defines above. */ | 240 | defines above. */ |
248 | int recv_type; | 241 | int recv_type; |
249 | 242 | ||
250 | ipmi_user_t user; | 243 | ipmi_user_t user; |
@@ -271,9 +264,8 @@ struct ipmi_recv_msg | |||
271 | /* Allocate and free the receive message. */ | 264 | /* Allocate and free the receive message. */ |
272 | void ipmi_free_recv_msg(struct ipmi_recv_msg *msg); | 265 | void ipmi_free_recv_msg(struct ipmi_recv_msg *msg); |
273 | 266 | ||
274 | struct ipmi_user_hndl | 267 | struct ipmi_user_hndl { |
275 | { | 268 | /* Routine type to call when a message needs to be routed to |
276 | /* Routine type to call when a message needs to be routed to | ||
277 | the upper layer. This will be called with some locks held, | 269 | the upper layer. This will be called with some locks held, |
278 | the only IPMI routines that can be called are ipmi_request | 270 | the only IPMI routines that can be called are ipmi_request |
279 | and the alloc/free operations. The handler_data is the | 271 | and the alloc/free operations. The handler_data is the |
@@ -368,9 +360,8 @@ int ipmi_request_supply_msgs(ipmi_user_t user, | |||
368 | * Poll the IPMI interface for the user. This causes the IPMI code to | 360 | * Poll the IPMI interface for the user. This causes the IPMI code to |
369 | * do an immediate check for information from the driver and handle | 361 | * do an immediate check for information from the driver and handle |
370 | * anything that is immediately pending. This will not block in any | 362 | * anything that is immediately pending. This will not block in any |
371 | * way. This is useful if you need to implement polling from the user | 363 | * way. This is useful if you need to spin waiting for something to |
372 | * for things like modifying the watchdog timeout when a panic occurs | 364 | * happen in the IPMI driver. |
373 | * or disabling the watchdog timer on a reboot. | ||
374 | */ | 365 | */ |
375 | void ipmi_poll_interface(ipmi_user_t user); | 366 | void ipmi_poll_interface(ipmi_user_t user); |
376 | 367 | ||
@@ -422,12 +413,6 @@ int ipmi_get_maintenance_mode(ipmi_user_t user); | |||
422 | int ipmi_set_maintenance_mode(ipmi_user_t user, int mode); | 413 | int ipmi_set_maintenance_mode(ipmi_user_t user, int mode); |
423 | 414 | ||
424 | /* | 415 | /* |
425 | * Allow run-to-completion mode to be set for the interface of | ||
426 | * a specific user. | ||
427 | */ | ||
428 | void ipmi_user_set_run_to_completion(ipmi_user_t user, int val); | ||
429 | |||
430 | /* | ||
431 | * When the user is created, it will not receive IPMI events by | 416 | * When the user is created, it will not receive IPMI events by |
432 | * default. The user must set this to TRUE to get incoming events. | 417 | * default. The user must set this to TRUE to get incoming events. |
433 | * The first user that sets this to TRUE will receive all events that | 418 | * The first user that sets this to TRUE will receive all events that |
@@ -440,8 +425,7 @@ int ipmi_set_gets_events(ipmi_user_t user, int val); | |||
440 | * every existing interface when a new watcher is registered with | 425 | * every existing interface when a new watcher is registered with |
441 | * ipmi_smi_watcher_register(). | 426 | * ipmi_smi_watcher_register(). |
442 | */ | 427 | */ |
443 | struct ipmi_smi_watcher | 428 | struct ipmi_smi_watcher { |
444 | { | ||
445 | struct list_head link; | 429 | struct list_head link; |
446 | 430 | ||
447 | /* You must set the owner to the current module, if you are in | 431 | /* You must set the owner to the current module, if you are in |
@@ -512,8 +496,7 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len); | |||
512 | 496 | ||
513 | 497 | ||
514 | /* Messages sent to the interface are this format. */ | 498 | /* Messages sent to the interface are this format. */ |
515 | struct ipmi_req | 499 | struct ipmi_req { |
516 | { | ||
517 | unsigned char __user *addr; /* Address to send the message to. */ | 500 | unsigned char __user *addr; /* Address to send the message to. */ |
518 | unsigned int addr_len; | 501 | unsigned int addr_len; |
519 | 502 | ||
@@ -538,12 +521,11 @@ struct ipmi_req | |||
538 | 521 | ||
539 | /* Messages sent to the interface with timing parameters are this | 522 | /* Messages sent to the interface with timing parameters are this |
540 | format. */ | 523 | format. */ |
541 | struct ipmi_req_settime | 524 | struct ipmi_req_settime { |
542 | { | ||
543 | struct ipmi_req req; | 525 | struct ipmi_req req; |
544 | 526 | ||
545 | /* See ipmi_request_settime() above for details on these | 527 | /* See ipmi_request_settime() above for details on these |
546 | values. */ | 528 | values. */ |
547 | int retries; | 529 | int retries; |
548 | unsigned int retry_time_ms; | 530 | unsigned int retry_time_ms; |
549 | }; | 531 | }; |
@@ -560,8 +542,7 @@ struct ipmi_req_settime | |||
560 | struct ipmi_req_settime) | 542 | struct ipmi_req_settime) |
561 | 543 | ||
562 | /* Messages received from the interface are this format. */ | 544 | /* Messages received from the interface are this format. */ |
563 | struct ipmi_recv | 545 | struct ipmi_recv { |
564 | { | ||
565 | int recv_type; /* Is this a command, response or an | 546 | int recv_type; /* Is this a command, response or an |
566 | asyncronous event. */ | 547 | asyncronous event. */ |
567 | 548 | ||
@@ -607,13 +588,12 @@ struct ipmi_recv | |||
607 | struct ipmi_recv) | 588 | struct ipmi_recv) |
608 | 589 | ||
609 | /* Register to get commands from other entities on this interface. */ | 590 | /* Register to get commands from other entities on this interface. */ |
610 | struct ipmi_cmdspec | 591 | struct ipmi_cmdspec { |
611 | { | ||
612 | unsigned char netfn; | 592 | unsigned char netfn; |
613 | unsigned char cmd; | 593 | unsigned char cmd; |
614 | }; | 594 | }; |
615 | 595 | ||
616 | /* | 596 | /* |
617 | * Register to receive a specific command. error values: | 597 | * Register to receive a specific command. error values: |
618 | * - EFAULT - an address supplied was invalid. | 598 | * - EFAULT - an address supplied was invalid. |
619 | * - EBUSY - The netfn/cmd supplied was already in use. | 599 | * - EBUSY - The netfn/cmd supplied was already in use. |
@@ -636,8 +616,7 @@ struct ipmi_cmdspec | |||
636 | * else. The chans field is a bitmask, (1 << channel) for each channel. | 616 | * else. The chans field is a bitmask, (1 << channel) for each channel. |
637 | * It may be IPMI_CHAN_ALL for all channels. | 617 | * It may be IPMI_CHAN_ALL for all channels. |
638 | */ | 618 | */ |
639 | struct ipmi_cmdspec_chans | 619 | struct ipmi_cmdspec_chans { |
640 | { | ||
641 | unsigned int netfn; | 620 | unsigned int netfn; |
642 | unsigned int cmd; | 621 | unsigned int cmd; |
643 | unsigned int chans; | 622 | unsigned int chans; |
@@ -659,7 +638,7 @@ struct ipmi_cmdspec_chans | |||
659 | #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \ | 638 | #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \ |
660 | struct ipmi_cmdspec_chans) | 639 | struct ipmi_cmdspec_chans) |
661 | 640 | ||
662 | /* | 641 | /* |
663 | * Set whether this interface receives events. Note that the first | 642 | * Set whether this interface receives events. Note that the first |
664 | * user registered for events will get all pending events for the | 643 | * user registered for events will get all pending events for the |
665 | * interface. error values: | 644 | * interface. error values: |
@@ -675,15 +654,18 @@ struct ipmi_cmdspec_chans | |||
675 | * things it takes to determine your address (if not the BMC) and set | 654 | * things it takes to determine your address (if not the BMC) and set |
676 | * it for everyone else. You should probably leave the LUN alone. | 655 | * it for everyone else. You should probably leave the LUN alone. |
677 | */ | 656 | */ |
678 | struct ipmi_channel_lun_address_set | 657 | struct ipmi_channel_lun_address_set { |
679 | { | ||
680 | unsigned short channel; | 658 | unsigned short channel; |
681 | unsigned char value; | 659 | unsigned char value; |
682 | }; | 660 | }; |
683 | #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set) | 661 | #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \ |
684 | #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set) | 662 | _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set) |
685 | #define IPMICTL_SET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set) | 663 | #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \ |
686 | #define IPMICTL_GET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set) | 664 | _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set) |
665 | #define IPMICTL_SET_MY_CHANNEL_LUN_CMD \ | ||
666 | _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set) | ||
667 | #define IPMICTL_GET_MY_CHANNEL_LUN_CMD \ | ||
668 | _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set) | ||
687 | /* Legacy interfaces, these only set IPMB 0. */ | 669 | /* Legacy interfaces, these only set IPMB 0. */ |
688 | #define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) | 670 | #define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) |
689 | #define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) | 671 | #define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) |
@@ -694,8 +676,7 @@ struct ipmi_channel_lun_address_set | |||
694 | * Get/set the default timing values for an interface. You shouldn't | 676 | * Get/set the default timing values for an interface. You shouldn't |
695 | * generally mess with these. | 677 | * generally mess with these. |
696 | */ | 678 | */ |
697 | struct ipmi_timing_parms | 679 | struct ipmi_timing_parms { |
698 | { | ||
699 | int retries; | 680 | int retries; |
700 | unsigned int retry_time_ms; | 681 | unsigned int retry_time_ms; |
701 | }; | 682 | }; |
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 6e8cec503380..62b73668b602 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
@@ -60,8 +60,7 @@ typedef struct ipmi_smi *ipmi_smi_t; | |||
60 | * asynchronous data and messages and request them from the | 60 | * asynchronous data and messages and request them from the |
61 | * interface. | 61 | * interface. |
62 | */ | 62 | */ |
63 | struct ipmi_smi_msg | 63 | struct ipmi_smi_msg { |
64 | { | ||
65 | struct list_head link; | 64 | struct list_head link; |
66 | 65 | ||
67 | long msgid; | 66 | long msgid; |
@@ -74,12 +73,11 @@ struct ipmi_smi_msg | |||
74 | unsigned char rsp[IPMI_MAX_MSG_LENGTH]; | 73 | unsigned char rsp[IPMI_MAX_MSG_LENGTH]; |
75 | 74 | ||
76 | /* Will be called when the system is done with the message | 75 | /* Will be called when the system is done with the message |
77 | (presumably to free it). */ | 76 | (presumably to free it). */ |
78 | void (*done)(struct ipmi_smi_msg *msg); | 77 | void (*done)(struct ipmi_smi_msg *msg); |
79 | }; | 78 | }; |
80 | 79 | ||
81 | struct ipmi_smi_handlers | 80 | struct ipmi_smi_handlers { |
82 | { | ||
83 | struct module *owner; | 81 | struct module *owner; |
84 | 82 | ||
85 | /* The low-level interface cannot start sending messages to | 83 | /* The low-level interface cannot start sending messages to |
@@ -231,7 +229,7 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) | |||
231 | directory for this interface. Note that the entry will | 229 | directory for this interface. Note that the entry will |
232 | automatically be dstroyed when the interface is destroyed. */ | 230 | automatically be dstroyed when the interface is destroyed. */ |
233 | int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, | 231 | int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, |
234 | read_proc_t *read_proc, write_proc_t *write_proc, | 232 | read_proc_t *read_proc, |
235 | void *data, struct module *owner); | 233 | void *data, struct module *owner); |
236 | 234 | ||
237 | #endif /* __LINUX_IPMI_SMI_H */ | 235 | #endif /* __LINUX_IPMI_SMI_H */ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 1883a85625dd..552e0ec269c9 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -61,6 +61,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq, | |||
61 | #define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ | 61 | #define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ |
62 | #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ | 62 | #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ |
63 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ | 63 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ |
64 | #define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ | ||
64 | 65 | ||
65 | #ifdef CONFIG_IRQ_PER_CPU | 66 | #ifdef CONFIG_IRQ_PER_CPU |
66 | # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) | 67 | # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) |
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h index 1e8728a9ee8a..cd5a269fdb5e 100644 --- a/include/linux/isapnp.h +++ b/include/linux/isapnp.h | |||
@@ -26,16 +26,6 @@ | |||
26 | #include <linux/pnp.h> | 26 | #include <linux/pnp.h> |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Configuration registers (TODO: change by specification) | ||
30 | */ | ||
31 | |||
32 | #define ISAPNP_CFG_ACTIVATE 0x30 /* byte */ | ||
33 | #define ISAPNP_CFG_MEM 0x40 /* 4 * dword */ | ||
34 | #define ISAPNP_CFG_PORT 0x60 /* 8 * word */ | ||
35 | #define ISAPNP_CFG_IRQ 0x70 /* 2 * word */ | ||
36 | #define ISAPNP_CFG_DMA 0x74 /* 2 * byte */ | ||
37 | |||
38 | /* | ||
39 | * | 29 | * |
40 | */ | 30 | */ |
41 | 31 | ||
diff --git a/include/linux/isicom.h b/include/linux/isicom.h index 8f4c71759d73..bbd42197298f 100644 --- a/include/linux/isicom.h +++ b/include/linux/isicom.h | |||
@@ -1,11 +1,6 @@ | |||
1 | #ifndef _LINUX_ISICOM_H | 1 | #ifndef _LINUX_ISICOM_H |
2 | #define _LINUX_ISICOM_H | 2 | #define _LINUX_ISICOM_H |
3 | 3 | ||
4 | /*#define ISICOM_DEBUG*/ | ||
5 | /*#define ISICOM_DEBUG_DTR_RTS*/ | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | |||
9 | #define YES 1 | 4 | #define YES 1 |
10 | #define NO 0 | 5 | #define NO 0 |
11 | 6 | ||
@@ -85,6 +80,4 @@ | |||
85 | 80 | ||
86 | #define ISI_TXOK 0x0001 | 81 | #define ISI_TXOK 0x0001 |
87 | 82 | ||
88 | #endif /* __KERNEL__ */ | ||
89 | |||
90 | #endif /* ISICOM_H */ | 83 | #endif /* ISICOM_H */ |
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 33ef710dac24..abb6ac639e8e 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _LINUX_JIFFIES_H | 1 | #ifndef _LINUX_JIFFIES_H |
2 | #define _LINUX_JIFFIES_H | 2 | #define _LINUX_JIFFIES_H |
3 | 3 | ||
4 | #include <linux/calc64.h> | 4 | #include <linux/math64.h> |
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/time.h> | 7 | #include <linux/time.h> |
diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h new file mode 100644 index 000000000000..22a72198c14b --- /dev/null +++ b/include/linux/kbuild.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef __LINUX_KBUILD_H | ||
2 | #define __LINUX_KBUILD_H | ||
3 | |||
4 | #define DEFINE(sym, val) \ | ||
5 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
6 | |||
7 | #define BLANK() asm volatile("\n->" : : ) | ||
8 | |||
9 | #define OFFSET(sym, str, mem) \ | ||
10 | DEFINE(sym, offsetof(struct str, mem)) | ||
11 | |||
12 | #define COMMENT(x) \ | ||
13 | asm volatile("\n->#" x) | ||
14 | |||
15 | #endif | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index cd6d02cf854d..4d46e299afb5 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -20,6 +20,9 @@ | |||
20 | extern const char linux_banner[]; | 20 | extern const char linux_banner[]; |
21 | extern const char linux_proc_banner[]; | 21 | extern const char linux_proc_banner[]; |
22 | 22 | ||
23 | #define USHORT_MAX ((u16)(~0U)) | ||
24 | #define SHORT_MAX ((s16)(USHORT_MAX>>1)) | ||
25 | #define SHORT_MIN (-SHORT_MAX - 1) | ||
23 | #define INT_MAX ((int)(~0U>>1)) | 26 | #define INT_MAX ((int)(~0U>>1)) |
24 | #define INT_MIN (-INT_MAX - 1) | 27 | #define INT_MIN (-INT_MAX - 1) |
25 | #define UINT_MAX (~0U) | 28 | #define UINT_MAX (~0U) |
@@ -188,6 +191,7 @@ extern int log_buf_copy(char *dest, int idx, int len); | |||
188 | extern int printk_ratelimit_jiffies; | 191 | extern int printk_ratelimit_jiffies; |
189 | extern int printk_ratelimit_burst; | 192 | extern int printk_ratelimit_burst; |
190 | extern int printk_ratelimit(void); | 193 | extern int printk_ratelimit(void); |
194 | extern int __ratelimit(int ratelimit_jiffies, int ratelimit_burst); | ||
191 | extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); | 195 | extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); |
192 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 196 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
193 | unsigned int interval_msec); | 197 | unsigned int interval_msec); |
@@ -255,6 +259,7 @@ extern enum system_states { | |||
255 | #define TAINT_USER (1<<6) | 259 | #define TAINT_USER (1<<6) |
256 | #define TAINT_DIE (1<<7) | 260 | #define TAINT_DIE (1<<7) |
257 | #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) | 261 | #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) |
262 | #define TAINT_WARN (1<<9) | ||
258 | 263 | ||
259 | extern void dump_stack(void) __cold; | 264 | extern void dump_stack(void) __cold; |
260 | 265 | ||
@@ -333,33 +338,90 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, | |||
333 | #endif /* __LITTLE_ENDIAN */ | 338 | #endif /* __LITTLE_ENDIAN */ |
334 | 339 | ||
335 | /* | 340 | /* |
336 | * min()/max() macros that also do | 341 | * min()/max()/clamp() macros that also do |
337 | * strict type-checking.. See the | 342 | * strict type-checking.. See the |
338 | * "unnecessary" pointer comparison. | 343 | * "unnecessary" pointer comparison. |
339 | */ | 344 | */ |
340 | #define min(x,y) ({ \ | 345 | #define min(x, y) ({ \ |
341 | typeof(x) _x = (x); \ | 346 | typeof(x) _min1 = (x); \ |
342 | typeof(y) _y = (y); \ | 347 | typeof(y) _min2 = (y); \ |
343 | (void) (&_x == &_y); \ | 348 | (void) (&_min1 == &_min2); \ |
344 | _x < _y ? _x : _y; }) | 349 | _min1 < _min2 ? _min1 : _min2; }) |
345 | 350 | ||
346 | #define max(x,y) ({ \ | 351 | #define max(x, y) ({ \ |
347 | typeof(x) _x = (x); \ | 352 | typeof(x) _max1 = (x); \ |
348 | typeof(y) _y = (y); \ | 353 | typeof(y) _max2 = (y); \ |
349 | (void) (&_x == &_y); \ | 354 | (void) (&_max1 == &_max2); \ |
350 | _x > _y ? _x : _y; }) | 355 | _max1 > _max2 ? _max1 : _max2; }) |
356 | |||
357 | /** | ||
358 | * clamp - return a value clamped to a given range with strict typechecking | ||
359 | * @val: current value | ||
360 | * @min: minimum allowable value | ||
361 | * @max: maximum allowable value | ||
362 | * | ||
363 | * This macro does strict typechecking of min/max to make sure they are of the | ||
364 | * same type as val. See the unnecessary pointer comparisons. | ||
365 | */ | ||
366 | #define clamp(val, min, max) ({ \ | ||
367 | typeof(val) __val = (val); \ | ||
368 | typeof(min) __min = (min); \ | ||
369 | typeof(max) __max = (max); \ | ||
370 | (void) (&__val == &__min); \ | ||
371 | (void) (&__val == &__max); \ | ||
372 | __val = __val < __min ? __min: __val; \ | ||
373 | __val > __max ? __max: __val; }) | ||
351 | 374 | ||
352 | /* | 375 | /* |
353 | * ..and if you can't take the strict | 376 | * ..and if you can't take the strict |
354 | * types, you can specify one yourself. | 377 | * types, you can specify one yourself. |
355 | * | 378 | * |
356 | * Or not use min/max at all, of course. | 379 | * Or not use min/max/clamp at all, of course. |
380 | */ | ||
381 | #define min_t(type, x, y) ({ \ | ||
382 | type __min1 = (x); \ | ||
383 | type __min2 = (y); \ | ||
384 | __min1 < __min2 ? __min1: __min2; }) | ||
385 | |||
386 | #define max_t(type, x, y) ({ \ | ||
387 | type __max1 = (x); \ | ||
388 | type __max2 = (y); \ | ||
389 | __max1 > __max2 ? __max1: __max2; }) | ||
390 | |||
391 | /** | ||
392 | * clamp_t - return a value clamped to a given range using a given type | ||
393 | * @type: the type of variable to use | ||
394 | * @val: current value | ||
395 | * @min: minimum allowable value | ||
396 | * @max: maximum allowable value | ||
397 | * | ||
398 | * This macro does no typechecking and uses temporary variables of type | ||
399 | * 'type' to make all the comparisons. | ||
357 | */ | 400 | */ |
358 | #define min_t(type,x,y) \ | 401 | #define clamp_t(type, val, min, max) ({ \ |
359 | ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) | 402 | type __val = (val); \ |
360 | #define max_t(type,x,y) \ | 403 | type __min = (min); \ |
361 | ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) | 404 | type __max = (max); \ |
405 | __val = __val < __min ? __min: __val; \ | ||
406 | __val > __max ? __max: __val; }) | ||
362 | 407 | ||
408 | /** | ||
409 | * clamp_val - return a value clamped to a given range using val's type | ||
410 | * @val: current value | ||
411 | * @min: minimum allowable value | ||
412 | * @max: maximum allowable value | ||
413 | * | ||
414 | * This macro does no typechecking and uses temporary variables of whatever | ||
415 | * type the input argument 'val' is. This is useful when val is an unsigned | ||
416 | * type and min and max are literals that will otherwise be assigned a signed | ||
417 | * integer type. | ||
418 | */ | ||
419 | #define clamp_val(val, min, max) ({ \ | ||
420 | typeof(val) __val = (val); \ | ||
421 | typeof(val) __min = (min); \ | ||
422 | typeof(val) __max = (max); \ | ||
423 | __val = __val < __min ? __min: __val; \ | ||
424 | __val > __max ? __max: __val; }) | ||
363 | 425 | ||
364 | /** | 426 | /** |
365 | * container_of - cast a member of a structure out to the containing structure | 427 | * container_of - cast a member of a structure out to the containing structure |
diff --git a/include/linux/key.h b/include/linux/key.h index a70b8a8f2005..c45c962d1cc5 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/rbtree.h> | 20 | #include <linux/rbtree.h> |
21 | #include <linux/rcupdate.h> | 21 | #include <linux/rcupdate.h> |
22 | #include <linux/sysctl.h> | ||
22 | #include <asm/atomic.h> | 23 | #include <asm/atomic.h> |
23 | 24 | ||
24 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
@@ -67,6 +68,8 @@ struct key; | |||
67 | #define KEY_OTH_SETATTR 0x00000020 | 68 | #define KEY_OTH_SETATTR 0x00000020 |
68 | #define KEY_OTH_ALL 0x0000003f | 69 | #define KEY_OTH_ALL 0x0000003f |
69 | 70 | ||
71 | #define KEY_PERM_UNDEF 0xffffffff | ||
72 | |||
70 | struct seq_file; | 73 | struct seq_file; |
71 | struct user_struct; | 74 | struct user_struct; |
72 | struct signal_struct; | 75 | struct signal_struct; |
@@ -208,16 +211,19 @@ extern struct key *request_key(struct key_type *type, | |||
208 | 211 | ||
209 | extern struct key *request_key_with_auxdata(struct key_type *type, | 212 | extern struct key *request_key_with_auxdata(struct key_type *type, |
210 | const char *description, | 213 | const char *description, |
211 | const char *callout_info, | 214 | const void *callout_info, |
215 | size_t callout_len, | ||
212 | void *aux); | 216 | void *aux); |
213 | 217 | ||
214 | extern struct key *request_key_async(struct key_type *type, | 218 | extern struct key *request_key_async(struct key_type *type, |
215 | const char *description, | 219 | const char *description, |
216 | const char *callout_info); | 220 | const void *callout_info, |
221 | size_t callout_len); | ||
217 | 222 | ||
218 | extern struct key *request_key_async_with_auxdata(struct key_type *type, | 223 | extern struct key *request_key_async_with_auxdata(struct key_type *type, |
219 | const char *description, | 224 | const char *description, |
220 | const char *callout_info, | 225 | const void *callout_info, |
226 | size_t callout_len, | ||
221 | void *aux); | 227 | void *aux); |
222 | 228 | ||
223 | extern int wait_for_key_construction(struct key *key, bool intr); | 229 | extern int wait_for_key_construction(struct key *key, bool intr); |
@@ -229,6 +235,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring, | |||
229 | const char *description, | 235 | const char *description, |
230 | const void *payload, | 236 | const void *payload, |
231 | size_t plen, | 237 | size_t plen, |
238 | key_perm_t perm, | ||
232 | unsigned long flags); | 239 | unsigned long flags); |
233 | 240 | ||
234 | extern int key_update(key_ref_t key, | 241 | extern int key_update(key_ref_t key, |
@@ -257,14 +264,18 @@ extern int keyring_add_key(struct key *keyring, | |||
257 | 264 | ||
258 | extern struct key *key_lookup(key_serial_t id); | 265 | extern struct key *key_lookup(key_serial_t id); |
259 | 266 | ||
260 | #define key_serial(key) ((key) ? (key)->serial : 0) | 267 | static inline key_serial_t key_serial(struct key *key) |
268 | { | ||
269 | return key ? key->serial : 0; | ||
270 | } | ||
271 | |||
272 | #ifdef CONFIG_SYSCTL | ||
273 | extern ctl_table key_sysctls[]; | ||
274 | #endif | ||
261 | 275 | ||
262 | /* | 276 | /* |
263 | * the userspace interface | 277 | * the userspace interface |
264 | */ | 278 | */ |
265 | extern struct key root_user_keyring, root_session_keyring; | ||
266 | extern int alloc_uid_keyring(struct user_struct *user, | ||
267 | struct task_struct *ctx); | ||
268 | extern void switch_uid_keyring(struct user_struct *new_user); | 279 | extern void switch_uid_keyring(struct user_struct *new_user); |
269 | extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); | 280 | extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); |
270 | extern int copy_thread_group_keys(struct task_struct *tsk); | 281 | extern int copy_thread_group_keys(struct task_struct *tsk); |
@@ -293,7 +304,6 @@ extern void key_init(void); | |||
293 | #define make_key_ref(k, p) ({ NULL; }) | 304 | #define make_key_ref(k, p) ({ NULL; }) |
294 | #define key_ref_to_ptr(k) ({ NULL; }) | 305 | #define key_ref_to_ptr(k) ({ NULL; }) |
295 | #define is_key_possessed(k) 0 | 306 | #define is_key_possessed(k) 0 |
296 | #define alloc_uid_keyring(u,c) 0 | ||
297 | #define switch_uid_keyring(u) do { } while(0) | 307 | #define switch_uid_keyring(u) do { } while(0) |
298 | #define __install_session_keyring(t, k) ({ NULL; }) | 308 | #define __install_session_keyring(t, k) ({ NULL; }) |
299 | #define copy_keys(f,t) 0 | 309 | #define copy_keys(f,t) 0 |
@@ -306,10 +316,6 @@ extern void key_init(void); | |||
306 | #define key_fsgid_changed(t) do { } while(0) | 316 | #define key_fsgid_changed(t) do { } while(0) |
307 | #define key_init() do { } while(0) | 317 | #define key_init() do { } while(0) |
308 | 318 | ||
309 | /* Initial keyrings */ | ||
310 | extern struct key root_user_keyring; | ||
311 | extern struct key root_session_keyring; | ||
312 | |||
313 | #endif /* CONFIG_KEYS */ | 319 | #endif /* CONFIG_KEYS */ |
314 | #endif /* __KERNEL__ */ | 320 | #endif /* __KERNEL__ */ |
315 | #endif /* _LINUX_KEY_H */ | 321 | #endif /* _LINUX_KEY_H */ |
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h index 3365945640c9..656ee6b77a4a 100644 --- a/include/linux/keyctl.h +++ b/include/linux/keyctl.h | |||
@@ -49,5 +49,6 @@ | |||
49 | #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ | 49 | #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ |
50 | #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ | 50 | #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ |
51 | #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ | 51 | #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ |
52 | #define KEYCTL_GET_SECURITY 17 /* get key security label */ | ||
52 | 53 | ||
53 | #endif /* _LINUX_KEYCTL_H */ | 54 | #endif /* _LINUX_KEYCTL_H */ |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 404f4464cb1a..29f62e1733ff 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -21,8 +21,6 @@ | |||
21 | #ifndef _LINUX_KFIFO_H | 21 | #ifndef _LINUX_KFIFO_H |
22 | #define _LINUX_KFIFO_H | 22 | #define _LINUX_KFIFO_H |
23 | 23 | ||
24 | #ifdef __KERNEL__ | ||
25 | |||
26 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
27 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
28 | 26 | ||
@@ -151,7 +149,4 @@ static inline unsigned int kfifo_len(struct kfifo *fifo) | |||
151 | return ret; | 149 | return ret; |
152 | } | 150 | } |
153 | 151 | ||
154 | #else | ||
155 | #warning "don't include kernel headers in userspace" | ||
156 | #endif /* __KERNEL__ */ | ||
157 | #endif | 152 | #endif |
diff --git a/include/linux/klist.h b/include/linux/klist.h index 74071254c9d3..06c338ef7f1b 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h | |||
@@ -25,37 +25,47 @@ struct klist { | |||
25 | void (*put)(struct klist_node *); | 25 | void (*put)(struct klist_node *); |
26 | }; | 26 | }; |
27 | 27 | ||
28 | #define KLIST_INIT(_name, _get, _put) \ | ||
29 | { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ | ||
30 | .k_list = LIST_HEAD_INIT(_name.k_list), \ | ||
31 | .get = _get, \ | ||
32 | .put = _put, } | ||
28 | 33 | ||
29 | extern void klist_init(struct klist * k, void (*get)(struct klist_node *), | 34 | #define DEFINE_KLIST(_name, _get, _put) \ |
35 | struct klist _name = KLIST_INIT(_name, _get, _put) | ||
36 | |||
37 | extern void klist_init(struct klist *k, void (*get)(struct klist_node *), | ||
30 | void (*put)(struct klist_node *)); | 38 | void (*put)(struct klist_node *)); |
31 | 39 | ||
32 | struct klist_node { | 40 | struct klist_node { |
33 | struct klist * n_klist; | 41 | struct klist *n_klist; |
34 | struct list_head n_node; | 42 | struct list_head n_node; |
35 | struct kref n_ref; | 43 | struct kref n_ref; |
36 | struct completion n_removed; | 44 | struct completion n_removed; |
37 | }; | 45 | }; |
38 | 46 | ||
39 | extern void klist_add_tail(struct klist_node * n, struct klist * k); | 47 | extern void klist_add_tail(struct klist_node *n, struct klist *k); |
40 | extern void klist_add_head(struct klist_node * n, struct klist * k); | 48 | extern void klist_add_head(struct klist_node *n, struct klist *k); |
49 | extern void klist_add_after(struct klist_node *n, struct klist_node *pos); | ||
50 | extern void klist_add_before(struct klist_node *n, struct klist_node *pos); | ||
41 | 51 | ||
42 | extern void klist_del(struct klist_node * n); | 52 | extern void klist_del(struct klist_node *n); |
43 | extern void klist_remove(struct klist_node * n); | 53 | extern void klist_remove(struct klist_node *n); |
44 | 54 | ||
45 | extern int klist_node_attached(struct klist_node * n); | 55 | extern int klist_node_attached(struct klist_node *n); |
46 | 56 | ||
47 | 57 | ||
48 | struct klist_iter { | 58 | struct klist_iter { |
49 | struct klist * i_klist; | 59 | struct klist *i_klist; |
50 | struct list_head * i_head; | 60 | struct list_head *i_head; |
51 | struct klist_node * i_cur; | 61 | struct klist_node *i_cur; |
52 | }; | 62 | }; |
53 | 63 | ||
54 | 64 | ||
55 | extern void klist_iter_init(struct klist * k, struct klist_iter * i); | 65 | extern void klist_iter_init(struct klist *k, struct klist_iter *i); |
56 | extern void klist_iter_init_node(struct klist * k, struct klist_iter * i, | 66 | extern void klist_iter_init_node(struct klist *k, struct klist_iter *i, |
57 | struct klist_node * n); | 67 | struct klist_node *n); |
58 | extern void klist_iter_exit(struct klist_iter * i); | 68 | extern void klist_iter_exit(struct klist_iter *i); |
59 | extern struct klist_node * klist_next(struct klist_iter * i); | 69 | extern struct klist_node *klist_next(struct klist_iter *i); |
60 | 70 | ||
61 | #endif | 71 | #endif |
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h index bafe178a381f..73717ed9ea79 100644 --- a/include/linux/kobj_map.h +++ b/include/linux/kobj_map.h | |||
@@ -1,5 +1,3 @@ | |||
1 | #ifdef __KERNEL__ | ||
2 | |||
3 | #include <linux/mutex.h> | 1 | #include <linux/mutex.h> |
4 | 2 | ||
5 | typedef struct kobject *kobj_probe_t(dev_t, int *, void *); | 3 | typedef struct kobject *kobj_probe_t(dev_t, int *, void *); |
@@ -10,5 +8,3 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *, | |||
10 | void kobj_unmap(struct kobj_map *, dev_t, unsigned long); | 8 | void kobj_unmap(struct kobj_map *, dev_t, unsigned long); |
11 | struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); | 9 | struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); |
12 | struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); | 10 | struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); |
13 | |||
14 | #endif | ||
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index caa3f411f15d..39e709f88aa0 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -16,8 +16,6 @@ | |||
16 | #ifndef _KOBJECT_H_ | 16 | #ifndef _KOBJECT_H_ |
17 | #define _KOBJECT_H_ | 17 | #define _KOBJECT_H_ |
18 | 18 | ||
19 | #ifdef __KERNEL__ | ||
20 | |||
21 | #include <linux/types.h> | 19 | #include <linux/types.h> |
22 | #include <linux/list.h> | 20 | #include <linux/list.h> |
23 | #include <linux/sysfs.h> | 21 | #include <linux/sysfs.h> |
@@ -224,5 +222,4 @@ static inline int kobject_action_type(const char *buf, size_t count, | |||
224 | { return -EINVAL; } | 222 | { return -EINVAL; } |
225 | #endif | 223 | #endif |
226 | 224 | ||
227 | #endif /* __KERNEL__ */ | ||
228 | #endif /* _KOBJECT_H_ */ | 225 | #endif /* _KOBJECT_H_ */ |
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 | |||
177 | struct kprobe_blackpoint { | ||
178 | const char *name; | ||
179 | unsigned long start_addr; | ||
180 | unsigned long range; | ||
181 | }; | ||
182 | |||
176 | extern struct kretprobe_blackpoint kretprobe_blacklist[]; | 183 | extern struct kretprobe_blackpoint kretprobe_blacklist[]; |
177 | 184 | ||
178 | static inline void kretprobe_assert(struct kretprobe_instance *ri, | 185 | static inline void kretprobe_assert(struct kretprobe_instance *ri, |
@@ -227,15 +234,21 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) | |||
227 | 234 | ||
228 | int register_kprobe(struct kprobe *p); | 235 | int register_kprobe(struct kprobe *p); |
229 | void unregister_kprobe(struct kprobe *p); | 236 | void unregister_kprobe(struct kprobe *p); |
237 | int register_kprobes(struct kprobe **kps, int num); | ||
238 | void unregister_kprobes(struct kprobe **kps, int num); | ||
230 | int setjmp_pre_handler(struct kprobe *, struct pt_regs *); | 239 | int setjmp_pre_handler(struct kprobe *, struct pt_regs *); |
231 | int longjmp_break_handler(struct kprobe *, struct pt_regs *); | 240 | int longjmp_break_handler(struct kprobe *, struct pt_regs *); |
232 | int register_jprobe(struct jprobe *p); | 241 | int register_jprobe(struct jprobe *p); |
233 | void unregister_jprobe(struct jprobe *p); | 242 | void unregister_jprobe(struct jprobe *p); |
243 | int register_jprobes(struct jprobe **jps, int num); | ||
244 | void unregister_jprobes(struct jprobe **jps, int num); | ||
234 | void jprobe_return(void); | 245 | void jprobe_return(void); |
235 | unsigned long arch_deref_entry_point(void *); | 246 | unsigned long arch_deref_entry_point(void *); |
236 | 247 | ||
237 | int register_kretprobe(struct kretprobe *rp); | 248 | int register_kretprobe(struct kretprobe *rp); |
238 | void unregister_kretprobe(struct kretprobe *rp); | 249 | void unregister_kretprobe(struct kretprobe *rp); |
250 | int register_kretprobes(struct kretprobe **rps, int num); | ||
251 | void unregister_kretprobes(struct kretprobe **rps, int num); | ||
239 | 252 | ||
240 | void kprobe_flush_task(struct task_struct *tk); | 253 | void kprobe_flush_task(struct task_struct *tk); |
241 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | 254 | void 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 | } |
270 | static inline int register_kprobes(struct kprobe **kps, int num) | ||
271 | { | ||
272 | return -ENOSYS; | ||
273 | } | ||
257 | static inline void unregister_kprobe(struct kprobe *p) | 274 | static inline void unregister_kprobe(struct kprobe *p) |
258 | { | 275 | { |
259 | } | 276 | } |
277 | static inline void unregister_kprobes(struct kprobe **kps, int num) | ||
278 | { | ||
279 | } | ||
260 | static inline int register_jprobe(struct jprobe *p) | 280 | static inline int register_jprobe(struct jprobe *p) |
261 | { | 281 | { |
262 | return -ENOSYS; | 282 | return -ENOSYS; |
263 | } | 283 | } |
284 | static inline int register_jprobes(struct jprobe **jps, int num) | ||
285 | { | ||
286 | return -ENOSYS; | ||
287 | } | ||
264 | static inline void unregister_jprobe(struct jprobe *p) | 288 | static inline void unregister_jprobe(struct jprobe *p) |
265 | { | 289 | { |
266 | } | 290 | } |
291 | static inline void unregister_jprobes(struct jprobe **jps, int num) | ||
292 | { | ||
293 | } | ||
267 | static inline void jprobe_return(void) | 294 | static 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 | } |
301 | static inline int register_kretprobes(struct kretprobe **rps, int num) | ||
302 | { | ||
303 | return -ENOSYS; | ||
304 | } | ||
274 | static inline void unregister_kretprobe(struct kretprobe *rp) | 305 | static inline void unregister_kretprobe(struct kretprobe *rp) |
275 | { | 306 | { |
276 | } | 307 | } |
308 | static inline void unregister_kretprobes(struct kretprobe **rps, int num) | ||
309 | { | ||
310 | } | ||
277 | static inline void kprobe_flush_task(struct task_struct *tk) | 311 | static inline void kprobe_flush_task(struct task_struct *tk) |
278 | { | 312 | { |
279 | } | 313 | } |
diff --git a/include/linux/kref.h b/include/linux/kref.h index 5d185635786e..0cef6badd6fb 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
@@ -15,8 +15,6 @@ | |||
15 | #ifndef _KREF_H_ | 15 | #ifndef _KREF_H_ |
16 | #define _KREF_H_ | 16 | #define _KREF_H_ |
17 | 17 | ||
18 | #ifdef __KERNEL__ | ||
19 | |||
20 | #include <linux/types.h> | 18 | #include <linux/types.h> |
21 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
22 | 20 | ||
@@ -29,5 +27,4 @@ void kref_init(struct kref *kref); | |||
29 | void kref_get(struct kref *kref); | 27 | void kref_get(struct kref *kref); |
30 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); | 28 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); |
31 | 29 | ||
32 | #endif /* __KERNEL__ */ | ||
33 | #endif /* _KREF_H_ */ | 30 | #endif /* _KREF_H_ */ |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 395a523d8c30..d1dfe872ee30 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -548,11 +548,6 @@ struct ata_device { | |||
548 | u64 n_sectors; /* size of device, if ATA */ | 548 | u64 n_sectors; /* size of device, if ATA */ |
549 | unsigned int class; /* ATA_DEV_xxx */ | 549 | unsigned int class; /* ATA_DEV_xxx */ |
550 | 550 | ||
551 | union { | ||
552 | u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ | ||
553 | u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ | ||
554 | }; | ||
555 | |||
556 | u8 pio_mode; | 551 | u8 pio_mode; |
557 | u8 dma_mode; | 552 | u8 dma_mode; |
558 | u8 xfer_mode; | 553 | u8 xfer_mode; |
@@ -574,8 +569,13 @@ struct ata_device { | |||
574 | u16 sectors; /* Number of sectors per track */ | 569 | u16 sectors; /* Number of sectors per track */ |
575 | 570 | ||
576 | /* error history */ | 571 | /* error history */ |
577 | struct ata_ering ering; | ||
578 | int spdn_cnt; | 572 | int spdn_cnt; |
573 | struct ata_ering ering; | ||
574 | |||
575 | union { | ||
576 | u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ | ||
577 | u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ | ||
578 | }; | ||
579 | }; | 579 | }; |
580 | 580 | ||
581 | /* Offset into struct ata_device. Fields above it are maintained | 581 | /* Offset into struct ata_device. Fields above it are maintained |
diff --git a/include/linux/list.h b/include/linux/list.h index dac16f99c701..08cf4f651889 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _LINUX_LIST_H | 1 | #ifndef _LINUX_LIST_H |
2 | #define _LINUX_LIST_H | 2 | #define _LINUX_LIST_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/stddef.h> | 4 | #include <linux/stddef.h> |
7 | #include <linux/poison.h> | 5 | #include <linux/poison.h> |
8 | #include <linux/prefetch.h> | 6 | #include <linux/prefetch.h> |
@@ -319,7 +317,16 @@ static inline int list_empty_careful(const struct list_head *head) | |||
319 | return (next == head) && (next == head->prev); | 317 | return (next == head) && (next == head->prev); |
320 | } | 318 | } |
321 | 319 | ||
322 | static inline void __list_splice(struct list_head *list, | 320 | /** |
321 | * list_is_singular - tests whether a list has just one entry. | ||
322 | * @head: the list to test. | ||
323 | */ | ||
324 | static inline int list_is_singular(const struct list_head *head) | ||
325 | { | ||
326 | return !list_empty(head) && (head->next == head->prev); | ||
327 | } | ||
328 | |||
329 | static inline void __list_splice(const struct list_head *list, | ||
323 | struct list_head *head) | 330 | struct list_head *head) |
324 | { | 331 | { |
325 | struct list_head *first = list->next; | 332 | struct list_head *first = list->next; |
@@ -338,7 +345,8 @@ static inline void __list_splice(struct list_head *list, | |||
338 | * @list: the new list to add. | 345 | * @list: the new list to add. |
339 | * @head: the place to add it in the first list. | 346 | * @head: the place to add it in the first list. |
340 | */ | 347 | */ |
341 | static inline void list_splice(struct list_head *list, struct list_head *head) | 348 | static inline void list_splice(const struct list_head *list, |
349 | struct list_head *head) | ||
342 | { | 350 | { |
343 | if (!list_empty(list)) | 351 | if (!list_empty(list)) |
344 | __list_splice(list, head); | 352 | __list_splice(list, head); |
@@ -973,7 +981,4 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
973 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | 981 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ |
974 | pos = rcu_dereference(pos->next)) | 982 | pos = rcu_dereference(pos->next)) |
975 | 983 | ||
976 | #else | ||
977 | #warning "don't include kernel headers in userspace" | ||
978 | #endif /* __KERNEL__ */ | ||
979 | #endif | 984 | #endif |
diff --git a/include/linux/lmb.h b/include/linux/lmb.h index 271153d27fba..c46c89505dac 100644 --- a/include/linux/lmb.h +++ b/include/linux/lmb.h | |||
@@ -40,7 +40,8 @@ extern struct lmb lmb; | |||
40 | 40 | ||
41 | extern void __init lmb_init(void); | 41 | extern void __init lmb_init(void); |
42 | extern void __init lmb_analyze(void); | 42 | extern void __init lmb_analyze(void); |
43 | extern long __init lmb_add(u64 base, u64 size); | 43 | extern long lmb_add(u64 base, u64 size); |
44 | extern long lmb_remove(u64 base, u64 size); | ||
44 | extern long __init lmb_reserve(u64 base, u64 size); | 45 | extern long __init lmb_reserve(u64 base, u64 size); |
45 | extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, | 46 | extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, |
46 | u64 (*nid_range)(u64, u64, int *)); | 47 | u64 (*nid_range)(u64, u64, int *)); |
@@ -53,6 +54,7 @@ extern u64 __init lmb_phys_mem_size(void); | |||
53 | extern u64 __init lmb_end_of_DRAM(void); | 54 | extern u64 __init lmb_end_of_DRAM(void); |
54 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); | 55 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); |
55 | extern int __init lmb_is_reserved(u64 addr); | 56 | extern int __init lmb_is_reserved(u64 addr); |
57 | extern int lmb_find(struct lmb_property *res); | ||
56 | 58 | ||
57 | extern void lmb_dump_all(void); | 59 | extern void lmb_dump_all(void); |
58 | 60 | ||
diff --git a/include/linux/math64.h b/include/linux/math64.h new file mode 100644 index 000000000000..c1a5f81501ff --- /dev/null +++ b/include/linux/math64.h | |||
@@ -0,0 +1,84 @@ | |||
1 | #ifndef _LINUX_MATH64_H | ||
2 | #define _LINUX_MATH64_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/div64.h> | ||
6 | |||
7 | #if BITS_PER_LONG == 64 | ||
8 | |||
9 | /** | ||
10 | * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder | ||
11 | * | ||
12 | * This is commonly provided by 32bit archs to provide an optimized 64bit | ||
13 | * divide. | ||
14 | */ | ||
15 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) | ||
16 | { | ||
17 | *remainder = dividend % divisor; | ||
18 | return dividend / divisor; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * div_s64_rem - signed 64bit divide with 32bit divisor with remainder | ||
23 | */ | ||
24 | static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) | ||
25 | { | ||
26 | *remainder = dividend % divisor; | ||
27 | return dividend / divisor; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * div64_u64 - unsigned 64bit divide with 64bit divisor | ||
32 | */ | ||
33 | static inline u64 div64_u64(u64 dividend, u64 divisor) | ||
34 | { | ||
35 | return dividend / divisor; | ||
36 | } | ||
37 | |||
38 | #elif BITS_PER_LONG == 32 | ||
39 | |||
40 | #ifndef div_u64_rem | ||
41 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) | ||
42 | { | ||
43 | *remainder = do_div(dividend, divisor); | ||
44 | return dividend; | ||
45 | } | ||
46 | #endif | ||
47 | |||
48 | #ifndef div_s64_rem | ||
49 | extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder); | ||
50 | #endif | ||
51 | |||
52 | #ifndef div64_u64 | ||
53 | extern u64 div64_u64(u64 dividend, u64 divisor); | ||
54 | #endif | ||
55 | |||
56 | #endif /* BITS_PER_LONG */ | ||
57 | |||
58 | /** | ||
59 | * div_u64 - unsigned 64bit divide with 32bit divisor | ||
60 | * | ||
61 | * This is the most common 64bit divide and should be used if possible, | ||
62 | * as many 32bit archs can optimize this variant better than a full 64bit | ||
63 | * divide. | ||
64 | */ | ||
65 | #ifndef div_u64 | ||
66 | static inline u64 div_u64(u64 dividend, u32 divisor) | ||
67 | { | ||
68 | u32 remainder; | ||
69 | return div_u64_rem(dividend, divisor, &remainder); | ||
70 | } | ||
71 | #endif | ||
72 | |||
73 | /** | ||
74 | * div_s64 - signed 64bit divide with 32bit divisor | ||
75 | */ | ||
76 | #ifndef div_s64 | ||
77 | static inline s64 div_s64(s64 dividend, s32 divisor) | ||
78 | { | ||
79 | s32 remainder; | ||
80 | return div_s64_rem(dividend, divisor, &remainder); | ||
81 | } | ||
82 | #endif | ||
83 | |||
84 | #endif /* _LINUX_MATH64_H */ | ||
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h index f2bb770e530a..7a3aea845902 100644 --- a/include/linux/mca-legacy.h +++ b/include/linux/mca-legacy.h | |||
@@ -34,7 +34,6 @@ | |||
34 | extern int mca_find_adapter(int id, int start); | 34 | extern int mca_find_adapter(int id, int start); |
35 | extern int mca_find_unused_adapter(int id, int start); | 35 | extern int mca_find_unused_adapter(int id, int start); |
36 | 36 | ||
37 | extern int mca_is_adapter_used(int slot); | ||
38 | extern int mca_mark_as_used(int slot); | 37 | extern int mca_mark_as_used(int slot); |
39 | extern void mca_mark_as_unused(int slot); | 38 | extern void mca_mark_as_unused(int slot); |
40 | 39 | ||
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 8b1c4295848b..e6608776bc96 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -27,9 +27,6 @@ struct mm_struct; | |||
27 | 27 | ||
28 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 28 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
29 | 29 | ||
30 | extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p); | ||
31 | extern void mm_free_cgroup(struct mm_struct *mm); | ||
32 | |||
33 | #define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0) | 30 | #define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0) |
34 | 31 | ||
35 | extern struct page_cgroup *page_get_page_cgroup(struct page *page); | 32 | extern struct page_cgroup *page_get_page_cgroup(struct page *page); |
@@ -48,8 +45,10 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | |||
48 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); | 45 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); |
49 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); | 46 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); |
50 | 47 | ||
48 | extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | ||
49 | |||
51 | #define mm_match_cgroup(mm, cgroup) \ | 50 | #define mm_match_cgroup(mm, cgroup) \ |
52 | ((cgroup) == rcu_dereference((mm)->mem_cgroup)) | 51 | ((cgroup) == mem_cgroup_from_task((mm)->owner)) |
53 | 52 | ||
54 | extern int mem_cgroup_prepare_migration(struct page *page); | 53 | extern int mem_cgroup_prepare_migration(struct page *page); |
55 | extern void mem_cgroup_end_migration(struct page *page); | 54 | extern void mem_cgroup_end_migration(struct page *page); |
@@ -73,15 +72,6 @@ extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem, | |||
73 | struct zone *zone, int priority); | 72 | struct zone *zone, int priority); |
74 | 73 | ||
75 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 74 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
76 | static inline void mm_init_cgroup(struct mm_struct *mm, | ||
77 | struct task_struct *p) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | static inline void mm_free_cgroup(struct mm_struct *mm) | ||
82 | { | ||
83 | } | ||
84 | |||
85 | static inline void page_reset_bad_cgroup(struct page *page) | 75 | static inline void page_reset_bad_cgroup(struct page *page) |
86 | { | 76 | { |
87 | } | 77 | } |
diff --git a/include/linux/memory.h b/include/linux/memory.h index f80e0e331cb7..2f5f8a5ef2a0 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -53,6 +53,13 @@ struct memory_notify { | |||
53 | struct notifier_block; | 53 | struct notifier_block; |
54 | struct mem_section; | 54 | struct mem_section; |
55 | 55 | ||
56 | /* | ||
57 | * Priorities for the hotplug memory callback routines (stored in decreasing | ||
58 | * order in the callback chain) | ||
59 | */ | ||
60 | #define SLAB_CALLBACK_PRI 1 | ||
61 | #define IPC_CALLBACK_PRI 10 | ||
62 | |||
56 | #ifndef CONFIG_MEMORY_HOTPLUG_SPARSE | 63 | #ifndef CONFIG_MEMORY_HOTPLUG_SPARSE |
57 | static inline int memory_dev_init(void) | 64 | static inline int memory_dev_init(void) |
58 | { | 65 | { |
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 @@ | |||
8 | struct page; | 8 | struct page; |
9 | struct zone; | 9 | struct zone; |
10 | struct pglist_data; | 10 | struct pglist_data; |
11 | struct 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 */ |
65 | extern int __add_pages(struct zone *zone, unsigned long start_pfn, | 75 | extern int __add_pages(struct zone *zone, unsigned long start_pfn, |
66 | unsigned long nr_pages); | 76 | unsigned long nr_pages); |
77 | extern 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 | */ |
72 | extern int walk_memory_resource(unsigned long start_pfn, | 84 | extern 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 | ||
158 | static inline void register_page_bootmem_info_node(struct pglist_data *pgdat) | ||
159 | { | ||
160 | } | ||
161 | static inline void put_page_bootmem(struct page *page) | ||
162 | { | ||
163 | } | ||
164 | #else | ||
165 | extern void register_page_bootmem_info_node(struct pglist_data *pgdat); | ||
166 | extern 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 | ||
196 | static 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 | ||
174 | extern int add_memory(int nid, u64 start, u64 size); | 202 | extern int add_memory(int nid, u64 start, u64 size); |
@@ -176,5 +204,8 @@ extern int arch_add_memory(int nid, u64 start, u64 size); | |||
176 | extern int remove_memory(u64 start, u64 size); | 204 | extern int remove_memory(u64 start, u64 size); |
177 | extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, | 205 | extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, |
178 | int nr_pages); | 206 | int nr_pages); |
207 | extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); | ||
208 | extern 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 | 18 | enum { |
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 | ||
38 | struct vm_area_struct; | ||
39 | struct mm_struct; | 63 | struct 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 | */ |
63 | struct mempolicy { | 89 | struct 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 | ||
80 | extern void __mpol_free(struct mempolicy *pol); | 109 | extern void __mpol_put(struct mempolicy *pol); |
81 | static inline void mpol_free(struct mempolicy *pol) | 110 | static 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 | ||
87 | extern struct mempolicy *__mpol_copy(struct mempolicy *pol); | 116 | /* |
88 | static 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 | */ | ||
120 | static inline int mpol_needs_cond_ref(struct mempolicy *pol) | ||
121 | { | ||
122 | return (pol && (pol->flags & MPOL_F_SHARED)); | ||
123 | } | ||
124 | |||
125 | static inline void mpol_cond_put(struct mempolicy *pol) | ||
126 | { | ||
127 | if (mpol_needs_cond_ref(pol)) | ||
128 | __mpol_put(pol); | ||
129 | } | ||
130 | |||
131 | extern struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol, | ||
132 | struct mempolicy *frompol); | ||
133 | static 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 | |||
141 | extern struct mempolicy *__mpol_dup(struct mempolicy *pol); | ||
142 | static 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 | ||
136 | void mpol_shared_policy_init(struct shared_policy *info, int policy, | 185 | void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); |
137 | nodemask_t *nodes); | ||
138 | int mpol_set_shared_policy(struct shared_policy *info, | 186 | int 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, | |||
149 | extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); | 197 | extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); |
150 | extern void mpol_fix_fork_child_flag(struct task_struct *p); | 198 | extern void mpol_fix_fork_child_flag(struct task_struct *p); |
151 | 199 | ||
152 | extern struct mempolicy default_policy; | ||
153 | extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, | 200 | extern 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); | ||
155 | extern unsigned slab_node(struct mempolicy *policy); | 203 | extern unsigned slab_node(struct mempolicy *policy); |
156 | 204 | ||
157 | extern enum zone_type policy_zone; | 205 | extern enum zone_type policy_zone; |
@@ -165,6 +213,13 @@ static inline void check_highest_zone(enum zone_type k) | |||
165 | int do_migrate_pages(struct mm_struct *mm, | 213 | int 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 | ||
218 | extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); | ||
219 | |||
220 | extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, | ||
221 | int no_context); | ||
222 | #endif | ||
168 | #else | 223 | #else |
169 | 224 | ||
170 | struct mempolicy {}; | 225 | struct 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) | 232 | static inline void mpol_put(struct mempolicy *p) |
233 | { | ||
234 | } | ||
235 | |||
236 | static inline void mpol_cond_put(struct mempolicy *pol) | ||
237 | { | ||
238 | } | ||
179 | 239 | ||
180 | static inline void mpol_free(struct mempolicy *p) | 240 | static inline struct mempolicy *mpol_cond_copy(struct mempolicy *to, |
241 | struct mempolicy *from) | ||
181 | { | 242 | { |
243 | return from; | ||
182 | } | 244 | } |
183 | 245 | ||
184 | static inline void mpol_get(struct mempolicy *pol) | 246 | static inline void mpol_get(struct mempolicy *pol) |
185 | { | 247 | { |
186 | } | 248 | } |
187 | 249 | ||
188 | static inline struct mempolicy *mpol_copy(struct mempolicy *old) | 250 | static 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 | ||
202 | static inline void mpol_shared_policy_init(struct shared_policy *info, | 264 | static 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 | ||
241 | static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, | 303 | static 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 | ||
247 | static inline int do_migrate_pages(struct mm_struct *mm, | 312 | static inline int do_migrate_pages(struct mm_struct *mm, |
@@ -254,6 +319,21 @@ static inline int do_migrate_pages(struct mm_struct *mm, | |||
254 | static inline void check_highest_zone(int k) | 319 | static inline void check_highest_zone(int k) |
255 | { | 320 | { |
256 | } | 321 | } |
322 | |||
323 | #ifdef CONFIG_TMPFS | ||
324 | static inline int mpol_parse_str(char *str, struct mempolicy **mpol, | ||
325 | int no_context) | ||
326 | { | ||
327 | return 1; /* error */ | ||
328 | } | ||
329 | |||
330 | static 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/mlx4/device.h b/include/linux/mlx4/device.h index 9fa1a8002ce2..a744383d16e9 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -382,7 +382,8 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres, | |||
382 | int size); | 382 | int size); |
383 | 383 | ||
384 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | 384 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, |
385 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq); | 385 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, |
386 | int collapsed); | ||
386 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); | 387 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); |
387 | 388 | ||
388 | int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp); | 389 | int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 286d31521605..c31a9cd2a30e 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) | ||
507 | static inline unsigned long page_to_section(struct page *page) | 528 | static 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 | ||
512 | static inline void set_page_zone(struct page *page, enum zone_type zone) | 534 | static 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 | ||
723 | struct page *vm_normal_page(struct vm_area_struct *, unsigned long, pte_t); | 742 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, |
743 | pte_t pte); | ||
744 | |||
724 | unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, | 745 | unsigned 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 *); |
726 | unsigned long unmap_vmas(struct mmu_gather **tlb, | 747 | unsigned long unmap_vmas(struct mmu_gather **tlb, |
@@ -1045,6 +1066,19 @@ extern void unlink_file_vma(struct vm_area_struct *); | |||
1045 | extern struct vm_area_struct *copy_vma(struct vm_area_struct **, | 1066 | extern struct vm_area_struct *copy_vma(struct vm_area_struct **, |
1046 | unsigned long addr, unsigned long len, pgoff_t pgoff); | 1067 | unsigned long addr, unsigned long len, pgoff_t pgoff); |
1047 | extern void exit_mmap(struct mm_struct *); | 1068 | extern void exit_mmap(struct mm_struct *); |
1069 | |||
1070 | #ifdef CONFIG_PROC_FS | ||
1071 | /* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ | ||
1072 | extern void added_exe_file_vma(struct mm_struct *mm); | ||
1073 | extern void removed_exe_file_vma(struct mm_struct *mm); | ||
1074 | #else | ||
1075 | static inline void added_exe_file_vma(struct mm_struct *mm) | ||
1076 | {} | ||
1077 | |||
1078 | static inline void removed_exe_file_vma(struct mm_struct *mm) | ||
1079 | {} | ||
1080 | #endif /* CONFIG_PROC_FS */ | ||
1081 | |||
1048 | extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); | 1082 | extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); |
1049 | extern int install_special_mapping(struct mm_struct *mm, | 1083 | extern int install_special_mapping(struct mm_struct *mm, |
1050 | unsigned long addr, unsigned long len, | 1084 | unsigned long addr, unsigned long len, |
@@ -1149,6 +1183,8 @@ int remap_pfn_range(struct vm_area_struct *, unsigned long addr, | |||
1149 | int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); | 1183 | int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); |
1150 | int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, | 1184 | int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, |
1151 | unsigned long pfn); | 1185 | unsigned long pfn); |
1186 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | ||
1187 | unsigned long pfn); | ||
1152 | 1188 | ||
1153 | struct page *follow_page(struct vm_area_struct *, unsigned long address, | 1189 | struct page *follow_page(struct vm_area_struct *, unsigned long address, |
1154 | unsigned int foll_flags); | 1190 | unsigned int foll_flags); |
@@ -1207,8 +1243,6 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, | |||
1207 | void __user *, size_t *, loff_t *); | 1243 | void __user *, size_t *, loff_t *); |
1208 | unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, | 1244 | unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, |
1209 | unsigned long lru_pages); | 1245 | unsigned long lru_pages); |
1210 | void drop_pagecache(void); | ||
1211 | void drop_slab(void); | ||
1212 | 1246 | ||
1213 | #ifndef CONFIG_MMU | 1247 | #ifndef CONFIG_MMU |
1214 | #define randomize_va_space 0 | 1248 | #define randomize_va_space 0 |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index af190ceab971..eb7c16cc9559 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -42,7 +42,10 @@ struct page { | |||
42 | * to show when page is mapped | 42 | * to show when page is mapped |
43 | * & limit reverse map searches. | 43 | * & limit reverse map searches. |
44 | */ | 44 | */ |
45 | unsigned int inuse; /* SLUB: Nr of objects */ | 45 | struct { /* SLUB */ |
46 | u16 inuse; | ||
47 | u16 objects; | ||
48 | }; | ||
46 | }; | 49 | }; |
47 | union { | 50 | union { |
48 | struct { | 51 | struct { |
@@ -172,6 +175,7 @@ struct mm_struct { | |||
172 | atomic_t mm_users; /* How many users with user space? */ | 175 | 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) */ | 176 | atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ |
174 | int map_count; /* number of VMAs */ | 177 | int map_count; /* number of VMAs */ |
178 | int core_waiters; | ||
175 | struct rw_semaphore mmap_sem; | 179 | struct rw_semaphore mmap_sem; |
176 | spinlock_t page_table_lock; /* Protects page tables and some counters */ | 180 | spinlock_t page_table_lock; /* Protects page tables and some counters */ |
177 | 181 | ||
@@ -216,14 +220,20 @@ struct mm_struct { | |||
216 | unsigned long flags; /* Must use atomic bitops to access the bits */ | 220 | unsigned long flags; /* Must use atomic bitops to access the bits */ |
217 | 221 | ||
218 | /* coredumping support */ | 222 | /* coredumping support */ |
219 | int core_waiters; | ||
220 | struct completion *core_startup_done, core_done; | 223 | struct completion *core_startup_done, core_done; |
221 | 224 | ||
222 | /* aio bits */ | 225 | /* aio bits */ |
223 | rwlock_t ioctx_list_lock; | 226 | rwlock_t ioctx_list_lock; /* aio lock */ |
224 | struct kioctx *ioctx_list; | 227 | struct kioctx *ioctx_list; |
225 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 228 | #ifdef CONFIG_MM_OWNER |
226 | struct mem_cgroup *mem_cgroup; | 229 | struct task_struct *owner; /* The thread group leader that */ |
230 | /* owns the mm_struct. */ | ||
231 | #endif | ||
232 | |||
233 | #ifdef CONFIG_PROC_FS | ||
234 | /* store ref to file /proc/<pid>/exe symlink points to */ | ||
235 | struct file *exe_file; | ||
236 | unsigned long num_exe_file_vmas; | ||
227 | #endif | 237 | #endif |
228 | }; | 238 | }; |
229 | 239 | ||
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 9f274a687c7e..c463cd8a15a4 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _LINUX_MMZONE_H | 1 | #ifndef _LINUX_MMZONE_H |
2 | #define _LINUX_MMZONE_H | 2 | #define _LINUX_MMZONE_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | #ifndef __GENERATING_BOUNDS_H | ||
6 | 6 | ||
7 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
8 | #include <linux/list.h> | 8 | #include <linux/list.h> |
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/seqlock.h> | 15 | #include <linux/seqlock.h> |
16 | #include <linux/nodemask.h> | 16 | #include <linux/nodemask.h> |
17 | #include <linux/pageblock-flags.h> | 17 | #include <linux/pageblock-flags.h> |
18 | #include <linux/bounds.h> | ||
18 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
19 | #include <asm/page.h> | 20 | #include <asm/page.h> |
20 | 21 | ||
@@ -95,6 +96,7 @@ enum zone_stat_item { | |||
95 | NR_UNSTABLE_NFS, /* NFS unstable pages */ | 96 | NR_UNSTABLE_NFS, /* NFS unstable pages */ |
96 | NR_BOUNCE, | 97 | NR_BOUNCE, |
97 | NR_VMSCAN_WRITE, | 98 | NR_VMSCAN_WRITE, |
99 | NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ | ||
98 | #ifdef CONFIG_NUMA | 100 | #ifdef CONFIG_NUMA |
99 | NUMA_HIT, /* allocated in intended node */ | 101 | NUMA_HIT, /* allocated in intended node */ |
100 | NUMA_MISS, /* allocated in non intended node */ | 102 | NUMA_MISS, /* allocated in non intended node */ |
@@ -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 | |||
132 | enum zone_type { | 136 | enum 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 | ||
214 | struct zone { | 207 | struct 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 |
468 | struct zonelist_cache; | 461 | struct 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 | */ | ||
468 | struct 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 | |||
481 | struct zonelist { | 490 | struct 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 | */ | ||
496 | static inline int alloc_should_filter_zonelist(struct zonelist *zonelist) | ||
497 | { | ||
498 | return !zonelist->zlcache_ptr; | ||
499 | } | ||
500 | #else | ||
501 | static 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 |
508 | struct node_active_region { | 499 | struct 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) | |||
637 | static inline int is_highmem(struct zone *zone) | 628 | static 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 | 725 | static 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 | 730 | static 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 | |||
735 | static 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 | 757 | struct 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 | 775 | static 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) | 818 | static 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 | } |
835 | extern int __section_nr(struct mem_section* ms); | 898 | extern int __section_nr(struct mem_section* ms); |
899 | extern 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,6 @@ 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__ */ | ||
943 | #endif /* _LINUX_MMZONE_H */ | 1007 | #endif /* _LINUX_MMZONE_H */ |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 139d49d2f078..d73eceaa7afb 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -368,4 +368,15 @@ struct virtio_device_id { | |||
368 | }; | 368 | }; |
369 | #define VIRTIO_DEV_ANY_ID 0xffffffff | 369 | #define VIRTIO_DEV_ANY_ID 0xffffffff |
370 | 370 | ||
371 | /* i2c */ | ||
372 | |||
373 | #define I2C_NAME_SIZE 20 | ||
374 | #define I2C_MODULE_PREFIX "i2c:" | ||
375 | |||
376 | struct i2c_device_id { | ||
377 | char name[I2C_NAME_SIZE]; | ||
378 | kernel_ulong_t driver_data; /* Data private to the driver */ | ||
379 | }; | ||
380 | |||
381 | |||
371 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 382 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 819c4e889bf1..3e03b1acbc94 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -190,7 +190,7 @@ void *__symbol_get_gpl(const char *symbol); | |||
190 | extern typeof(sym) sym; \ | 190 | extern typeof(sym) sym; \ |
191 | __CRC_SYMBOL(sym, sec) \ | 191 | __CRC_SYMBOL(sym, sec) \ |
192 | static const char __kstrtab_##sym[] \ | 192 | static const char __kstrtab_##sym[] \ |
193 | __attribute__((section("__ksymtab_strings"))) \ | 193 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ |
194 | = MODULE_SYMBOL_PREFIX #sym; \ | 194 | = MODULE_SYMBOL_PREFIX #sym; \ |
195 | static const struct kernel_symbol __ksymtab_##sym \ | 195 | static const struct kernel_symbol __ksymtab_##sym \ |
196 | __used \ | 196 | __used \ |
@@ -229,23 +229,6 @@ enum module_state | |||
229 | MODULE_STATE_GOING, | 229 | MODULE_STATE_GOING, |
230 | }; | 230 | }; |
231 | 231 | ||
232 | /* Similar stuff for section attributes. */ | ||
233 | struct module_sect_attr | ||
234 | { | ||
235 | struct module_attribute mattr; | ||
236 | char *name; | ||
237 | unsigned long address; | ||
238 | }; | ||
239 | |||
240 | struct module_sect_attrs | ||
241 | { | ||
242 | struct attribute_group grp; | ||
243 | int nsections; | ||
244 | struct module_sect_attr attrs[0]; | ||
245 | }; | ||
246 | |||
247 | struct module_param_attrs; | ||
248 | |||
249 | struct module | 232 | struct module |
250 | { | 233 | { |
251 | enum module_state state; | 234 | enum module_state state; |
diff --git a/include/linux/mount.h b/include/linux/mount.h index b4836d58f428..4374d1adeb4b 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | #ifndef _LINUX_MOUNT_H | 11 | #ifndef _LINUX_MOUNT_H |
12 | #define _LINUX_MOUNT_H | 12 | #define _LINUX_MOUNT_H |
13 | #ifdef __KERNEL__ | ||
14 | 13 | ||
15 | #include <linux/types.h> | 14 | #include <linux/types.h> |
16 | #include <linux/list.h> | 15 | #include <linux/list.h> |
@@ -114,5 +113,4 @@ extern void mark_mounts_for_expiry(struct list_head *mounts); | |||
114 | extern spinlock_t vfsmount_lock; | 113 | extern spinlock_t vfsmount_lock; |
115 | extern dev_t name_to_dev_t(char *name); | 114 | extern dev_t name_to_dev_t(char *name); |
116 | 115 | ||
117 | #endif | ||
118 | #endif /* _LINUX_MOUNT_H */ | 116 | #endif /* _LINUX_MOUNT_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) | 61 | static 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); |
402 | extern const struct file_operations fat_file_operations; | 408 | extern const struct file_operations fat_file_operations; |
403 | extern const struct inode_operations fat_file_inode_operations; | 409 | extern const struct inode_operations fat_file_inode_operations; |
404 | extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); | 410 | extern int fat_setattr(struct dentry * dentry, struct iattr * attr); |
405 | extern void fat_truncate(struct inode *inode); | 411 | extern void fat_truncate(struct inode *inode); |
406 | extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, | 412 | extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, |
407 | struct kstat *stat); | 413 | struct kstat *stat); |
diff --git a/include/linux/msg.h b/include/linux/msg.h index 10a3d5a1abff..6f3b8e79a991 100644 --- a/include/linux/msg.h +++ b/include/linux/msg.h | |||
@@ -49,16 +49,26 @@ struct msginfo { | |||
49 | unsigned short msgseg; | 49 | unsigned short msgseg; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | /* | ||
53 | * Scaling factor to compute msgmni: | ||
54 | * the memory dedicated to msg queues (msgmni * msgmnb) should occupy | ||
55 | * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c): | ||
56 | * up to 8MB : msgmni = 16 (MSGMNI) | ||
57 | * 4 GB : msgmni = 8K | ||
58 | * more than 16 GB : msgmni = 32K (IPCMNI) | ||
59 | */ | ||
60 | #define MSG_MEM_SCALE 32 | ||
61 | |||
52 | #define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ | 62 | #define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ |
53 | #define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ | 63 | #define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ |
54 | #define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ | 64 | #define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ |
55 | 65 | ||
56 | /* unused */ | 66 | /* unused */ |
57 | #define MSGPOOL (MSGMNI*MSGMNB/1024) /* size in kilobytes of message pool */ | 67 | #define MSGPOOL (MSGMNI * MSGMNB) /* size in bytes of message pool */ |
58 | #define MSGTQL MSGMNB /* number of system message headers */ | 68 | #define MSGTQL MSGMNB /* number of system message headers */ |
59 | #define MSGMAP MSGMNB /* number of entries in message map */ | 69 | #define MSGMAP MSGMNB /* number of entries in message map */ |
60 | #define MSGSSZ 16 /* message segment size */ | 70 | #define MSGSSZ 16 /* message segment size */ |
61 | #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) /* max no. of segments */ | 71 | #define __MSGSEG (MSGPOOL / MSGSSZ) /* max no. of segments */ |
62 | #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) | 72 | #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) |
63 | 73 | ||
64 | #ifdef __KERNEL__ | 74 | #ifdef __KERNEL__ |
diff --git a/include/linux/msi.h b/include/linux/msi.h index 94bb46d82efd..8f2939227207 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
@@ -22,6 +22,7 @@ struct msi_desc { | |||
22 | __u8 masked : 1; | 22 | __u8 masked : 1; |
23 | __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ | 23 | __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ |
24 | __u8 pos; /* Location of the msi capability */ | 24 | __u8 pos; /* Location of the msi capability */ |
25 | __u32 maskbits_mask; /* mask bits mask */ | ||
25 | __u16 entry_nr; /* specific enabled entry */ | 26 | __u16 entry_nr; /* specific enabled entry */ |
26 | unsigned default_irq; /* default pre-assigned irq */ | 27 | unsigned default_irq; /* default pre-assigned irq */ |
27 | }msi_attrib; | 28 | }msi_attrib; |
diff --git a/include/linux/mtd/jedec.h b/include/linux/mtd/jedec.h deleted file mode 100644 index 9006feb218b9..000000000000 --- a/include/linux/mtd/jedec.h +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | |||
2 | /* JEDEC Flash Interface. | ||
3 | * This is an older type of interface for self programming flash. It is | ||
4 | * commonly use in older AMD chips and is obsolete compared with CFI. | ||
5 | * It is called JEDEC because the JEDEC association distributes the ID codes | ||
6 | * for the chips. | ||
7 | * | ||
8 | * See the AMD flash databook for information on how to operate the interface. | ||
9 | * | ||
10 | * $Id: jedec.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MTD_JEDEC_H__ | ||
14 | #define __LINUX_MTD_JEDEC_H__ | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | #define MAX_JEDEC_CHIPS 16 | ||
19 | |||
20 | // Listing of all supported chips and their information | ||
21 | struct JEDECTable | ||
22 | { | ||
23 | __u16 jedec; | ||
24 | char *name; | ||
25 | unsigned long size; | ||
26 | unsigned long sectorsize; | ||
27 | __u32 capabilities; | ||
28 | }; | ||
29 | |||
30 | // JEDEC being 0 is the end of the chip array | ||
31 | struct jedec_flash_chip | ||
32 | { | ||
33 | __u16 jedec; | ||
34 | unsigned long size; | ||
35 | unsigned long sectorsize; | ||
36 | |||
37 | // *(__u8*)(base + (adder << addrshift)) = data << datashift | ||
38 | // Address size = size << addrshift | ||
39 | unsigned long base; // Byte 0 of the flash, will be unaligned | ||
40 | unsigned int datashift; // Useful for 32bit/16bit accesses | ||
41 | unsigned int addrshift; | ||
42 | unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash | ||
43 | |||
44 | __u32 capabilities; | ||
45 | |||
46 | // These markers are filled in by the flash_chip_scan function | ||
47 | unsigned long start; | ||
48 | unsigned long length; | ||
49 | }; | ||
50 | |||
51 | struct jedec_private | ||
52 | { | ||
53 | unsigned long size; // Total size of all the devices | ||
54 | |||
55 | /* Bank handling. If sum(bank_fill) == size then this is linear flash. | ||
56 | Otherwise the mapping has holes in it. bank_fill may be used to | ||
57 | find the holes, but in the common symetric case | ||
58 | bank_fill[0] == bank_fill[*], thus addresses may be computed | ||
59 | mathmatically. bank_fill must be powers of two */ | ||
60 | unsigned is_banked; | ||
61 | unsigned long bank_fill[MAX_JEDEC_CHIPS]; | ||
62 | |||
63 | struct jedec_flash_chip chips[MAX_JEDEC_CHIPS]; | ||
64 | }; | ||
65 | |||
66 | #endif | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 0a13bb35f044..245f9098e171 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -143,10 +143,12 @@ struct mtd_info { | |||
143 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); | 143 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); |
144 | 144 | ||
145 | /* This stuff for eXecute-In-Place */ | 145 | /* This stuff for eXecute-In-Place */ |
146 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); | 146 | /* phys is optional and may be set to NULL */ |
147 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, | ||
148 | size_t *retlen, void **virt, resource_size_t *phys); | ||
147 | 149 | ||
148 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | 150 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ |
149 | void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); | 151 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
150 | 152 | ||
151 | 153 | ||
152 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 154 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h index a7f6d20ad407..5cc070c24d88 100644 --- a/include/linux/mtd/pmc551.h +++ b/include/linux/mtd/pmc551.h | |||
@@ -36,8 +36,9 @@ struct mypriv { | |||
36 | * Function Prototypes | 36 | * Function Prototypes |
37 | */ | 37 | */ |
38 | static int pmc551_erase(struct mtd_info *, struct erase_info *); | 38 | static int pmc551_erase(struct mtd_info *, struct erase_info *); |
39 | static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); | 39 | static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); |
40 | static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); | 40 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, |
41 | size_t *retlen, void **virt, resource_size_t *phys); | ||
41 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 42 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
42 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 43 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
43 | 44 | ||
diff --git a/include/linux/nbd.h b/include/linux/nbd.h index 986572081e19..155719dab813 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h | |||
@@ -56,9 +56,11 @@ struct nbd_device { | |||
56 | int magic; | 56 | int magic; |
57 | 57 | ||
58 | spinlock_t queue_lock; | 58 | spinlock_t queue_lock; |
59 | struct list_head queue_head;/* Requests are added here... */ | 59 | struct list_head queue_head; /* Requests waiting result */ |
60 | struct request *active_req; | 60 | struct request *active_req; |
61 | wait_queue_head_t active_wq; | 61 | wait_queue_head_t active_wq; |
62 | struct list_head waiting_queue; /* Requests to be sent */ | ||
63 | wait_queue_head_t waiting_wq; | ||
62 | 64 | ||
63 | struct mutex tx_lock; | 65 | struct mutex tx_lock; |
64 | struct gendisk *disk; | 66 | struct gendisk *disk; |
@@ -86,11 +88,7 @@ struct nbd_request { | |||
86 | char handle[8]; | 88 | char handle[8]; |
87 | __be64 from; | 89 | __be64 from; |
88 | __be32 len; | 90 | __be32 len; |
89 | } | 91 | } __attribute__ ((packed)); |
90 | #ifdef __GNUC__ | ||
91 | __attribute__ ((packed)) | ||
92 | #endif | ||
93 | ; | ||
94 | 92 | ||
95 | /* | 93 | /* |
96 | * This is the reply packet that nbd-server sends back to the client after | 94 | * This is the reply packet that nbd-server sends back to the client after |
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 */ |
205 | extern const struct inode_operations ncp_dir_inode_operations; | 205 | extern const struct inode_operations ncp_dir_inode_operations; |
206 | extern const struct file_operations ncp_dir_operations; | 206 | extern const struct file_operations ncp_dir_operations; |
207 | extern struct dentry_operations ncp_root_dentry_operations; | ||
207 | int ncp_conn_logged_in(struct super_block *); | 208 | int ncp_conn_logged_in(struct super_block *); |
208 | int ncp_date_dos2unix(__le16 time, __le16 date); | 209 | int ncp_date_dos2unix(__le16 time, __le16 date); |
209 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); | 210 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); |
@@ -223,6 +224,12 @@ int ncp_disconnect(struct ncp_server *server); | |||
223 | void ncp_lock_server(struct ncp_server *server); | 224 | void ncp_lock_server(struct ncp_server *server); |
224 | void ncp_unlock_server(struct ncp_server *server); | 225 | void 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) | ||
229 | extern const struct address_space_operations ncp_symlink_aops; | ||
230 | int ncp_symlink(struct inode*, struct dentry*, const char*); | ||
231 | #endif | ||
232 | |||
226 | /* linux/fs/ncpfs/file.c */ | 233 | /* linux/fs/ncpfs/file.c */ |
227 | extern const struct inode_operations ncp_file_inode_operations; | 234 | extern const struct inode_operations ncp_file_inode_operations; |
228 | extern const struct file_operations ncp_file_operations; | 235 | extern const struct file_operations ncp_file_operations; |
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h index bdb4c8ae6924..4b0bec477846 100644 --- a/include/linux/ncp_fs_i.h +++ b/include/linux/ncp_fs_i.h | |||
@@ -8,8 +8,6 @@ | |||
8 | #ifndef _LINUX_NCP_FS_I | 8 | #ifndef _LINUX_NCP_FS_I |
9 | #define _LINUX_NCP_FS_I | 9 | #define _LINUX_NCP_FS_I |
10 | 10 | ||
11 | #ifdef __KERNEL__ | ||
12 | |||
13 | /* | 11 | /* |
14 | * This is the ncpfs part of the inode structure. This must contain | 12 | * This is the ncpfs part of the inode structure. This must contain |
15 | * all the information we need to work with an inode after creation. | 13 | * all the information we need to work with an inode after creation. |
@@ -28,6 +26,4 @@ struct ncp_inode_info { | |||
28 | struct inode vfs_inode; | 26 | struct inode vfs_inode; |
29 | }; | 27 | }; |
30 | 28 | ||
31 | #endif /* __KERNEL__ */ | ||
32 | |||
33 | #endif /* _LINUX_NCP_FS_I */ | 29 | #endif /* _LINUX_NCP_FS_I */ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index fb0713b6ffaf..bec1062a25a1 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -166,6 +166,7 @@ struct netlink_skb_parms | |||
166 | __u32 dst_group; | 166 | __u32 dst_group; |
167 | kernel_cap_t eff_cap; | 167 | kernel_cap_t eff_cap; |
168 | __u32 loginuid; /* Login (audit) uid */ | 168 | __u32 loginuid; /* Login (audit) uid */ |
169 | __u32 sessionid; /* Session id (audit) */ | ||
169 | __u32 sid; /* SELinux security id */ | 170 | __u32 sid; /* SELinux security id */ |
170 | }; | 171 | }; |
171 | 172 | ||
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) | ||
335 | static 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) | ||
343 | static 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..0ff6224d172a 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
@@ -121,6 +121,10 @@ extern int raw_notifier_chain_register(struct raw_notifier_head *nh, | |||
121 | extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, | 121 | extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, |
122 | struct notifier_block *nb); | 122 | struct notifier_block *nb); |
123 | 123 | ||
124 | extern int blocking_notifier_chain_cond_register( | ||
125 | struct blocking_notifier_head *nh, | ||
126 | struct notifier_block *nb); | ||
127 | |||
124 | extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, | 128 | extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, |
125 | struct notifier_block *nb); | 129 | struct notifier_block *nb); |
126 | extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, | 130 | extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, |
@@ -247,6 +251,7 @@ extern struct blocking_notifier_head reboot_notifier_list; | |||
247 | #define VT_DEALLOCATE 0x0002 /* Console will be deallocated */ | 251 | #define VT_DEALLOCATE 0x0002 /* Console will be deallocated */ |
248 | #define VT_WRITE 0x0003 /* A char got output */ | 252 | #define VT_WRITE 0x0003 /* A char got output */ |
249 | #define VT_UPDATE 0x0004 /* A bigger update occurred */ | 253 | #define VT_UPDATE 0x0004 /* A bigger update occurred */ |
254 | #define VT_PREWRITE 0x0005 /* A char is about to be written to the console */ | ||
250 | 255 | ||
251 | #endif /* __KERNEL__ */ | 256 | #endif /* __KERNEL__ */ |
252 | #endif /* _LINUX_NOTIFIER_H */ | 257 | #endif /* _LINUX_NOTIFIER_H */ |
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 6dc11959770c..afe338217d91 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #ifndef _LINUX_OF_DEVICE_H | 1 | #ifndef _LINUX_OF_DEVICE_H |
2 | #define _LINUX_OF_DEVICE_H | 2 | #define _LINUX_OF_DEVICE_H |
3 | #ifdef __KERNEL__ | ||
4 | 3 | ||
5 | #include <linux/device.h> | 4 | #include <linux/device.h> |
6 | #include <linux/of.h> | 5 | #include <linux/of.h> |
@@ -25,5 +24,4 @@ static inline void of_device_free(struct of_device *dev) | |||
25 | of_release_dev(&dev->dev); | 24 | of_release_dev(&dev->dev); |
26 | } | 25 | } |
27 | 26 | ||
28 | #endif /* __KERNEL__ */ | ||
29 | #endif /* _LINUX_OF_DEVICE_H */ | 27 | #endif /* _LINUX_OF_DEVICE_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 | ||
26 | extern int try_set_zone_oom(struct zonelist *zonelist); | 26 | extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
27 | extern void clear_zonelist_oom(struct zonelist *zonelist); | 27 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
28 | 28 | ||
29 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); | 29 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); |
30 | extern int register_oom_notifier(struct notifier_block *nb); | 30 | extern 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. */ | 72 | enum 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) \ | ||
108 | static 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 | 112 | static 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 | 116 | static 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 */ | 120 | static 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 */ | 124 | static 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) \ | ||
128 | static inline int TestSetPage##uname(struct page *page) \ | ||
129 | { return test_and_set_bit(PG_##lname, &page->flags); } | ||
130 | |||
131 | #define TESTCLEARFLAG(uname, lname) \ | ||
132 | static 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) \ | ||
143 | static inline int Page##uname(struct page *page) \ | ||
144 | { return 0; } | ||
145 | |||
146 | #define TESTSCFLAG(uname, lname) \ | ||
147 | TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) | ||
148 | |||
149 | struct page; /* forward declaration */ | ||
150 | |||
151 | PAGEFLAG(Locked, locked) TESTSCFLAG(Locked, locked) | ||
152 | PAGEFLAG(Error, error) | ||
153 | PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) | ||
154 | PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) | ||
155 | PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) | ||
156 | PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) | ||
157 | __PAGEFLAG(Slab, slab) | ||
158 | PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */ | ||
159 | PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */ | ||
160 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) | ||
161 | PAGEFLAG(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 */ | 168 | TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback) |
109 | #endif | 169 | __PAGEFLAG(Buddy, buddy) |
170 | PAGEFLAG(MappedToDisk, mappedtodisk) | ||
110 | 171 | ||
172 | /* PG_readahead is only used for file reads; PG_reclaim is only for writes */ | ||
173 | PAGEFLAG(Reclaim, reclaim) TESTCLEARFLAG(Reclaim, reclaim) | ||
174 | PAGEFLAG(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) \ | 183 | PAGEFLAG_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) \ | 187 | PAGEFLAG(SwapCache, swapcache) |
121 | clear_bit(PG_locked, &(page)->flags) | 188 | #else |
122 | #define TestClearPageLocked(page) \ | 189 | PAGEFLAG_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) | 193 | PAGEFLAG(Uncached, uncached) |
127 | #define ClearPageError(page) clear_bit(PG_error, &(page)->flags) | 194 | #else |
128 | 195 | PAGEFLAG_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 | ||
134 | static inline int PageUptodate(struct page *page) | 198 | static 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) | 244 | CLEARPAGEFLAG(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) | 246 | extern 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) | 248 | int test_clear_page_writeback(struct page *page); |
218 | #define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags) | 249 | int 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) | 251 | static 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) | 266 | static 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 | */ | ||
278 | TESTPAGEFLAG(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) \ | 293 | static 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 | ||
272 | static inline void __SetPageTail(struct page *page) | 298 | static 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 | |||
299 | struct page; /* forward declaration */ | ||
300 | |||
301 | extern void cancel_dirty_page(struct page *page, unsigned int account_size); | ||
302 | |||
303 | int test_clear_page_writeback(struct page *page); | ||
304 | int test_set_page_writeback(struct page *page); | ||
305 | |||
306 | static 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/pci.h b/include/linux/pci.h index 292491324b01..96acd0dae241 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -20,8 +20,6 @@ | |||
20 | /* Include the pci register defines */ | 20 | /* Include the pci register defines */ |
21 | #include <linux/pci_regs.h> | 21 | #include <linux/pci_regs.h> |
22 | 22 | ||
23 | struct pci_vpd; | ||
24 | |||
25 | /* | 23 | /* |
26 | * The PCI interface treats multi-function devices as independent | 24 | * The PCI interface treats multi-function devices as independent |
27 | * devices. The slot/function address of each device is encoded | 25 | * devices. The slot/function address of each device is encoded |
@@ -131,6 +129,8 @@ struct pci_cap_saved_state { | |||
131 | }; | 129 | }; |
132 | 130 | ||
133 | struct pcie_link_state; | 131 | struct pcie_link_state; |
132 | struct pci_vpd; | ||
133 | |||
134 | /* | 134 | /* |
135 | * The pci_dev structure is used to describe PCI devices. | 135 | * The pci_dev structure is used to describe PCI devices. |
136 | */ | 136 | */ |
@@ -254,7 +254,7 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev, | |||
254 | #define PCI_NUM_RESOURCES 11 | 254 | #define PCI_NUM_RESOURCES 11 |
255 | 255 | ||
256 | #ifndef PCI_BUS_NUM_RESOURCES | 256 | #ifndef PCI_BUS_NUM_RESOURCES |
257 | #define PCI_BUS_NUM_RESOURCES 8 | 257 | #define PCI_BUS_NUM_RESOURCES 16 |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ | 260 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ |
@@ -666,6 +666,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
666 | 666 | ||
667 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), | 667 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), |
668 | void *userdata); | 668 | void *userdata); |
669 | int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix); | ||
669 | int pci_cfg_space_size(struct pci_dev *dev); | 670 | int pci_cfg_space_size(struct pci_dev *dev); |
670 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); | 671 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); |
671 | 672 | ||
@@ -701,6 +702,8 @@ static inline int pci_enable_msi(struct pci_dev *dev) | |||
701 | return -1; | 702 | return -1; |
702 | } | 703 | } |
703 | 704 | ||
705 | static inline void pci_msi_shutdown(struct pci_dev *dev) | ||
706 | { } | ||
704 | static inline void pci_disable_msi(struct pci_dev *dev) | 707 | static inline void pci_disable_msi(struct pci_dev *dev) |
705 | { } | 708 | { } |
706 | 709 | ||
@@ -710,6 +713,8 @@ static inline int pci_enable_msix(struct pci_dev *dev, | |||
710 | return -1; | 713 | return -1; |
711 | } | 714 | } |
712 | 715 | ||
716 | static inline void pci_msix_shutdown(struct pci_dev *dev) | ||
717 | { } | ||
713 | static inline void pci_disable_msix(struct pci_dev *dev) | 718 | static inline void pci_disable_msix(struct pci_dev *dev) |
714 | { } | 719 | { } |
715 | 720 | ||
@@ -720,9 +725,11 @@ static inline void pci_restore_msi_state(struct pci_dev *dev) | |||
720 | { } | 725 | { } |
721 | #else | 726 | #else |
722 | extern int pci_enable_msi(struct pci_dev *dev); | 727 | extern int pci_enable_msi(struct pci_dev *dev); |
728 | extern void pci_msi_shutdown(struct pci_dev *dev); | ||
723 | extern void pci_disable_msi(struct pci_dev *dev); | 729 | extern void pci_disable_msi(struct pci_dev *dev); |
724 | extern int pci_enable_msix(struct pci_dev *dev, | 730 | extern int pci_enable_msix(struct pci_dev *dev, |
725 | struct msix_entry *entries, int nvec); | 731 | struct msix_entry *entries, int nvec); |
732 | extern void pci_msix_shutdown(struct pci_dev *dev); | ||
726 | extern void pci_disable_msix(struct pci_dev *dev); | 733 | extern void pci_disable_msix(struct pci_dev *dev); |
727 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); | 734 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); |
728 | extern void pci_restore_msi_state(struct pci_dev *dev); | 735 | extern void pci_restore_msi_state(struct pci_dev *dev); |
@@ -1053,5 +1060,13 @@ extern unsigned long pci_cardbus_mem_size; | |||
1053 | 1060 | ||
1054 | extern int pcibios_add_platform_entries(struct pci_dev *dev); | 1061 | extern int pcibios_add_platform_entries(struct pci_dev *dev); |
1055 | 1062 | ||
1063 | #ifdef CONFIG_PCI_MMCONFIG | ||
1064 | extern void __init pci_mmcfg_early_init(void); | ||
1065 | extern void __init pci_mmcfg_late_init(void); | ||
1066 | #else | ||
1067 | static inline void pci_mmcfg_early_init(void) { } | ||
1068 | static inline void pci_mmcfg_late_init(void) { } | ||
1069 | #endif | ||
1070 | |||
1056 | #endif /* __KERNEL__ */ | 1071 | #endif /* __KERNEL__ */ |
1057 | #endif /* LINUX_PCI_H */ | 1072 | #endif /* LINUX_PCI_H */ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 70eb3c803d47..cf6dbd759395 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1429,6 +1429,7 @@ | |||
1429 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 | 1429 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 |
1430 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA | 1430 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA |
1431 | #define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB | 1431 | #define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB |
1432 | #define PCIE_DEVICE_ID_NEO_4_IBM 0x00F4 | ||
1432 | 1433 | ||
1433 | #define PCI_VENDOR_ID_XIRCOM 0x115d | 1434 | #define PCI_VENDOR_ID_XIRCOM 0x115d |
1434 | #define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 | 1435 | #define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 |
@@ -2413,6 +2414,8 @@ | |||
2413 | #define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 | 2414 | #define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 |
2414 | #define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2 | 2415 | #define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2 |
2415 | #define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 | 2416 | #define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 |
2417 | #define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 | ||
2418 | #define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a | ||
2416 | #define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 | 2419 | #define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 |
2417 | #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 | 2420 | #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 |
2418 | #define PCI_DEVICE_ID_INTEL_82451NX 0x84ca | 2421 | #define PCI_DEVICE_ID_INTEL_82451NX 0x84ca |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 1ac969724bb2..d746a2abb322 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <linux/preempt.h> | 4 | #include <linux/preempt.h> |
5 | #include <linux/slab.h> /* For kmalloc() */ | 5 | #include <linux/slab.h> /* For kmalloc() */ |
6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
7 | #include <linux/string.h> /* For memset() */ | ||
8 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
9 | 8 | ||
10 | #include <asm/percpu.h> | 9 | #include <asm/percpu.h> |
diff --git a/include/linux/personality.h b/include/linux/personality.h index 012cd558189b..a84e9ff9b27e 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h | |||
@@ -105,10 +105,6 @@ struct exec_domain { | |||
105 | */ | 105 | */ |
106 | #define personality(pers) (pers & PER_MASK) | 106 | #define personality(pers) (pers & PER_MASK) |
107 | 107 | ||
108 | /* | ||
109 | * Personality of the currently running process. | ||
110 | */ | ||
111 | #define get_personality (current->personality) | ||
112 | 108 | ||
113 | /* | 109 | /* |
114 | * Change personality of the currently running process. | 110 | * Change personality of the currently running process. |
diff --git a/include/linux/phantom.h b/include/linux/phantom.h index 96f4048a6cc3..02268c54c250 100644 --- a/include/linux/phantom.h +++ b/include/linux/phantom.h | |||
@@ -27,14 +27,17 @@ struct phm_regs { | |||
27 | 27 | ||
28 | #define PH_IOC_MAGIC 'p' | 28 | #define PH_IOC_MAGIC 'p' |
29 | #define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) | 29 | #define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) |
30 | #define PHN_SET_REG _IOW (PH_IOC_MAGIC, 1, struct phm_reg *) | 30 | #define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *) |
31 | #define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) | 31 | #define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) |
32 | #define PHN_SET_REGS _IOW (PH_IOC_MAGIC, 3, struct phm_regs *) | 32 | #define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *) |
33 | /* this ioctl tells the driver, that the caller is not OpenHaptics and might | 33 | /* this ioctl tells the driver, that the caller is not OpenHaptics and might |
34 | * use improved registers update (no more phantom switchoffs when using | 34 | * use improved registers update (no more phantom switchoffs when using |
35 | * libphantom) */ | 35 | * libphantom) */ |
36 | #define PHN_NOT_OH _IO (PH_IOC_MAGIC, 4) | 36 | #define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4) |
37 | #define PH_IOC_MAXNR 4 | 37 | #define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg) |
38 | #define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg) | ||
39 | #define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs) | ||
40 | #define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs) | ||
38 | 41 | ||
39 | #define PHN_CONTROL 0x6 /* control byte in iaddr space */ | 42 | #define PHN_CONTROL 0x6 /* control byte in iaddr space */ |
40 | #define PHN_CTL_AMP 0x1 /* switch after torques change */ | 43 | #define PHN_CTL_AMP 0x1 /* switch after torques change */ |
diff --git a/include/linux/pid.h b/include/linux/pid.h index c7980810eb09..c21c7e8124a7 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
@@ -60,7 +60,7 @@ struct pid | |||
60 | /* lists of tasks that use this pid */ | 60 | /* lists of tasks that use this pid */ |
61 | struct hlist_head tasks[PIDTYPE_MAX]; | 61 | struct hlist_head tasks[PIDTYPE_MAX]; |
62 | struct rcu_head rcu; | 62 | struct rcu_head rcu; |
63 | int level; | 63 | unsigned int level; |
64 | struct upid numbers[1]; | 64 | struct upid numbers[1]; |
65 | }; | 65 | }; |
66 | 66 | ||
@@ -89,9 +89,11 @@ extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); | |||
89 | * attach_pid() and detach_pid() must be called with the tasklist_lock | 89 | * attach_pid() and detach_pid() must be called with the tasklist_lock |
90 | * write-held. | 90 | * write-held. |
91 | */ | 91 | */ |
92 | extern int attach_pid(struct task_struct *task, enum pid_type type, | 92 | extern void attach_pid(struct task_struct *task, enum pid_type type, |
93 | struct pid *pid); | 93 | struct pid *pid); |
94 | extern void detach_pid(struct task_struct *task, enum pid_type); | 94 | extern void detach_pid(struct task_struct *task, enum pid_type); |
95 | extern void change_pid(struct task_struct *task, enum pid_type, | ||
96 | struct pid *pid); | ||
95 | extern void transfer_pid(struct task_struct *old, struct task_struct *new, | 97 | extern void transfer_pid(struct task_struct *old, struct task_struct *new, |
96 | enum pid_type); | 98 | enum pid_type); |
97 | 99 | ||
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index fcd61fa2c833..caff5283d15c 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
@@ -20,7 +20,7 @@ struct pid_namespace { | |||
20 | int last_pid; | 20 | int last_pid; |
21 | struct task_struct *child_reaper; | 21 | struct task_struct *child_reaper; |
22 | struct kmem_cache *pid_cachep; | 22 | struct kmem_cache *pid_cachep; |
23 | int level; | 23 | unsigned int level; |
24 | struct pid_namespace *parent; | 24 | struct pid_namespace *parent; |
25 | #ifdef CONFIG_PROC_FS | 25 | #ifdef CONFIG_PROC_FS |
26 | struct vfsmount *proc_mnt; | 26 | struct vfsmount *proc_mnt; |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 1de72cbbe0d1..39a7ee859b67 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -21,8 +21,6 @@ | |||
21 | #ifndef _LINUX_PM_H | 21 | #ifndef _LINUX_PM_H |
22 | #define _LINUX_PM_H | 22 | #define _LINUX_PM_H |
23 | 23 | ||
24 | #ifdef __KERNEL__ | ||
25 | |||
26 | #include <linux/list.h> | 24 | #include <linux/list.h> |
27 | #include <asm/atomic.h> | 25 | #include <asm/atomic.h> |
28 | #include <asm/errno.h> | 26 | #include <asm/errno.h> |
@@ -225,6 +223,4 @@ extern unsigned int pm_flags; | |||
225 | #define PM_APM 1 | 223 | #define PM_APM 1 |
226 | #define PM_ACPI 2 | 224 | #define PM_ACPI 2 |
227 | 225 | ||
228 | #endif /* __KERNEL__ */ | ||
229 | |||
230 | #endif /* _LINUX_PM_H */ | 226 | #endif /* _LINUX_PM_H */ |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index b2f05c230f4b..63b128d512fb 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -6,66 +6,127 @@ | |||
6 | #ifndef _LINUX_PNP_H | 6 | #ifndef _LINUX_PNP_H |
7 | #define _LINUX_PNP_H | 7 | #define _LINUX_PNP_H |
8 | 8 | ||
9 | #ifdef __KERNEL__ | ||
10 | |||
11 | #include <linux/device.h> | 9 | #include <linux/device.h> |
12 | #include <linux/list.h> | 10 | #include <linux/list.h> |
13 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
14 | #include <linux/mod_devicetable.h> | 12 | #include <linux/mod_devicetable.h> |
15 | 13 | ||
16 | #define PNP_MAX_PORT 40 | ||
17 | #define PNP_MAX_MEM 24 | ||
18 | #define PNP_MAX_IRQ 2 | ||
19 | #define PNP_MAX_DMA 2 | ||
20 | #define PNP_NAME_LEN 50 | 14 | #define PNP_NAME_LEN 50 |
21 | 15 | ||
22 | struct pnp_protocol; | 16 | struct pnp_protocol; |
23 | struct pnp_dev; | 17 | struct pnp_dev; |
18 | struct pnp_resource_table; | ||
24 | 19 | ||
25 | /* | 20 | /* |
26 | * Resource Management | 21 | * Resource Management |
27 | */ | 22 | */ |
23 | struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); | ||
24 | |||
25 | static inline int pnp_resource_valid(struct resource *res) | ||
26 | { | ||
27 | if (res && !(res->flags & IORESOURCE_UNSET)) | ||
28 | return 1; | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static inline resource_size_t pnp_resource_len(struct resource *res) | ||
33 | { | ||
34 | if (res->start == 0 && res->end == 0) | ||
35 | return 0; | ||
36 | return res->end - res->start + 1; | ||
37 | } | ||
38 | |||
39 | |||
40 | static inline resource_size_t pnp_port_start(struct pnp_dev *dev, | ||
41 | unsigned int bar) | ||
42 | { | ||
43 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->start; | ||
44 | } | ||
45 | |||
46 | static inline resource_size_t pnp_port_end(struct pnp_dev *dev, | ||
47 | unsigned int bar) | ||
48 | { | ||
49 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->end; | ||
50 | } | ||
51 | |||
52 | static inline unsigned long pnp_port_flags(struct pnp_dev *dev, | ||
53 | unsigned int bar) | ||
54 | { | ||
55 | return pnp_get_resource(dev, IORESOURCE_IO, bar)->flags; | ||
56 | } | ||
57 | |||
58 | static inline int pnp_port_valid(struct pnp_dev *dev, unsigned int bar) | ||
59 | { | ||
60 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_IO, bar)); | ||
61 | } | ||
62 | |||
63 | static inline resource_size_t pnp_port_len(struct pnp_dev *dev, | ||
64 | unsigned int bar) | ||
65 | { | ||
66 | return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_IO, bar)); | ||
67 | } | ||
68 | |||
69 | |||
70 | static inline resource_size_t pnp_mem_start(struct pnp_dev *dev, | ||
71 | unsigned int bar) | ||
72 | { | ||
73 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->start; | ||
74 | } | ||
75 | |||
76 | static inline resource_size_t pnp_mem_end(struct pnp_dev *dev, | ||
77 | unsigned int bar) | ||
78 | { | ||
79 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->end; | ||
80 | } | ||
81 | |||
82 | static inline unsigned long pnp_mem_flags(struct pnp_dev *dev, unsigned int bar) | ||
83 | { | ||
84 | return pnp_get_resource(dev, IORESOURCE_MEM, bar)->flags; | ||
85 | } | ||
86 | |||
87 | static inline int pnp_mem_valid(struct pnp_dev *dev, unsigned int bar) | ||
88 | { | ||
89 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_MEM, bar)); | ||
90 | } | ||
91 | |||
92 | static inline resource_size_t pnp_mem_len(struct pnp_dev *dev, | ||
93 | unsigned int bar) | ||
94 | { | ||
95 | return pnp_resource_len(pnp_get_resource(dev, IORESOURCE_MEM, bar)); | ||
96 | } | ||
97 | |||
98 | |||
99 | static inline resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar) | ||
100 | { | ||
101 | return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->start; | ||
102 | } | ||
103 | |||
104 | static inline unsigned long pnp_irq_flags(struct pnp_dev *dev, unsigned int bar) | ||
105 | { | ||
106 | return pnp_get_resource(dev, IORESOURCE_IRQ, bar)->flags; | ||
107 | } | ||
108 | |||
109 | static inline int pnp_irq_valid(struct pnp_dev *dev, unsigned int bar) | ||
110 | { | ||
111 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_IRQ, bar)); | ||
112 | } | ||
113 | |||
114 | |||
115 | static inline resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar) | ||
116 | { | ||
117 | return pnp_get_resource(dev, IORESOURCE_DMA, bar)->start; | ||
118 | } | ||
119 | |||
120 | static inline unsigned long pnp_dma_flags(struct pnp_dev *dev, unsigned int bar) | ||
121 | { | ||
122 | return pnp_get_resource(dev, IORESOURCE_DMA, bar)->flags; | ||
123 | } | ||
124 | |||
125 | static inline int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar) | ||
126 | { | ||
127 | return pnp_resource_valid(pnp_get_resource(dev, IORESOURCE_DMA, bar)); | ||
128 | } | ||
28 | 129 | ||
29 | /* Use these instead of directly reading pnp_dev to get resource information */ | ||
30 | #define pnp_port_start(dev,bar) ((dev)->res.port_resource[(bar)].start) | ||
31 | #define pnp_port_end(dev,bar) ((dev)->res.port_resource[(bar)].end) | ||
32 | #define pnp_port_flags(dev,bar) ((dev)->res.port_resource[(bar)].flags) | ||
33 | #define pnp_port_valid(dev,bar) \ | ||
34 | ((pnp_port_flags((dev),(bar)) & (IORESOURCE_IO | IORESOURCE_UNSET)) \ | ||
35 | == IORESOURCE_IO) | ||
36 | #define pnp_port_len(dev,bar) \ | ||
37 | ((pnp_port_start((dev),(bar)) == 0 && \ | ||
38 | pnp_port_end((dev),(bar)) == \ | ||
39 | pnp_port_start((dev),(bar))) ? 0 : \ | ||
40 | \ | ||
41 | (pnp_port_end((dev),(bar)) - \ | ||
42 | pnp_port_start((dev),(bar)) + 1)) | ||
43 | |||
44 | #define pnp_mem_start(dev,bar) ((dev)->res.mem_resource[(bar)].start) | ||
45 | #define pnp_mem_end(dev,bar) ((dev)->res.mem_resource[(bar)].end) | ||
46 | #define pnp_mem_flags(dev,bar) ((dev)->res.mem_resource[(bar)].flags) | ||
47 | #define pnp_mem_valid(dev,bar) \ | ||
48 | ((pnp_mem_flags((dev),(bar)) & (IORESOURCE_MEM | IORESOURCE_UNSET)) \ | ||
49 | == IORESOURCE_MEM) | ||
50 | #define pnp_mem_len(dev,bar) \ | ||
51 | ((pnp_mem_start((dev),(bar)) == 0 && \ | ||
52 | pnp_mem_end((dev),(bar)) == \ | ||
53 | pnp_mem_start((dev),(bar))) ? 0 : \ | ||
54 | \ | ||
55 | (pnp_mem_end((dev),(bar)) - \ | ||
56 | pnp_mem_start((dev),(bar)) + 1)) | ||
57 | |||
58 | #define pnp_irq(dev,bar) ((dev)->res.irq_resource[(bar)].start) | ||
59 | #define pnp_irq_flags(dev,bar) ((dev)->res.irq_resource[(bar)].flags) | ||
60 | #define pnp_irq_valid(dev,bar) \ | ||
61 | ((pnp_irq_flags((dev),(bar)) & (IORESOURCE_IRQ | IORESOURCE_UNSET)) \ | ||
62 | == IORESOURCE_IRQ) | ||
63 | |||
64 | #define pnp_dma(dev,bar) ((dev)->res.dma_resource[(bar)].start) | ||
65 | #define pnp_dma_flags(dev,bar) ((dev)->res.dma_resource[(bar)].flags) | ||
66 | #define pnp_dma_valid(dev,bar) \ | ||
67 | ((pnp_dma_flags((dev),(bar)) & (IORESOURCE_DMA | IORESOURCE_UNSET)) \ | ||
68 | == IORESOURCE_DMA) | ||
69 | 130 | ||
70 | #define PNP_PORT_FLAG_16BITADDR (1<<0) | 131 | #define PNP_PORT_FLAG_16BITADDR (1<<0) |
71 | #define PNP_PORT_FLAG_FIXED (1<<1) | 132 | #define PNP_PORT_FLAG_FIXED (1<<1) |
@@ -118,13 +179,6 @@ struct pnp_option { | |||
118 | struct pnp_option *next; /* used to chain dependent resources */ | 179 | struct pnp_option *next; /* used to chain dependent resources */ |
119 | }; | 180 | }; |
120 | 181 | ||
121 | struct pnp_resource_table { | ||
122 | struct resource port_resource[PNP_MAX_PORT]; | ||
123 | struct resource mem_resource[PNP_MAX_MEM]; | ||
124 | struct resource dma_resource[PNP_MAX_DMA]; | ||
125 | struct resource irq_resource[PNP_MAX_IRQ]; | ||
126 | }; | ||
127 | |||
128 | /* | 182 | /* |
129 | * Device Management | 183 | * Device Management |
130 | */ | 184 | */ |
@@ -194,10 +248,9 @@ struct pnp_dev { | |||
194 | int capabilities; | 248 | int capabilities; |
195 | struct pnp_option *independent; | 249 | struct pnp_option *independent; |
196 | struct pnp_option *dependent; | 250 | struct pnp_option *dependent; |
197 | struct pnp_resource_table res; | 251 | struct pnp_resource_table *res; |
198 | 252 | ||
199 | char name[PNP_NAME_LEN]; /* contains a human-readable name */ | 253 | char name[PNP_NAME_LEN]; /* contains a human-readable name */ |
200 | unsigned short regs; /* ISAPnP: supported registers */ | ||
201 | int flags; /* used by protocols */ | 254 | int flags; /* used by protocols */ |
202 | struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ | 255 | struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ |
203 | void *data; | 256 | void *data; |
@@ -328,8 +381,8 @@ struct pnp_protocol { | |||
328 | char *name; | 381 | char *name; |
329 | 382 | ||
330 | /* resource control functions */ | 383 | /* resource control functions */ |
331 | int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res); | 384 | int (*get) (struct pnp_dev *dev); |
332 | int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res); | 385 | int (*set) (struct pnp_dev *dev); |
333 | int (*disable) (struct pnp_dev *dev); | 386 | int (*disable) (struct pnp_dev *dev); |
334 | 387 | ||
335 | /* protocol specific suspend/resume */ | 388 | /* protocol specific suspend/resume */ |
@@ -358,20 +411,12 @@ extern struct bus_type pnp_bus_type; | |||
358 | #if defined(CONFIG_PNP) | 411 | #if defined(CONFIG_PNP) |
359 | 412 | ||
360 | /* device management */ | 413 | /* device management */ |
361 | int pnp_register_protocol(struct pnp_protocol *protocol); | ||
362 | void pnp_unregister_protocol(struct pnp_protocol *protocol); | ||
363 | int pnp_add_device(struct pnp_dev *dev); | ||
364 | int pnp_device_attach(struct pnp_dev *pnp_dev); | 414 | int pnp_device_attach(struct pnp_dev *pnp_dev); |
365 | void pnp_device_detach(struct pnp_dev *pnp_dev); | 415 | void pnp_device_detach(struct pnp_dev *pnp_dev); |
366 | extern struct list_head pnp_global; | 416 | extern struct list_head pnp_global; |
367 | extern int pnp_platform_devices; | 417 | extern int pnp_platform_devices; |
368 | 418 | ||
369 | /* multidevice card support */ | 419 | /* multidevice card support */ |
370 | int pnp_add_card(struct pnp_card *card); | ||
371 | void pnp_remove_card(struct pnp_card *card); | ||
372 | int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); | ||
373 | void pnp_remove_card_device(struct pnp_dev *dev); | ||
374 | int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card); | ||
375 | struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, | 420 | struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, |
376 | const char *id, struct pnp_dev *from); | 421 | const char *id, struct pnp_dev *from); |
377 | void pnp_release_card_device(struct pnp_dev *dev); | 422 | void pnp_release_card_device(struct pnp_dev *dev); |
@@ -380,77 +425,42 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv); | |||
380 | extern struct list_head pnp_cards; | 425 | extern struct list_head pnp_cards; |
381 | 426 | ||
382 | /* resource management */ | 427 | /* resource management */ |
383 | struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev); | ||
384 | struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, | ||
385 | int priority); | ||
386 | int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data); | ||
387 | int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data); | ||
388 | int pnp_register_port_resource(struct pnp_option *option, | ||
389 | struct pnp_port *data); | ||
390 | int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data); | ||
391 | void pnp_init_resource_table(struct pnp_resource_table *table); | ||
392 | int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, | ||
393 | int mode); | ||
394 | int pnp_auto_config_dev(struct pnp_dev *dev); | 428 | int pnp_auto_config_dev(struct pnp_dev *dev); |
395 | int pnp_validate_config(struct pnp_dev *dev); | ||
396 | int pnp_start_dev(struct pnp_dev *dev); | 429 | int pnp_start_dev(struct pnp_dev *dev); |
397 | int pnp_stop_dev(struct pnp_dev *dev); | 430 | int pnp_stop_dev(struct pnp_dev *dev); |
398 | int pnp_activate_dev(struct pnp_dev *dev); | 431 | int pnp_activate_dev(struct pnp_dev *dev); |
399 | int pnp_disable_dev(struct pnp_dev *dev); | 432 | int pnp_disable_dev(struct pnp_dev *dev); |
400 | void pnp_resource_change(struct resource *resource, resource_size_t start, | ||
401 | resource_size_t size); | ||
402 | 433 | ||
403 | /* protocol helpers */ | 434 | /* protocol helpers */ |
404 | int pnp_is_active(struct pnp_dev *dev); | 435 | int pnp_is_active(struct pnp_dev *dev); |
405 | int compare_pnp_id(struct pnp_id *pos, const char *id); | 436 | int compare_pnp_id(struct pnp_id *pos, const char *id); |
406 | int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev); | ||
407 | int pnp_register_driver(struct pnp_driver *drv); | 437 | int pnp_register_driver(struct pnp_driver *drv); |
408 | void pnp_unregister_driver(struct pnp_driver *drv); | 438 | void pnp_unregister_driver(struct pnp_driver *drv); |
409 | 439 | ||
410 | #else | 440 | #else |
411 | 441 | ||
412 | /* device management */ | 442 | /* device management */ |
413 | static inline int pnp_register_protocol(struct pnp_protocol *protocol) { return -ENODEV; } | ||
414 | static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { } | ||
415 | static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } | ||
416 | static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } | ||
417 | static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } | 443 | static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } |
418 | static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { } | 444 | static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { } |
419 | 445 | ||
420 | #define pnp_platform_devices 0 | 446 | #define pnp_platform_devices 0 |
421 | 447 | ||
422 | /* multidevice card support */ | 448 | /* multidevice card support */ |
423 | static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; } | ||
424 | static inline void pnp_remove_card(struct pnp_card *card) { } | ||
425 | static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; } | ||
426 | static inline void pnp_remove_card_device(struct pnp_dev *dev) { } | ||
427 | static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; } | ||
428 | static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; } | 449 | static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; } |
429 | static inline void pnp_release_card_device(struct pnp_dev *dev) { } | 450 | static inline void pnp_release_card_device(struct pnp_dev *dev) { } |
430 | static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; } | 451 | static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; } |
431 | static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } | 452 | static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } |
432 | 453 | ||
433 | /* resource management */ | 454 | /* resource management */ |
434 | static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; } | ||
435 | static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; } | ||
436 | static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; } | ||
437 | static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; } | ||
438 | static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; } | ||
439 | static inline int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; } | ||
440 | static inline void pnp_init_resource_table(struct pnp_resource_table *table) { } | ||
441 | static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } | ||
442 | static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } | 455 | static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } |
443 | static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } | ||
444 | static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } | 456 | static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } |
445 | static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } | 457 | static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } |
446 | static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } | 458 | static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } |
447 | static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } | 459 | static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } |
448 | static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { } | ||
449 | 460 | ||
450 | /* protocol helpers */ | 461 | /* protocol helpers */ |
451 | static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } | 462 | static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } |
452 | static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; } | 463 | static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; } |
453 | static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; } | ||
454 | static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } | 464 | static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } |
455 | static inline void pnp_unregister_driver(struct pnp_driver *drv) { } | 465 | static inline void pnp_unregister_driver(struct pnp_driver *drv) { } |
456 | 466 | ||
@@ -466,6 +476,4 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { } | |||
466 | #define pnp_dbg(format, arg...) do {} while (0) | 476 | #define pnp_dbg(format, arg...) do {} while (0) |
467 | #endif | 477 | #endif |
468 | 478 | ||
469 | #endif /* __KERNEL__ */ | ||
470 | |||
471 | #endif /* _LINUX_PNP_H */ | 479 | #endif /* _LINUX_PNP_H */ |
diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h deleted file mode 100644 index 329192adc9dd..000000000000 --- a/include/linux/pnpbios.h +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * Include file for the interface to a PnP BIOS | ||
3 | * | ||
4 | * Original BIOS code (C) 1998 Christian Schmidt (chr.schmidt@tu-bs.de) | ||
5 | * PnP handler parts (c) 1998 Tom Lees <tom@lpsg.demon.co.uk> | ||
6 | * Minor reorganizations by David Hinds <dahinds@users.sourceforge.net> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2, or (at your option) any | ||
11 | * later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX_PNPBIOS_H | ||
24 | #define _LINUX_PNPBIOS_H | ||
25 | |||
26 | #ifdef __KERNEL__ | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | #include <linux/pnp.h> | ||
30 | |||
31 | /* | ||
32 | * Return codes | ||
33 | */ | ||
34 | #define PNP_SUCCESS 0x00 | ||
35 | #define PNP_NOT_SET_STATICALLY 0x7f | ||
36 | #define PNP_UNKNOWN_FUNCTION 0x81 | ||
37 | #define PNP_FUNCTION_NOT_SUPPORTED 0x82 | ||
38 | #define PNP_INVALID_HANDLE 0x83 | ||
39 | #define PNP_BAD_PARAMETER 0x84 | ||
40 | #define PNP_SET_FAILED 0x85 | ||
41 | #define PNP_EVENTS_NOT_PENDING 0x86 | ||
42 | #define PNP_SYSTEM_NOT_DOCKED 0x87 | ||
43 | #define PNP_NO_ISA_PNP_CARDS 0x88 | ||
44 | #define PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES 0x89 | ||
45 | #define PNP_CONFIG_CHANGE_FAILED_NO_BATTERY 0x8a | ||
46 | #define PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT 0x8b | ||
47 | #define PNP_BUFFER_TOO_SMALL 0x8c | ||
48 | #define PNP_USE_ESCD_SUPPORT 0x8d | ||
49 | #define PNP_MESSAGE_NOT_SUPPORTED 0x8e | ||
50 | #define PNP_HARDWARE_ERROR 0x8f | ||
51 | |||
52 | #define ESCD_SUCCESS 0x00 | ||
53 | #define ESCD_IO_ERROR_READING 0x55 | ||
54 | #define ESCD_INVALID 0x56 | ||
55 | #define ESCD_BUFFER_TOO_SMALL 0x59 | ||
56 | #define ESCD_NVRAM_TOO_SMALL 0x5a | ||
57 | #define ESCD_FUNCTION_NOT_SUPPORTED 0x81 | ||
58 | |||
59 | /* | ||
60 | * Events that can be received by "get event" | ||
61 | */ | ||
62 | #define PNPEV_ABOUT_TO_CHANGE_CONFIG 0x0001 | ||
63 | #define PNPEV_DOCK_CHANGED 0x0002 | ||
64 | #define PNPEV_SYSTEM_DEVICE_CHANGED 0x0003 | ||
65 | #define PNPEV_CONFIG_CHANGED_FAILED 0x0004 | ||
66 | #define PNPEV_UNKNOWN_SYSTEM_EVENT 0xffff | ||
67 | /* 0x8000 through 0xfffe are OEM defined */ | ||
68 | |||
69 | /* | ||
70 | * Messages that should be sent through "send message" | ||
71 | */ | ||
72 | #define PNPMSG_OK 0x00 | ||
73 | #define PNPMSG_ABORT 0x01 | ||
74 | #define PNPMSG_UNDOCK_DEFAULT_ACTION 0x40 | ||
75 | #define PNPMSG_POWER_OFF 0x41 | ||
76 | #define PNPMSG_PNP_OS_ACTIVE 0x42 | ||
77 | #define PNPMSG_PNP_OS_INACTIVE 0x43 | ||
78 | |||
79 | /* | ||
80 | * Plug and Play BIOS flags | ||
81 | */ | ||
82 | #define PNPBIOS_NO_DISABLE 0x0001 | ||
83 | #define PNPBIOS_NO_CONFIG 0x0002 | ||
84 | #define PNPBIOS_OUTPUT 0x0004 | ||
85 | #define PNPBIOS_INPUT 0x0008 | ||
86 | #define PNPBIOS_BOOTABLE 0x0010 | ||
87 | #define PNPBIOS_DOCK 0x0020 | ||
88 | #define PNPBIOS_REMOVABLE 0x0040 | ||
89 | #define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000) | ||
90 | #define pnpbios_is_dynamic(x) ((x)->flags & 0x0080) | ||
91 | |||
92 | /* | ||
93 | * Function Parameters | ||
94 | */ | ||
95 | #define PNPMODE_STATIC 1 | ||
96 | #define PNPMODE_DYNAMIC 0 | ||
97 | |||
98 | /* 0x8000 through 0xffff are OEM defined */ | ||
99 | |||
100 | #pragma pack(1) | ||
101 | struct pnp_dev_node_info { | ||
102 | __u16 no_nodes; | ||
103 | __u16 max_node_size; | ||
104 | }; | ||
105 | struct pnp_docking_station_info { | ||
106 | __u32 location_id; | ||
107 | __u32 serial; | ||
108 | __u16 capabilities; | ||
109 | }; | ||
110 | struct pnp_isa_config_struc { | ||
111 | __u8 revision; | ||
112 | __u8 no_csns; | ||
113 | __u16 isa_rd_data_port; | ||
114 | __u16 reserved; | ||
115 | }; | ||
116 | struct escd_info_struc { | ||
117 | __u16 min_escd_write_size; | ||
118 | __u16 escd_size; | ||
119 | __u32 nv_storage_base; | ||
120 | }; | ||
121 | struct pnp_bios_node { | ||
122 | __u16 size; | ||
123 | __u8 handle; | ||
124 | __u32 eisa_id; | ||
125 | __u8 type_code[3]; | ||
126 | __u16 flags; | ||
127 | __u8 data[0]; | ||
128 | }; | ||
129 | #pragma pack() | ||
130 | |||
131 | #ifdef CONFIG_PNPBIOS | ||
132 | |||
133 | /* non-exported */ | ||
134 | extern struct pnp_dev_node_info node_info; | ||
135 | |||
136 | extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data); | ||
137 | extern int pnp_bios_get_dev_node(u8 *nodenum, char config, | ||
138 | struct pnp_bios_node *data); | ||
139 | extern int pnp_bios_set_dev_node(u8 nodenum, char config, | ||
140 | struct pnp_bios_node *data); | ||
141 | extern int pnp_bios_get_stat_res(char *info); | ||
142 | extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data); | ||
143 | extern int pnp_bios_escd_info(struct escd_info_struc *data); | ||
144 | extern int pnp_bios_read_escd(char *data, u32 nvram_base); | ||
145 | extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data); | ||
146 | |||
147 | #endif /* CONFIG_PNPBIOS */ | ||
148 | |||
149 | #endif /* __KERNEL__ */ | ||
150 | |||
151 | #endif /* _LINUX_PNPBIOS_H */ | ||
diff --git a/include/linux/poison.h b/include/linux/poison.h index a9c31be7052c..9f31683728fd 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h | |||
@@ -10,6 +10,13 @@ | |||
10 | #define LIST_POISON1 ((void *) 0x00100100) | 10 | #define LIST_POISON1 ((void *) 0x00100100) |
11 | #define LIST_POISON2 ((void *) 0x00200200) | 11 | #define LIST_POISON2 ((void *) 0x00200200) |
12 | 12 | ||
13 | /********** include/linux/timer.h **********/ | ||
14 | /* | ||
15 | * Magic number "tsta" to indicate a static timer initializer | ||
16 | * for the object debugging code. | ||
17 | */ | ||
18 | #define TIMER_ENTRY_STATIC ((void *) 0x74737461) | ||
19 | |||
13 | /********** mm/slab.c **********/ | 20 | /********** mm/slab.c **********/ |
14 | /* | 21 | /* |
15 | * Magic nums for obj red zoning. | 22 | * Magic nums for obj red zoning. |
diff --git a/include/linux/poll.h b/include/linux/poll.h index 16d813b364ef..ef453828877a 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
@@ -117,6 +117,8 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset) | |||
117 | extern int do_select(int n, fd_set_bits *fds, s64 *timeout); | 117 | extern int do_select(int n, fd_set_bits *fds, s64 *timeout); |
118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, | 118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, |
119 | s64 *timeout); | 119 | s64 *timeout); |
120 | extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, | ||
121 | fd_set __user *exp, s64 *timeout); | ||
120 | 122 | ||
121 | #endif /* KERNEL */ | 123 | #endif /* KERNEL */ |
122 | 124 | ||
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/proc_fs.h b/include/linux/proc_fs.h index 9b6c935f69cf..9883bc942262 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | struct net; | 10 | struct net; |
11 | struct completion; | 11 | struct completion; |
12 | |||
13 | /* | 12 | /* |
14 | * The proc filesystem constants/structures | 13 | * The proc filesystem constants/structures |
15 | */ | 14 | */ |
@@ -41,7 +40,7 @@ enum { | |||
41 | * /proc file has a parent, but "subdir" is NULL for all | 40 | * /proc file has a parent, but "subdir" is NULL for all |
42 | * non-directory entries). | 41 | * non-directory entries). |
43 | * | 42 | * |
44 | * "get_info" is called at "read", while "owner" is used to protect module | 43 | * "owner" is used to protect module |
45 | * from unloading while proc_dir_entry is in use | 44 | * from unloading while proc_dir_entry is in use |
46 | */ | 45 | */ |
47 | 46 | ||
@@ -49,7 +48,6 @@ typedef int (read_proc_t)(char *page, char **start, off_t off, | |||
49 | int count, int *eof, void *data); | 48 | int count, int *eof, void *data); |
50 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, | 49 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, |
51 | unsigned long count, void *data); | 50 | unsigned long count, void *data); |
52 | typedef int (get_info_t)(char *, char **, off_t, int); | ||
53 | 51 | ||
54 | struct proc_dir_entry { | 52 | struct proc_dir_entry { |
55 | unsigned int low_ino; | 53 | unsigned int low_ino; |
@@ -70,7 +68,6 @@ struct proc_dir_entry { | |||
70 | * somewhere. | 68 | * somewhere. |
71 | */ | 69 | */ |
72 | const struct file_operations *proc_fops; | 70 | const struct file_operations *proc_fops; |
73 | get_info_t *get_info; | ||
74 | struct module *owner; | 71 | struct module *owner; |
75 | struct proc_dir_entry *next, *parent, *subdir; | 72 | struct proc_dir_entry *next, *parent, *subdir; |
76 | void *data; | 73 | void *data; |
@@ -97,10 +94,6 @@ struct vmcore { | |||
97 | 94 | ||
98 | #ifdef CONFIG_PROC_FS | 95 | #ifdef CONFIG_PROC_FS |
99 | 96 | ||
100 | extern struct proc_dir_entry proc_root; | ||
101 | extern struct proc_dir_entry *proc_root_fs; | ||
102 | extern struct proc_dir_entry *proc_bus; | ||
103 | extern struct proc_dir_entry *proc_root_driver; | ||
104 | extern struct proc_dir_entry *proc_root_kcore; | 97 | extern struct proc_dir_entry *proc_root_kcore; |
105 | 98 | ||
106 | extern spinlock_t proc_subdir_lock; | 99 | extern spinlock_t proc_subdir_lock; |
@@ -123,9 +116,10 @@ void de_put(struct proc_dir_entry *de); | |||
123 | 116 | ||
124 | extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, | 117 | extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, |
125 | struct proc_dir_entry *parent); | 118 | struct proc_dir_entry *parent); |
126 | struct proc_dir_entry *proc_create(const char *name, mode_t mode, | 119 | struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, |
127 | struct proc_dir_entry *parent, | 120 | struct proc_dir_entry *parent, |
128 | const struct file_operations *proc_fops); | 121 | const struct file_operations *proc_fops, |
122 | void *data); | ||
129 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); | 123 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); |
130 | 124 | ||
131 | extern struct vfsmount *proc_mnt; | 125 | extern struct vfsmount *proc_mnt; |
@@ -180,6 +174,12 @@ extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); | |||
180 | extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, | 174 | extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, |
181 | struct proc_dir_entry *parent); | 175 | struct proc_dir_entry *parent); |
182 | 176 | ||
177 | static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode, | ||
178 | struct proc_dir_entry *parent, const struct file_operations *proc_fops) | ||
179 | { | ||
180 | return proc_create_data(name, mode, parent, proc_fops, NULL); | ||
181 | } | ||
182 | |||
183 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 183 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, |
184 | mode_t mode, struct proc_dir_entry *base, | 184 | mode_t mode, struct proc_dir_entry *base, |
185 | read_proc_t *read_proc, void * data) | 185 | read_proc_t *read_proc, void * data) |
@@ -192,24 +192,19 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | |||
192 | return res; | 192 | return res; |
193 | } | 193 | } |
194 | 194 | ||
195 | static inline struct proc_dir_entry *create_proc_info_entry(const char *name, | ||
196 | mode_t mode, struct proc_dir_entry *base, get_info_t *get_info) | ||
197 | { | ||
198 | struct proc_dir_entry *res=create_proc_entry(name,mode,base); | ||
199 | if (res) res->get_info=get_info; | ||
200 | return res; | ||
201 | } | ||
202 | |||
203 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, | 195 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, |
204 | const char *name, mode_t mode, const struct file_operations *fops); | 196 | const char *name, mode_t mode, const struct file_operations *fops); |
205 | extern void proc_net_remove(struct net *net, const char *name); | 197 | extern void proc_net_remove(struct net *net, const char *name); |
206 | extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, | 198 | extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, |
207 | struct proc_dir_entry *parent); | 199 | struct proc_dir_entry *parent); |
208 | 200 | ||
209 | #else | 201 | /* While the {get|set|dup}_mm_exe_file functions are for mm_structs, they are |
202 | * only needed to implement /proc/<pid>|self/exe so we define them here. */ | ||
203 | extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file); | ||
204 | extern struct file *get_mm_exe_file(struct mm_struct *mm); | ||
205 | extern void dup_mm_exe_file(struct mm_struct *oldmm, struct mm_struct *newmm); | ||
210 | 206 | ||
211 | #define proc_root_driver NULL | 207 | #else |
212 | #define proc_bus NULL | ||
213 | 208 | ||
214 | #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) | 209 | #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) |
215 | static inline void proc_net_remove(struct net *net, const char *name) {} | 210 | static inline void proc_net_remove(struct net *net, const char *name) {} |
@@ -226,6 +221,12 @@ static inline struct proc_dir_entry *proc_create(const char *name, | |||
226 | { | 221 | { |
227 | return NULL; | 222 | return NULL; |
228 | } | 223 | } |
224 | static inline struct proc_dir_entry *proc_create_data(const char *name, | ||
225 | mode_t mode, struct proc_dir_entry *parent, | ||
226 | const struct file_operations *proc_fops, void *data) | ||
227 | { | ||
228 | return NULL; | ||
229 | } | ||
229 | #define remove_proc_entry(name, parent) do {} while (0) | 230 | #define remove_proc_entry(name, parent) do {} while (0) |
230 | 231 | ||
231 | static inline struct proc_dir_entry *proc_symlink(const char *name, | 232 | static inline struct proc_dir_entry *proc_symlink(const char *name, |
@@ -236,16 +237,11 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name, | |||
236 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 237 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, |
237 | mode_t mode, struct proc_dir_entry *base, | 238 | mode_t mode, struct proc_dir_entry *base, |
238 | read_proc_t *read_proc, void * data) { return NULL; } | 239 | read_proc_t *read_proc, void * data) { return NULL; } |
239 | static inline struct proc_dir_entry *create_proc_info_entry(const char *name, | ||
240 | mode_t mode, struct proc_dir_entry *base, get_info_t *get_info) | ||
241 | { return NULL; } | ||
242 | 240 | ||
243 | struct tty_driver; | 241 | struct tty_driver; |
244 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; | 242 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; |
245 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; | 243 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; |
246 | 244 | ||
247 | extern struct proc_dir_entry proc_root; | ||
248 | |||
249 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) | 245 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) |
250 | { | 246 | { |
251 | return 0; | 247 | return 0; |
@@ -255,6 +251,19 @@ static inline void pid_ns_release_proc(struct pid_namespace *ns) | |||
255 | { | 251 | { |
256 | } | 252 | } |
257 | 253 | ||
254 | static inline void set_mm_exe_file(struct mm_struct *mm, | ||
255 | struct file *new_exe_file) | ||
256 | {} | ||
257 | |||
258 | static inline struct file *get_mm_exe_file(struct mm_struct *mm) | ||
259 | { | ||
260 | return NULL; | ||
261 | } | ||
262 | |||
263 | static inline void dup_mm_exe_file(struct mm_struct *oldmm, | ||
264 | struct mm_struct *newmm) | ||
265 | {} | ||
266 | |||
258 | #endif /* CONFIG_PROC_FS */ | 267 | #endif /* CONFIG_PROC_FS */ |
259 | 268 | ||
260 | #if !defined(CONFIG_PROC_KCORE) | 269 | #if !defined(CONFIG_PROC_KCORE) |
diff --git a/include/linux/profile.h b/include/linux/profile.h index ff576d1db67d..05c1cc736937 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _LINUX_PROFILE_H | 1 | #ifndef _LINUX_PROFILE_H |
2 | #define _LINUX_PROFILE_H | 2 | #define _LINUX_PROFILE_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
7 | #include <linux/init.h> | 5 | #include <linux/init.h> |
8 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
@@ -118,6 +116,4 @@ static inline void unregister_timer_hook(int (*hook)(struct pt_regs *)) | |||
118 | 116 | ||
119 | #endif /* CONFIG_PROFILING */ | 117 | #endif /* CONFIG_PROFILING */ |
120 | 118 | ||
121 | #endif /* __KERNEL__ */ | ||
122 | |||
123 | #endif /* _LINUX_PROFILE_H */ | 119 | #endif /* _LINUX_PROFILE_H */ |
diff --git a/include/linux/proportions.h b/include/linux/proportions.h index 2c3b3cad92be..5afc1b23346d 100644 --- a/include/linux/proportions.h +++ b/include/linux/proportions.h | |||
@@ -78,6 +78,19 @@ void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* | 80 | /* |
81 | * Limit the time part in order to ensure there are some bits left for the | ||
82 | * cycle counter and fraction multiply. | ||
83 | */ | ||
84 | #define PROP_MAX_SHIFT (3*BITS_PER_LONG/4) | ||
85 | |||
86 | #define PROP_FRAC_SHIFT (BITS_PER_LONG - PROP_MAX_SHIFT - 1) | ||
87 | #define PROP_FRAC_BASE (1UL << PROP_FRAC_SHIFT) | ||
88 | |||
89 | void __prop_inc_percpu_max(struct prop_descriptor *pd, | ||
90 | struct prop_local_percpu *pl, long frac); | ||
91 | |||
92 | |||
93 | /* | ||
81 | * ----- SINGLE ------ | 94 | * ----- SINGLE ------ |
82 | */ | 95 | */ |
83 | 96 | ||
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index ebe0c17039cf..f98501ba557e 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -98,6 +98,10 @@ extern void ptrace_untrace(struct task_struct *child); | |||
98 | extern int ptrace_may_attach(struct task_struct *task); | 98 | extern int ptrace_may_attach(struct task_struct *task); |
99 | extern int __ptrace_may_attach(struct task_struct *task); | 99 | extern int __ptrace_may_attach(struct task_struct *task); |
100 | 100 | ||
101 | static inline int ptrace_reparented(struct task_struct *child) | ||
102 | { | ||
103 | return child->real_parent != child->parent; | ||
104 | } | ||
101 | static inline void ptrace_link(struct task_struct *child, | 105 | static inline void ptrace_link(struct task_struct *child, |
102 | struct task_struct *new_parent) | 106 | struct task_struct *new_parent) |
103 | { | 107 | { |
diff --git a/include/linux/quota.h b/include/linux/quota.h index eb560d031acd..dcddfb200947 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -202,10 +202,14 @@ struct quota_format_type; | |||
202 | 202 | ||
203 | struct mem_dqinfo { | 203 | struct 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 */ |
298 | struct quotactl_ops { | 302 | struct 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 | ||
322 | struct quota_info { | 330 | struct 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,19 @@ 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 */ | ||
333 | int 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 | |||
350 | #define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \ | ||
351 | sb_has_quota_suspended(sb, GRPQUOTA)) | ||
352 | |||
343 | int register_quota_format(struct quota_format_type *fmt); | 353 | int register_quota_format(struct quota_format_type *fmt); |
344 | void unregister_quota_format(struct quota_format_type *fmt); | 354 | void unregister_quota_format(struct quota_format_type *fmt); |
345 | 355 | ||
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); | |||
37 | extern int dquot_commit_info(struct super_block *sb, int type); | 37 | extern int dquot_commit_info(struct super_block *sb, int type); |
38 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); | 38 | extern int dquot_mark_dquot_dirty(struct dquot *dquot); |
39 | 39 | ||
40 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); | 40 | extern int vfs_quota_on(struct super_block *sb, int type, int format_id, |
41 | char *path, int remount); | ||
41 | extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, | 42 | extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, |
42 | int format_id, int type); | 43 | int format_id, int type); |
43 | extern int vfs_quota_off(struct super_block *sb, int type); | 44 | extern 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) | ||
45 | extern int vfs_quota_sync(struct super_block *sb, int type); | 45 | extern int vfs_quota_sync(struct super_block *sb, int type); |
46 | extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 46 | extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
47 | extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 47 | extern 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. */ |
62 | static __inline__ void DQUOT_INIT(struct inode *inode) | 62 | static 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 */ |
70 | static __inline__ void DQUOT_DROP(struct inode *inode) | 70 | static 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) */ |
93 | static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 93 | static 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 | ||
105 | static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) | 105 | static 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 | ||
113 | static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 113 | static 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 | ||
125 | static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) | 125 | static 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 | ||
133 | static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode) | 133 | static 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 | ||
143 | static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 143 | static 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 | ||
151 | static __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) | 151 | static 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 | ||
157 | static __inline__ void DQUOT_FREE_INODE(struct inode *inode) | 157 | static 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 | ||
163 | static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) | 163 | static 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) | 174 | static inline void DQUOT_SYNC(struct super_block *sb) |
175 | { | ||
176 | sync_dquots(sb, -1); | ||
177 | } | ||
175 | 178 | ||
176 | static __inline__ int DQUOT_OFF(struct super_block *sb) | 179 | static 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 | |||
188 | static 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) | 211 | static 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) | 215 | static inline void DQUOT_DROP(struct inode *inode) |
198 | #define DQUOT_TRANSFER(inode, iattr) (0) | 216 | { |
217 | } | ||
218 | |||
219 | static inline int DQUOT_ALLOC_INODE(struct inode *inode) | ||
220 | { | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static inline void DQUOT_FREE_INODE(struct inode *inode) | ||
225 | { | ||
226 | } | ||
227 | |||
228 | static inline void DQUOT_SYNC(struct super_block *sb) | ||
229 | { | ||
230 | } | ||
231 | |||
232 | static inline int DQUOT_OFF(struct super_block *sb, int remount) | ||
233 | { | ||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static inline int DQUOT_ON_REMOUNT(struct super_block *sb) | ||
238 | { | ||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) | ||
243 | { | ||
244 | return 0; | ||
245 | } | ||
246 | |||
199 | static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) | 247 | static 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) | 286 | static 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 | |
292 | static 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 | |||
298 | static 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 | |||
304 | static 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 | |||
310 | static 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 | |||
315 | static 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/md.h b/include/linux/raid/md.h index 8ab630b67fcc..81a1a02d4566 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h | |||
@@ -94,6 +94,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, | |||
94 | extern void md_do_sync(mddev_t *mddev); | 94 | extern void md_do_sync(mddev_t *mddev); |
95 | extern void md_new_event(mddev_t *mddev); | 95 | extern void md_new_event(mddev_t *mddev); |
96 | extern void md_allow_write(mddev_t *mddev); | 96 | extern void md_allow_write(mddev_t *mddev); |
97 | extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); | ||
97 | 98 | ||
98 | #endif /* CONFIG_MD */ | 99 | #endif /* CONFIG_MD */ |
99 | #endif | 100 | #endif |
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 7bb6d1abf71e..812ffa590cff 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -84,6 +84,10 @@ struct mdk_rdev_s | |||
84 | #define AllReserved 6 /* If whole device is reserved for | 84 | #define AllReserved 6 /* If whole device is reserved for |
85 | * one array */ | 85 | * one array */ |
86 | #define AutoDetected 7 /* added by auto-detect */ | 86 | #define AutoDetected 7 /* added by auto-detect */ |
87 | #define Blocked 8 /* An error occured on an externally | ||
88 | * managed array, don't allow writes | ||
89 | * until it is cleared */ | ||
90 | wait_queue_head_t blocked_wait; | ||
87 | 91 | ||
88 | int desc_nr; /* descriptor index in the superblock */ | 92 | int desc_nr; /* descriptor index in the superblock */ |
89 | int raid_disk; /* role of device in array */ | 93 | int raid_disk; /* role of device in array */ |
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/rcuclassic.h b/include/linux/rcuclassic.h index b3dccd68629e..b3aa05baab8a 100644 --- a/include/linux/rcuclassic.h +++ b/include/linux/rcuclassic.h | |||
@@ -33,8 +33,6 @@ | |||
33 | #ifndef __LINUX_RCUCLASSIC_H | 33 | #ifndef __LINUX_RCUCLASSIC_H |
34 | #define __LINUX_RCUCLASSIC_H | 34 | #define __LINUX_RCUCLASSIC_H |
35 | 35 | ||
36 | #ifdef __KERNEL__ | ||
37 | |||
38 | #include <linux/cache.h> | 36 | #include <linux/cache.h> |
39 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
40 | #include <linux/threads.h> | 38 | #include <linux/threads.h> |
@@ -163,5 +161,4 @@ extern long rcu_batches_completed_bh(void); | |||
163 | #define rcu_enter_nohz() do { } while (0) | 161 | #define rcu_enter_nohz() do { } while (0) |
164 | #define rcu_exit_nohz() do { } while (0) | 162 | #define rcu_exit_nohz() do { } while (0) |
165 | 163 | ||
166 | #endif /* __KERNEL__ */ | ||
167 | #endif /* __LINUX_RCUCLASSIC_H */ | 164 | #endif /* __LINUX_RCUCLASSIC_H */ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 37a642c54871..8082d6587a0f 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -33,8 +33,6 @@ | |||
33 | #ifndef __LINUX_RCUPDATE_H | 33 | #ifndef __LINUX_RCUPDATE_H |
34 | #define __LINUX_RCUPDATE_H | 34 | #define __LINUX_RCUPDATE_H |
35 | 35 | ||
36 | #ifdef __KERNEL__ | ||
37 | |||
38 | #include <linux/cache.h> | 36 | #include <linux/cache.h> |
39 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
40 | #include <linux/threads.h> | 38 | #include <linux/threads.h> |
@@ -245,5 +243,4 @@ extern long rcu_batches_completed_bh(void); | |||
245 | extern void rcu_init(void); | 243 | extern void rcu_init(void); |
246 | extern int rcu_needs_cpu(int cpu); | 244 | extern int rcu_needs_cpu(int cpu); |
247 | 245 | ||
248 | #endif /* __KERNEL__ */ | ||
249 | #endif /* __LINUX_RCUPDATE_H */ | 246 | #endif /* __LINUX_RCUPDATE_H */ |
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index d038aa6e5ee1..8a05c7e20bc4 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h | |||
@@ -33,8 +33,6 @@ | |||
33 | #ifndef __LINUX_RCUPREEMPT_H | 33 | #ifndef __LINUX_RCUPREEMPT_H |
34 | #define __LINUX_RCUPREEMPT_H | 34 | #define __LINUX_RCUPREEMPT_H |
35 | 35 | ||
36 | #ifdef __KERNEL__ | ||
37 | |||
38 | #include <linux/cache.h> | 36 | #include <linux/cache.h> |
39 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
40 | #include <linux/threads.h> | 38 | #include <linux/threads.h> |
@@ -104,5 +102,4 @@ static inline void rcu_exit_nohz(void) | |||
104 | #define rcu_exit_nohz() do { } while (0) | 102 | #define rcu_exit_nohz() do { } while (0) |
105 | #endif /* CONFIG_NO_HZ */ | 103 | #endif /* CONFIG_NO_HZ */ |
106 | 104 | ||
107 | #endif /* __KERNEL__ */ | ||
108 | #endif /* __LINUX_RCUPREEMPT_H */ | 105 | #endif /* __LINUX_RCUPREEMPT_H */ |
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h index 21cd6b2a5c42..b99ae073192a 100644 --- a/include/linux/rcupreempt_trace.h +++ b/include/linux/rcupreempt_trace.h | |||
@@ -32,7 +32,6 @@ | |||
32 | #ifndef __LINUX_RCUPREEMPT_TRACE_H | 32 | #ifndef __LINUX_RCUPREEMPT_TRACE_H |
33 | #define __LINUX_RCUPREEMPT_TRACE_H | 33 | #define __LINUX_RCUPREEMPT_TRACE_H |
34 | 34 | ||
35 | #ifdef __KERNEL__ | ||
36 | #include <linux/types.h> | 35 | #include <linux/types.h> |
37 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
38 | 37 | ||
@@ -95,5 +94,4 @@ extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace); | |||
95 | extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace); | 94 | extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace); |
96 | extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace); | 95 | extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace); |
97 | 96 | ||
98 | #endif /* __KERNEL__ */ | ||
99 | #endif /* __LINUX_RCUPREEMPT_TRACE_H */ | 97 | #endif /* __LINUX_RCUPREEMPT_TRACE_H */ |
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); |
2177 | long reiserfs_compat_ioctl(struct file *filp, | 2177 | long reiserfs_compat_ioctl(struct file *filp, |
2178 | unsigned int cmd, unsigned long arg); | 2178 | unsigned int cmd, unsigned long arg); |
2179 | int 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/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index db5ef9b83c3f..336ee43ed7d8 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -177,7 +177,6 @@ struct reiserfs_journal { | |||
177 | struct reiserfs_journal_cnode *j_last; /* newest journal block */ | 177 | struct reiserfs_journal_cnode *j_last; /* newest journal block */ |
178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ | 178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ |
179 | 179 | ||
180 | struct file *j_dev_file; | ||
181 | struct block_device *j_dev_bd; | 180 | struct block_device *j_dev_bd; |
182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | 181 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ |
183 | 182 | ||
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index 61363ce896d5..6d9e1fca098c 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h | |||
@@ -9,6 +9,8 @@ | |||
9 | * | 9 | * |
10 | * Author: Pavel Emelianov <xemul@openvz.org> | 10 | * Author: Pavel Emelianov <xemul@openvz.org> |
11 | * | 11 | * |
12 | * See Documentation/controllers/resource_counter.txt for more | ||
13 | * info about what this counter is. | ||
12 | */ | 14 | */ |
13 | 15 | ||
14 | #include <linux/cgroup.h> | 16 | #include <linux/cgroup.h> |
@@ -25,6 +27,10 @@ struct res_counter { | |||
25 | */ | 27 | */ |
26 | unsigned long long usage; | 28 | unsigned long long usage; |
27 | /* | 29 | /* |
30 | * the maximal value of the usage from the counter creation | ||
31 | */ | ||
32 | unsigned long long max_usage; | ||
33 | /* | ||
28 | * the limit that usage cannot exceed | 34 | * the limit that usage cannot exceed |
29 | */ | 35 | */ |
30 | unsigned long long limit; | 36 | unsigned long long limit; |
@@ -39,8 +45,9 @@ struct res_counter { | |||
39 | spinlock_t lock; | 45 | spinlock_t lock; |
40 | }; | 46 | }; |
41 | 47 | ||
42 | /* | 48 | /** |
43 | * Helpers to interact with userspace | 49 | * Helpers to interact with userspace |
50 | * res_counter_read_u64() - returns the value of the specified member. | ||
44 | * res_counter_read/_write - put/get the specified fields from the | 51 | * res_counter_read/_write - put/get the specified fields from the |
45 | * res_counter struct to/from the user | 52 | * res_counter struct to/from the user |
46 | * | 53 | * |
@@ -51,6 +58,8 @@ struct res_counter { | |||
51 | * @pos: and the offset. | 58 | * @pos: and the offset. |
52 | */ | 59 | */ |
53 | 60 | ||
61 | u64 res_counter_read_u64(struct res_counter *counter, int member); | ||
62 | |||
54 | ssize_t res_counter_read(struct res_counter *counter, int member, | 63 | ssize_t res_counter_read(struct res_counter *counter, int member, |
55 | const char __user *buf, size_t nbytes, loff_t *pos, | 64 | const char __user *buf, size_t nbytes, loff_t *pos, |
56 | int (*read_strategy)(unsigned long long val, char *s)); | 65 | int (*read_strategy)(unsigned long long val, char *s)); |
@@ -64,6 +73,7 @@ ssize_t res_counter_write(struct res_counter *counter, int member, | |||
64 | 73 | ||
65 | enum { | 74 | enum { |
66 | RES_USAGE, | 75 | RES_USAGE, |
76 | RES_MAX_USAGE, | ||
67 | RES_LIMIT, | 77 | RES_LIMIT, |
68 | RES_FAILCNT, | 78 | RES_FAILCNT, |
69 | }; | 79 | }; |
@@ -124,4 +134,21 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt) | |||
124 | return ret; | 134 | return ret; |
125 | } | 135 | } |
126 | 136 | ||
137 | static inline void res_counter_reset_max(struct res_counter *cnt) | ||
138 | { | ||
139 | unsigned long flags; | ||
140 | |||
141 | spin_lock_irqsave(&cnt->lock, flags); | ||
142 | cnt->max_usage = cnt->usage; | ||
143 | spin_unlock_irqrestore(&cnt->lock, flags); | ||
144 | } | ||
145 | |||
146 | static inline void res_counter_reset_failcnt(struct res_counter *cnt) | ||
147 | { | ||
148 | unsigned long flags; | ||
149 | |||
150 | spin_lock_irqsave(&cnt->lock, flags); | ||
151 | cnt->failcnt = 0; | ||
152 | spin_unlock_irqrestore(&cnt->lock, flags); | ||
153 | } | ||
127 | #endif | 154 | #endif |
diff --git a/include/linux/resource.h b/include/linux/resource.h index ae13db714742..aaa423a6f3d9 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h | |||
@@ -19,6 +19,7 @@ struct task_struct; | |||
19 | #define RUSAGE_SELF 0 | 19 | #define RUSAGE_SELF 0 |
20 | #define RUSAGE_CHILDREN (-1) | 20 | #define RUSAGE_CHILDREN (-1) |
21 | #define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ | 21 | #define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ |
22 | #define RUSAGE_THREAD 1 /* only the calling thread */ | ||
22 | 23 | ||
23 | struct rusage { | 24 | struct rusage { |
24 | struct timeval ru_utime; /* user time used */ | 25 | struct timeval ru_utime; /* user time used */ |
diff --git a/include/linux/rio.h b/include/linux/rio.h index 68e3f6853fa6..c1c99c9643d3 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #ifndef LINUX_RIO_H | 14 | #ifndef LINUX_RIO_H |
15 | #define LINUX_RIO_H | 15 | #define LINUX_RIO_H |
16 | 16 | ||
17 | #ifdef __KERNEL__ | ||
18 | |||
19 | #include <linux/types.h> | 17 | #include <linux/types.h> |
20 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
21 | #include <linux/list.h> | 19 | #include <linux/list.h> |
@@ -23,7 +21,6 @@ | |||
23 | #include <linux/device.h> | 21 | #include <linux/device.h> |
24 | #include <linux/rio_regs.h> | 22 | #include <linux/rio_regs.h> |
25 | 23 | ||
26 | #define RIO_ANY_DESTID 0xff | ||
27 | #define RIO_NO_HOPCOUNT -1 | 24 | #define RIO_NO_HOPCOUNT -1 |
28 | #define RIO_INVALID_DESTID 0xffff | 25 | #define RIO_INVALID_DESTID 0xffff |
29 | 26 | ||
@@ -39,11 +36,8 @@ | |||
39 | entry is invalid (no route | 36 | entry is invalid (no route |
40 | exists for the device ID) */ | 37 | exists for the device ID) */ |
41 | 38 | ||
42 | #ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT | 39 | #define RIO_MAX_ROUTE_ENTRIES(size) (size ? (1 << 16) : (1 << 8)) |
43 | #define RIO_MAX_ROUTE_ENTRIES (1 << 8) | 40 | #define RIO_ANY_DESTID(size) (size ? 0xffff : 0xff) |
44 | #else | ||
45 | #define RIO_MAX_ROUTE_ENTRIES (1 << 16) | ||
46 | #endif | ||
47 | 41 | ||
48 | #define RIO_MAX_MBOX 4 | 42 | #define RIO_MAX_MBOX 4 |
49 | #define RIO_MAX_MSG_SIZE 0x1000 | 43 | #define RIO_MAX_MSG_SIZE 0x1000 |
@@ -149,6 +143,11 @@ struct rio_dbell { | |||
149 | void *dev_id; | 143 | void *dev_id; |
150 | }; | 144 | }; |
151 | 145 | ||
146 | enum rio_phy_type { | ||
147 | RIO_PHY_PARALLEL, | ||
148 | RIO_PHY_SERIAL, | ||
149 | }; | ||
150 | |||
152 | /** | 151 | /** |
153 | * struct rio_mport - RIO master port info | 152 | * struct rio_mport - RIO master port info |
154 | * @dbells: List of doorbell events | 153 | * @dbells: List of doorbell events |
@@ -163,6 +162,7 @@ struct rio_dbell { | |||
163 | * @id: Port ID, unique among all ports | 162 | * @id: Port ID, unique among all ports |
164 | * @index: Port index, unique among all port interfaces of the same type | 163 | * @index: Port index, unique among all port interfaces of the same type |
165 | * @name: Port name string | 164 | * @name: Port name string |
165 | * @priv: Master port private data | ||
166 | */ | 166 | */ |
167 | struct rio_mport { | 167 | struct rio_mport { |
168 | struct list_head dbells; /* list of doorbell events */ | 168 | struct list_head dbells; /* list of doorbell events */ |
@@ -177,7 +177,13 @@ struct rio_mport { | |||
177 | unsigned char id; /* port ID, unique among all ports */ | 177 | unsigned char id; /* port ID, unique among all ports */ |
178 | unsigned char index; /* port index, unique among all port | 178 | unsigned char index; /* port index, unique among all port |
179 | interfaces of the same type */ | 179 | interfaces of the same type */ |
180 | unsigned int sys_size; /* RapidIO common transport system size. | ||
181 | * 0 - Small size. 256 devices. | ||
182 | * 1 - Large size, 65536 devices. | ||
183 | */ | ||
184 | enum rio_phy_type phy_type; /* RapidIO phy type */ | ||
180 | unsigned char name[40]; | 185 | unsigned char name[40]; |
186 | void *priv; /* Master port private data */ | ||
181 | }; | 187 | }; |
182 | 188 | ||
183 | /** | 189 | /** |
@@ -211,7 +217,7 @@ struct rio_switch { | |||
211 | u16 switchid; | 217 | u16 switchid; |
212 | u16 hopcount; | 218 | u16 hopcount; |
213 | u16 destid; | 219 | u16 destid; |
214 | u8 route_table[RIO_MAX_ROUTE_ENTRIES]; | 220 | u8 *route_table; |
215 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | 221 | int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, |
216 | u16 table, u16 route_destid, u8 route_port); | 222 | u16 table, u16 route_destid, u8 route_port); |
217 | int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, | 223 | int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, |
@@ -229,13 +235,15 @@ struct rio_switch { | |||
229 | * @dsend: Callback to send a doorbell message. | 235 | * @dsend: Callback to send a doorbell message. |
230 | */ | 236 | */ |
231 | struct rio_ops { | 237 | struct rio_ops { |
232 | int (*lcread) (int index, u32 offset, int len, u32 * data); | 238 | int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, |
233 | int (*lcwrite) (int index, u32 offset, int len, u32 data); | 239 | u32 *data); |
234 | int (*cread) (int index, u16 destid, u8 hopcount, u32 offset, int len, | 240 | int (*lcwrite) (struct rio_mport *mport, int index, u32 offset, int len, |
235 | u32 * data); | 241 | u32 data); |
236 | int (*cwrite) (int index, u16 destid, u8 hopcount, u32 offset, int len, | 242 | int (*cread) (struct rio_mport *mport, int index, u16 destid, |
237 | u32 data); | 243 | u8 hopcount, u32 offset, int len, u32 *data); |
238 | int (*dsend) (int index, u16 destid, u16 data); | 244 | int (*cwrite) (struct rio_mport *mport, int index, u16 destid, |
245 | u8 hopcount, u32 offset, int len, u32 data); | ||
246 | int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data); | ||
239 | }; | 247 | }; |
240 | 248 | ||
241 | #define RIO_RESOURCE_MEM 0x00000100 | 249 | #define RIO_RESOURCE_MEM 0x00000100 |
@@ -321,5 +329,4 @@ extern void rio_close_inb_mbox(struct rio_mport *, int); | |||
321 | extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); | 329 | extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); |
322 | extern void rio_close_outb_mbox(struct rio_mport *, int); | 330 | extern void rio_close_outb_mbox(struct rio_mport *, int); |
323 | 331 | ||
324 | #endif /* __KERNEL__ */ | ||
325 | #endif /* LINUX_RIO_H */ | 332 | #endif /* LINUX_RIO_H */ |
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h index 7adb2a1aac92..90987b7bcc1b 100644 --- a/include/linux/rio_drv.h +++ b/include/linux/rio_drv.h | |||
@@ -13,8 +13,6 @@ | |||
13 | #ifndef LINUX_RIO_DRV_H | 13 | #ifndef LINUX_RIO_DRV_H |
14 | #define LINUX_RIO_DRV_H | 14 | #define LINUX_RIO_DRV_H |
15 | 15 | ||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <linux/types.h> | 16 | #include <linux/types.h> |
19 | #include <linux/ioport.h> | 17 | #include <linux/ioport.h> |
20 | #include <linux/list.h> | 18 | #include <linux/list.h> |
@@ -465,5 +463,4 @@ extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from); | |||
465 | extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, | 463 | extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, |
466 | struct rio_dev *from); | 464 | struct rio_dev *from); |
467 | 465 | ||
468 | #endif /* __KERNEL__ */ | ||
469 | #endif /* LINUX_RIO_DRV_H */ | 466 | #endif /* LINUX_RIO_DRV_H */ |
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 7b524b4109a0..efd348fe8ca7 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
@@ -9,8 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/linkage.h> | 10 | #include <linux/linkage.h> |
11 | 11 | ||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #include <linux/types.h> | 12 | #include <linux/types.h> |
15 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
16 | #include <asm/system.h> | 14 | #include <asm/system.h> |
@@ -90,5 +88,4 @@ extern void up_read_non_owner(struct rw_semaphore *sem); | |||
90 | # define up_read_non_owner(sem) up_read(sem) | 88 | # define up_read_non_owner(sem) up_read(sem) |
91 | #endif | 89 | #endif |
92 | 90 | ||
93 | #endif /* __KERNEL__ */ | ||
94 | #endif /* _LINUX_RWSEM_H */ | 91 | #endif /* _LINUX_RWSEM_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 9a4f3e63e3bf..03c238088aee 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> |
@@ -555,6 +554,14 @@ struct signal_struct { | |||
555 | #define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */ | 554 | #define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */ |
556 | #define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ | 555 | #define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ |
557 | #define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ | 556 | #define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */ |
557 | /* | ||
558 | * Pending notifications to parent. | ||
559 | */ | ||
560 | #define SIGNAL_CLD_STOPPED 0x00000010 | ||
561 | #define SIGNAL_CLD_CONTINUED 0x00000020 | ||
562 | #define SIGNAL_CLD_MASK (SIGNAL_CLD_STOPPED|SIGNAL_CLD_CONTINUED) | ||
563 | |||
564 | #define SIGNAL_UNKILLABLE 0x00000040 /* for init: ignore fatal signals */ | ||
558 | 565 | ||
559 | /* If true, all threads except ->group_exit_task have pending SIGKILL */ | 566 | /* If true, all threads except ->group_exit_task have pending SIGKILL */ |
560 | static inline int signal_group_exit(const struct signal_struct *sig) | 567 | static inline int signal_group_exit(const struct signal_struct *sig) |
@@ -1133,7 +1140,7 @@ struct task_struct { | |||
1133 | gid_t gid,egid,sgid,fsgid; | 1140 | gid_t gid,egid,sgid,fsgid; |
1134 | struct group_info *group_info; | 1141 | struct group_info *group_info; |
1135 | kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; | 1142 | kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; |
1136 | unsigned keep_capabilities:1; | 1143 | unsigned securebits; |
1137 | struct user_struct *user; | 1144 | struct user_struct *user; |
1138 | #ifdef CONFIG_KEYS | 1145 | #ifdef CONFIG_KEYS |
1139 | struct key *request_key_auth; /* assumed request_key authority */ | 1146 | struct key *request_key_auth; /* assumed request_key authority */ |
@@ -1168,7 +1175,7 @@ struct task_struct { | |||
1168 | struct sighand_struct *sighand; | 1175 | struct sighand_struct *sighand; |
1169 | 1176 | ||
1170 | sigset_t blocked, real_blocked; | 1177 | sigset_t blocked, real_blocked; |
1171 | sigset_t saved_sigmask; /* To be restored with TIF_RESTORE_SIGMASK */ | 1178 | sigset_t saved_sigmask; /* restored if set_restore_sigmask() was used */ |
1172 | struct sigpending pending; | 1179 | struct sigpending pending; |
1173 | 1180 | ||
1174 | unsigned long sas_ss_sp; | 1181 | unsigned long sas_ss_sp; |
@@ -1670,7 +1677,10 @@ extern struct pid_namespace init_pid_ns; | |||
1670 | extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, | 1677 | extern struct task_struct *find_task_by_pid_type_ns(int type, int pid, |
1671 | struct pid_namespace *ns); | 1678 | struct pid_namespace *ns); |
1672 | 1679 | ||
1673 | extern struct task_struct *find_task_by_pid(pid_t nr); | 1680 | static inline struct task_struct *__deprecated find_task_by_pid(pid_t nr) |
1681 | { | ||
1682 | return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns); | ||
1683 | } | ||
1674 | extern struct task_struct *find_task_by_vpid(pid_t nr); | 1684 | extern struct task_struct *find_task_by_vpid(pid_t nr); |
1675 | extern struct task_struct *find_task_by_pid_ns(pid_t nr, | 1685 | extern struct task_struct *find_task_by_pid_ns(pid_t nr, |
1676 | struct pid_namespace *ns); | 1686 | struct pid_namespace *ns); |
@@ -1746,8 +1756,7 @@ extern void zap_other_threads(struct task_struct *p); | |||
1746 | extern int kill_proc(pid_t, int, int); | 1756 | extern int kill_proc(pid_t, int, int); |
1747 | extern struct sigqueue *sigqueue_alloc(void); | 1757 | extern struct sigqueue *sigqueue_alloc(void); |
1748 | extern void sigqueue_free(struct sigqueue *); | 1758 | extern void sigqueue_free(struct sigqueue *); |
1749 | extern int send_sigqueue(int, struct sigqueue *, struct task_struct *); | 1759 | extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); |
1750 | extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *); | ||
1751 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); | 1760 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); |
1752 | extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); | 1761 | extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); |
1753 | 1762 | ||
@@ -2149,6 +2158,19 @@ static inline void migration_init(void) | |||
2149 | #define TASK_SIZE_OF(tsk) TASK_SIZE | 2158 | #define TASK_SIZE_OF(tsk) TASK_SIZE |
2150 | #endif | 2159 | #endif |
2151 | 2160 | ||
2161 | #ifdef CONFIG_MM_OWNER | ||
2162 | extern void mm_update_next_owner(struct mm_struct *mm); | ||
2163 | extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); | ||
2164 | #else | ||
2165 | static inline void mm_update_next_owner(struct mm_struct *mm) | ||
2166 | { | ||
2167 | } | ||
2168 | |||
2169 | static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | ||
2170 | { | ||
2171 | } | ||
2172 | #endif /* CONFIG_MM_OWNER */ | ||
2173 | |||
2152 | #endif /* __KERNEL__ */ | 2174 | #endif /* __KERNEL__ */ |
2153 | 2175 | ||
2154 | #endif | 2176 | #endif |
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 | ||
6 | extern 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..50737c70e78e 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 | ||
37 | extern 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,28 @@ 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 | */ |
49 | extern int cap_capable (struct task_struct *tsk, int cap); | 47 | extern int cap_capable(struct task_struct *tsk, int cap); |
50 | extern int cap_settime (struct timespec *ts, struct timezone *tz); | 48 | extern int cap_settime(struct timespec *ts, struct timezone *tz); |
51 | extern int cap_ptrace (struct task_struct *parent, struct task_struct *child); | 49 | extern int cap_ptrace(struct task_struct *parent, struct task_struct *child); |
52 | extern int cap_capget (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 50 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
53 | extern int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 51 | extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
54 | extern void cap_capset_set (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); | 52 | extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
55 | extern int cap_bprm_set_security (struct linux_binprm *bprm); | 53 | extern int cap_bprm_set_security(struct linux_binprm *bprm); |
56 | extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe); | 54 | extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); |
57 | extern int cap_bprm_secureexec(struct linux_binprm *bprm); | 55 | extern int cap_bprm_secureexec(struct linux_binprm *bprm); |
58 | extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags); | 56 | extern int cap_inode_setxattr(struct dentry *dentry, const char *name, |
59 | extern int cap_inode_removexattr(struct dentry *dentry, char *name); | 57 | const void *value, size_t size, int flags); |
58 | extern int cap_inode_removexattr(struct dentry *dentry, const char *name); | ||
60 | extern int cap_inode_need_killpriv(struct dentry *dentry); | 59 | extern int cap_inode_need_killpriv(struct dentry *dentry); |
61 | extern int cap_inode_killpriv(struct dentry *dentry); | 60 | extern int cap_inode_killpriv(struct dentry *dentry); |
62 | extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); | 61 | extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); |
63 | extern void cap_task_reparent_to_init (struct task_struct *p); | 62 | extern void cap_task_reparent_to_init(struct task_struct *p); |
64 | extern int cap_task_setscheduler (struct task_struct *p, int policy, struct sched_param *lp); | 63 | extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
65 | extern int cap_task_setioprio (struct task_struct *p, int ioprio); | 64 | unsigned long arg4, unsigned long arg5, long *rc_p); |
66 | extern int cap_task_setnice (struct task_struct *p, int nice); | 65 | extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); |
67 | extern int cap_syslog (int type); | 66 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); |
67 | extern int cap_task_setnice(struct task_struct *p, int nice); | ||
68 | extern int cap_syslog(int type); | ||
68 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); | 69 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); |
69 | 70 | ||
70 | struct msghdr; | 71 | struct msghdr; |
@@ -128,7 +129,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
128 | { | 129 | { |
129 | int i; | 130 | int i; |
130 | if (opts->mnt_opts) | 131 | if (opts->mnt_opts) |
131 | for(i = 0; i < opts->num_mnt_opts; i++) | 132 | for (i = 0; i < opts->num_mnt_opts; i++) |
132 | kfree(opts->mnt_opts[i]); | 133 | kfree(opts->mnt_opts[i]); |
133 | kfree(opts->mnt_opts); | 134 | kfree(opts->mnt_opts); |
134 | opts->mnt_opts = NULL; | 135 | opts->mnt_opts = NULL; |
@@ -190,21 +191,21 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
190 | * @bprm contains the linux_binprm structure. | 191 | * @bprm contains the linux_binprm structure. |
191 | * Return 0 if the hook is successful and permission is granted. | 192 | * Return 0 if the hook is successful and permission is granted. |
192 | * @bprm_check_security: | 193 | * @bprm_check_security: |
193 | * This hook mediates the point when a search for a binary handler will | 194 | * 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 | 195 | * begin. It allows a check the @bprm->security value which is set in |
195 | * the preceding set_security call. The primary difference from | 196 | * the preceding set_security call. The primary difference from |
196 | * set_security is that the argv list and envp list are reliably | 197 | * set_security is that the argv list and envp list are reliably |
197 | * available in @bprm. This hook may be called multiple times | 198 | * available in @bprm. This hook may be called multiple times |
198 | * during a single execve; and in each pass set_security is called | 199 | * during a single execve; and in each pass set_security is called |
199 | * first. | 200 | * first. |
200 | * @bprm contains the linux_binprm structure. | 201 | * @bprm contains the linux_binprm structure. |
201 | * Return 0 if the hook is successful and permission is granted. | 202 | * Return 0 if the hook is successful and permission is granted. |
202 | * @bprm_secureexec: | 203 | * @bprm_secureexec: |
203 | * Return a boolean value (0 or 1) indicating whether a "secure exec" | 204 | * Return a boolean value (0 or 1) indicating whether a "secure exec" |
204 | * is required. The flag is passed in the auxiliary table | 205 | * is required. The flag is passed in the auxiliary table |
205 | * on the initial stack to the ELF interpreter to indicate whether libc | 206 | * on the initial stack to the ELF interpreter to indicate whether libc |
206 | * should enable secure mode. | 207 | * should enable secure mode. |
207 | * @bprm contains the linux_binprm structure. | 208 | * @bprm contains the linux_binprm structure. |
208 | * | 209 | * |
209 | * Security hooks for filesystem operations. | 210 | * Security hooks for filesystem operations. |
210 | * | 211 | * |
@@ -221,7 +222,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
221 | * Check permission before obtaining filesystem statistics for the @mnt | 222 | * Check permission before obtaining filesystem statistics for the @mnt |
222 | * mountpoint. | 223 | * mountpoint. |
223 | * @dentry is a handle on the superblock for the filesystem. | 224 | * @dentry is a handle on the superblock for the filesystem. |
224 | * Return 0 if permission is granted. | 225 | * Return 0 if permission is granted. |
225 | * @sb_mount: | 226 | * @sb_mount: |
226 | * Check permission before an object specified by @dev_name is mounted on | 227 | * 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 | 228 | * the mount point named by @nd. For an ordinary mount, @dev_name |
@@ -282,12 +283,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
282 | * @sb_pivotroot: | 283 | * @sb_pivotroot: |
283 | * Check permission before pivoting the root filesystem. | 284 | * Check permission before pivoting the root filesystem. |
284 | * @old_path contains the path for the new location of the current root (put_old). | 285 | * @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). | 286 | * @new_path contains the path for the new root (new_root). |
286 | * Return 0 if permission is granted. | 287 | * Return 0 if permission is granted. |
287 | * @sb_post_pivotroot: | 288 | * @sb_post_pivotroot: |
288 | * Update module state after a successful pivot. | 289 | * Update module state after a successful pivot. |
289 | * @old_path contains the path for the old root. | 290 | * @old_path contains the path for the old root. |
290 | * @new_path contains the path for the new root. | 291 | * @new_path contains the path for the new root. |
291 | * @sb_get_mnt_opts: | 292 | * @sb_get_mnt_opts: |
292 | * Get the security relevant mount options used for a superblock | 293 | * Get the security relevant mount options used for a superblock |
293 | * @sb the superblock to get security mount options from | 294 | * @sb the superblock to get security mount options from |
@@ -316,9 +317,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
316 | * @inode_free_security: | 317 | * @inode_free_security: |
317 | * @inode contains the inode structure. | 318 | * @inode contains the inode structure. |
318 | * Deallocate the inode security structure and set @inode->i_security to | 319 | * Deallocate the inode security structure and set @inode->i_security to |
319 | * NULL. | 320 | * NULL. |
320 | * @inode_init_security: | 321 | * @inode_init_security: |
321 | * Obtain the security attribute name suffix and value to set on a newly | 322 | * 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. | 323 | * 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 | 324 | * 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 | 325 | * transaction and provides for atomic labeling of the inode, unlike |
@@ -349,7 +350,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
349 | * @new_dentry contains the dentry structure for the new link. | 350 | * @new_dentry contains the dentry structure for the new link. |
350 | * Return 0 if permission is granted. | 351 | * Return 0 if permission is granted. |
351 | * @inode_unlink: | 352 | * @inode_unlink: |
352 | * Check the permission to remove a hard link to a file. | 353 | * Check the permission to remove a hard link to a file. |
353 | * @dir contains the inode structure of parent directory of the file. | 354 | * @dir contains the inode structure of parent directory of the file. |
354 | * @dentry contains the dentry structure for file to be unlinked. | 355 | * @dentry contains the dentry structure for file to be unlinked. |
355 | * Return 0 if permission is granted. | 356 | * Return 0 if permission is granted. |
@@ -361,7 +362,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
361 | * Return 0 if permission is granted. | 362 | * Return 0 if permission is granted. |
362 | * @inode_mkdir: | 363 | * @inode_mkdir: |
363 | * Check permissions to create a new directory in the existing directory | 364 | * Check permissions to create a new directory in the existing directory |
364 | * associated with inode strcture @dir. | 365 | * associated with inode strcture @dir. |
365 | * @dir containst the inode structure of parent of the directory to be created. | 366 | * @dir containst the inode structure of parent of the directory to be created. |
366 | * @dentry contains the dentry structure of new directory. | 367 | * @dentry contains the dentry structure of new directory. |
367 | * @mode contains the mode of new directory. | 368 | * @mode contains the mode of new directory. |
@@ -406,7 +407,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
406 | * called when the actual read/write operations are performed. | 407 | * called when the actual read/write operations are performed. |
407 | * @inode contains the inode structure to check. | 408 | * @inode contains the inode structure to check. |
408 | * @mask contains the permission mask. | 409 | * @mask contains the permission mask. |
409 | * @nd contains the nameidata (may be NULL). | 410 | * @nd contains the nameidata (may be NULL). |
410 | * Return 0 if permission is granted. | 411 | * Return 0 if permission is granted. |
411 | * @inode_setattr: | 412 | * @inode_setattr: |
412 | * Check permission before setting file attributes. Note that the kernel | 413 | * Check permission before setting file attributes. Note that the kernel |
@@ -428,24 +429,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 | 429 | * can use this hook to release any persistent label associated with the |
429 | * inode. | 430 | * inode. |
430 | * @inode_setxattr: | 431 | * @inode_setxattr: |
431 | * Check permission before setting the extended attributes | 432 | * Check permission before setting the extended attributes |
432 | * @value identified by @name for @dentry. | 433 | * @value identified by @name for @dentry. |
433 | * Return 0 if permission is granted. | 434 | * Return 0 if permission is granted. |
434 | * @inode_post_setxattr: | 435 | * @inode_post_setxattr: |
435 | * Update inode security field after successful setxattr operation. | 436 | * Update inode security field after successful setxattr operation. |
436 | * @value identified by @name for @dentry. | 437 | * @value identified by @name for @dentry. |
437 | * @inode_getxattr: | 438 | * @inode_getxattr: |
438 | * Check permission before obtaining the extended attributes | 439 | * Check permission before obtaining the extended attributes |
439 | * identified by @name for @dentry. | 440 | * identified by @name for @dentry. |
440 | * Return 0 if permission is granted. | 441 | * Return 0 if permission is granted. |
441 | * @inode_listxattr: | 442 | * @inode_listxattr: |
442 | * Check permission before obtaining the list of extended attribute | 443 | * Check permission before obtaining the list of extended attribute |
443 | * names for @dentry. | 444 | * names for @dentry. |
444 | * Return 0 if permission is granted. | 445 | * Return 0 if permission is granted. |
445 | * @inode_removexattr: | 446 | * @inode_removexattr: |
446 | * Check permission before removing the extended attribute | 447 | * Check permission before removing the extended attribute |
447 | * identified by @name for @dentry. | 448 | * identified by @name for @dentry. |
448 | * Return 0 if permission is granted. | 449 | * Return 0 if permission is granted. |
449 | * @inode_getsecurity: | 450 | * @inode_getsecurity: |
450 | * Retrieve a copy of the extended attribute representation of the | 451 | * Retrieve a copy of the extended attribute representation of the |
451 | * security label associated with @name for @inode via @buffer. Note that | 452 | * security label associated with @name for @inode via @buffer. Note that |
@@ -457,7 +458,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 | 458 | * Set the security label associated with @name for @inode from the |
458 | * extended attribute value @value. @size indicates the size of the | 459 | * extended attribute value @value. @size indicates the size of the |
459 | * @value in bytes. @flags may be XATTR_CREATE, XATTR_REPLACE, or 0. | 460 | * @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 | 461 | * Note that @name is the remainder of the attribute name after the |
461 | * security. prefix has been removed. | 462 | * security. prefix has been removed. |
462 | * Return 0 on success. | 463 | * Return 0 on success. |
463 | * @inode_listsecurity: | 464 | * @inode_listsecurity: |
@@ -564,7 +565,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
564 | * struct file, so the file structure (and associated security information) | 565 | * struct file, so the file structure (and associated security information) |
565 | * can always be obtained: | 566 | * can always be obtained: |
566 | * container_of(fown, struct file, f_owner) | 567 | * container_of(fown, struct file, f_owner) |
567 | * @tsk contains the structure of task receiving signal. | 568 | * @tsk contains the structure of task receiving signal. |
568 | * @fown contains the file owner information. | 569 | * @fown contains the file owner information. |
569 | * @sig is the signal that will be sent. When 0, kernel sends SIGIO. | 570 | * @sig is the signal that will be sent. When 0, kernel sends SIGIO. |
570 | * Return 0 if permission is granted. | 571 | * Return 0 if permission is granted. |
@@ -720,14 +721,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
720 | * @arg3 contains a argument. | 721 | * @arg3 contains a argument. |
721 | * @arg4 contains a argument. | 722 | * @arg4 contains a argument. |
722 | * @arg5 contains a argument. | 723 | * @arg5 contains a argument. |
723 | * Return 0 if permission is granted. | 724 | * @rc_p contains a pointer to communicate back the forced return code |
725 | * Return 0 if permission is granted, and non-zero if the security module | ||
726 | * has taken responsibility (setting *rc_p) for the prctl call. | ||
724 | * @task_reparent_to_init: | 727 | * @task_reparent_to_init: |
725 | * Set the security attributes in @p->security for a kernel thread that | 728 | * Set the security attributes in @p->security for a kernel thread that |
726 | * is being reparented to the init task. | 729 | * is being reparented to the init task. |
727 | * @p contains the task_struct for the kernel thread. | 730 | * @p contains the task_struct for the kernel thread. |
728 | * @task_to_inode: | 731 | * @task_to_inode: |
729 | * Set the security attributes for an inode based on an associated task's | 732 | * Set the security attributes for an inode based on an associated task's |
730 | * security attributes, e.g. for /proc/pid inodes. | 733 | * security attributes, e.g. for /proc/pid inodes. |
731 | * @p contains the task_struct for the task. | 734 | * @p contains the task_struct for the task. |
732 | * @inode contains the inode structure for the inode. | 735 | * @inode contains the inode structure for the inode. |
733 | * | 736 | * |
@@ -737,7 +740,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
737 | * Save security information for a netlink message so that permission | 740 | * Save security information for a netlink message so that permission |
738 | * checking can be performed when the message is processed. The security | 741 | * checking can be performed when the message is processed. The security |
739 | * information can be saved using the eff_cap field of the | 742 | * information can be saved using the eff_cap field of the |
740 | * netlink_skb_parms structure. Also may be used to provide fine | 743 | * netlink_skb_parms structure. Also may be used to provide fine |
741 | * grained control over message transmission. | 744 | * grained control over message transmission. |
742 | * @sk associated sock of task sending the message., | 745 | * @sk associated sock of task sending the message., |
743 | * @skb contains the sk_buff structure for the netlink message. | 746 | * @skb contains the sk_buff structure for the netlink message. |
@@ -805,14 +808,14 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
805 | * @sock contains the socket structure. | 808 | * @sock contains the socket structure. |
806 | * @address contains the address to bind to. | 809 | * @address contains the address to bind to. |
807 | * @addrlen contains the length of address. | 810 | * @addrlen contains the length of address. |
808 | * Return 0 if permission is granted. | 811 | * Return 0 if permission is granted. |
809 | * @socket_connect: | 812 | * @socket_connect: |
810 | * Check permission before socket protocol layer connect operation | 813 | * Check permission before socket protocol layer connect operation |
811 | * attempts to connect socket @sock to a remote address, @address. | 814 | * attempts to connect socket @sock to a remote address, @address. |
812 | * @sock contains the socket structure. | 815 | * @sock contains the socket structure. |
813 | * @address contains the address of remote endpoint. | 816 | * @address contains the address of remote endpoint. |
814 | * @addrlen contains the length of address. | 817 | * @addrlen contains the length of address. |
815 | * Return 0 if permission is granted. | 818 | * Return 0 if permission is granted. |
816 | * @socket_listen: | 819 | * @socket_listen: |
817 | * Check permission before socket protocol layer listen operation. | 820 | * Check permission before socket protocol layer listen operation. |
818 | * @sock contains the socket structure. | 821 | * @sock contains the socket structure. |
@@ -842,7 +845,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
842 | * @msg contains the message structure. | 845 | * @msg contains the message structure. |
843 | * @size contains the size of message structure. | 846 | * @size contains the size of message structure. |
844 | * @flags contains the operational flags. | 847 | * @flags contains the operational flags. |
845 | * Return 0 if permission is granted. | 848 | * Return 0 if permission is granted. |
846 | * @socket_getsockname: | 849 | * @socket_getsockname: |
847 | * Check permission before the local address (name) of the socket object | 850 | * Check permission before the local address (name) of the socket object |
848 | * @sock is retrieved. | 851 | * @sock is retrieved. |
@@ -866,7 +869,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
866 | * @sock contains the socket structure. | 869 | * @sock contains the socket structure. |
867 | * @level contains the protocol level to set options for. | 870 | * @level contains the protocol level to set options for. |
868 | * @optname contains the name of the option to set. | 871 | * @optname contains the name of the option to set. |
869 | * Return 0 if permission is granted. | 872 | * Return 0 if permission is granted. |
870 | * @socket_shutdown: | 873 | * @socket_shutdown: |
871 | * Checks permission before all or part of a connection on the socket | 874 | * Checks permission before all or part of a connection on the socket |
872 | * @sock is shut down. | 875 | * @sock is shut down. |
@@ -893,19 +896,19 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
893 | * Return 0 if all is well, otherwise, typical getsockopt return | 896 | * Return 0 if all is well, otherwise, typical getsockopt return |
894 | * values. | 897 | * values. |
895 | * @socket_getpeersec_dgram: | 898 | * @socket_getpeersec_dgram: |
896 | * This hook allows the security module to provide peer socket security | 899 | * This hook allows the security module to provide peer socket security |
897 | * state for udp sockets on a per-packet basis to userspace via | 900 | * state for udp sockets on a per-packet basis to userspace via |
898 | * getsockopt SO_GETPEERSEC. The application must first have indicated | 901 | * getsockopt SO_GETPEERSEC. The application must first have indicated |
899 | * the IP_PASSSEC option via getsockopt. It can then retrieve the | 902 | * 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 | 903 | * security state returned by this hook for a packet via the SCM_SECURITY |
901 | * ancillary message type. | 904 | * ancillary message type. |
902 | * @skb is the skbuff for the packet being queried | 905 | * @skb is the skbuff for the packet being queried |
903 | * @secdata is a pointer to a buffer in which to copy the security data | 906 | * @secdata is a pointer to a buffer in which to copy the security data |
904 | * @seclen is the maximum length for @secdata | 907 | * @seclen is the maximum length for @secdata |
905 | * Return 0 on success, error on failure. | 908 | * Return 0 on success, error on failure. |
906 | * @sk_alloc_security: | 909 | * @sk_alloc_security: |
907 | * Allocate and attach a security structure to the sk->sk_security field, | 910 | * Allocate and attach a security structure to the sk->sk_security field, |
908 | * which is used to copy security attributes between local stream sockets. | 911 | * which is used to copy security attributes between local stream sockets. |
909 | * @sk_free_security: | 912 | * @sk_free_security: |
910 | * Deallocate security structure. | 913 | * Deallocate security structure. |
911 | * @sk_clone_security: | 914 | * @sk_clone_security: |
@@ -920,7 +923,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
920 | * @inet_csk_clone: | 923 | * @inet_csk_clone: |
921 | * Sets the new child socket's sid to the openreq sid. | 924 | * Sets the new child socket's sid to the openreq sid. |
922 | * @inet_conn_established: | 925 | * @inet_conn_established: |
923 | * Sets the connection's peersid to the secmark on skb. | 926 | * Sets the connection's peersid to the secmark on skb. |
924 | * @req_classify_flow: | 927 | * @req_classify_flow: |
925 | * Sets the flow's sid to the openreq sid. | 928 | * Sets the flow's sid to the openreq sid. |
926 | * | 929 | * |
@@ -999,13 +1002,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
999 | * No return value. | 1002 | * No return value. |
1000 | * @key_permission: | 1003 | * @key_permission: |
1001 | * See whether a specific operational right is granted to a process on a | 1004 | * See whether a specific operational right is granted to a process on a |
1002 | * key. | 1005 | * key. |
1003 | * @key_ref refers to the key (key pointer + possession attribute bit). | 1006 | * @key_ref refers to the key (key pointer + possession attribute bit). |
1004 | * @context points to the process to provide the context against which to | 1007 | * @context points to the process to provide the context against which to |
1005 | * evaluate the security data on the key. | 1008 | * evaluate the security data on the key. |
1006 | * @perm describes the combination of permissions required of this key. | 1009 | * @perm describes the combination of permissions required of this key. |
1007 | * Return 1 if permission granted, 0 if permission denied and -ve it the | 1010 | * Return 1 if permission granted, 0 if permission denied and -ve it the |
1008 | * normal permissions model should be effected. | 1011 | * normal permissions model should be effected. |
1012 | * @key_getsecurity: | ||
1013 | * Get a textual representation of the security context attached to a key | ||
1014 | * for the purposes of honouring KEYCTL_GETSECURITY. This function | ||
1015 | * allocates the storage for the NUL-terminated string and the caller | ||
1016 | * should free it. | ||
1017 | * @key points to the key to be queried. | ||
1018 | * @_buffer points to a pointer that should be set to point to the | ||
1019 | * resulting string (if no label or an error occurs). | ||
1020 | * Return the length of the string (including terminating NUL) or -ve if | ||
1021 | * an error. | ||
1022 | * May also return 0 (and a NULL buffer pointer) if there is no label. | ||
1009 | * | 1023 | * |
1010 | * Security hooks affecting all System V IPC operations. | 1024 | * Security hooks affecting all System V IPC operations. |
1011 | * | 1025 | * |
@@ -1056,7 +1070,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. | 1070 | * 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. | 1071 | * @msq contains the message queue to act upon. May be NULL. |
1058 | * @cmd contains the operation to be performed. | 1072 | * @cmd contains the operation to be performed. |
1059 | * Return 0 if permission is granted. | 1073 | * Return 0 if permission is granted. |
1060 | * @msg_queue_msgsnd: | 1074 | * @msg_queue_msgsnd: |
1061 | * Check permission before a message, @msg, is enqueued on the message | 1075 | * Check permission before a message, @msg, is enqueued on the message |
1062 | * queue, @msq. | 1076 | * queue, @msq. |
@@ -1066,8 +1080,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1066 | * Return 0 if permission is granted. | 1080 | * Return 0 if permission is granted. |
1067 | * @msg_queue_msgrcv: | 1081 | * @msg_queue_msgrcv: |
1068 | * Check permission before a message, @msg, is removed from the message | 1082 | * Check permission before a message, @msg, is removed from the message |
1069 | * queue, @msq. The @target task structure contains a pointer to the | 1083 | * queue, @msq. The @target task structure contains a pointer to the |
1070 | * process that will be receiving the message (not equal to the current | 1084 | * process that will be receiving the message (not equal to the current |
1071 | * process when inline receives are being performed). | 1085 | * process when inline receives are being performed). |
1072 | * @msq contains the message queue to retrieve message from. | 1086 | * @msq contains the message queue to retrieve message from. |
1073 | * @msg contains the message destination. | 1087 | * @msg contains the message destination. |
@@ -1132,15 +1146,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1132 | * Return 0 if permission is granted. | 1146 | * Return 0 if permission is granted. |
1133 | * @sem_semctl: | 1147 | * @sem_semctl: |
1134 | * Check permission when a semaphore operation specified by @cmd is to be | 1148 | * 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 | 1149 | * performed on the semaphore @sma. The @sma may be NULL, e.g. for |
1136 | * IPC_INFO or SEM_INFO. | 1150 | * IPC_INFO or SEM_INFO. |
1137 | * @sma contains the semaphore structure. May be NULL. | 1151 | * @sma contains the semaphore structure. May be NULL. |
1138 | * @cmd contains the operation to be performed. | 1152 | * @cmd contains the operation to be performed. |
1139 | * Return 0 if permission is granted. | 1153 | * Return 0 if permission is granted. |
1140 | * @sem_semop | 1154 | * @sem_semop |
1141 | * Check permissions before performing operations on members of the | 1155 | * Check permissions before performing operations on members of the |
1142 | * semaphore set @sma. If the @alter flag is nonzero, the semaphore set | 1156 | * semaphore set @sma. If the @alter flag is nonzero, the semaphore set |
1143 | * may be modified. | 1157 | * may be modified. |
1144 | * @sma contains the semaphore structure. | 1158 | * @sma contains the semaphore structure. |
1145 | * @sops contains the operations to perform. | 1159 | * @sops contains the operations to perform. |
1146 | * @nsops contains the number of operations to perform. | 1160 | * @nsops contains the number of operations to perform. |
@@ -1211,7 +1225,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1211 | * @syslog: | 1225 | * @syslog: |
1212 | * Check permission before accessing the kernel message ring or changing | 1226 | * Check permission before accessing the kernel message ring or changing |
1213 | * logging to the console. | 1227 | * logging to the console. |
1214 | * See the syslog(2) manual page for an explanation of the @type values. | 1228 | * See the syslog(2) manual page for an explanation of the @type values. |
1215 | * @type contains the type of action. | 1229 | * @type contains the type of action. |
1216 | * Return 0 if permission is granted. | 1230 | * Return 0 if permission is granted. |
1217 | * @settime: | 1231 | * @settime: |
@@ -1223,22 +1237,22 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1223 | * @vm_enough_memory: | 1237 | * @vm_enough_memory: |
1224 | * Check permissions for allocating a new virtual mapping. | 1238 | * Check permissions for allocating a new virtual mapping. |
1225 | * @mm contains the mm struct it is being added to. | 1239 | * @mm contains the mm struct it is being added to. |
1226 | * @pages contains the number of pages. | 1240 | * @pages contains the number of pages. |
1227 | * Return 0 if permission is granted. | 1241 | * Return 0 if permission is granted. |
1228 | * | 1242 | * |
1229 | * @register_security: | 1243 | * @register_security: |
1230 | * allow module stacking. | 1244 | * allow module stacking. |
1231 | * @name contains the name of the security module being stacked. | 1245 | * @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. | 1246 | * @ops contains a pointer to the struct security_operations of the module to stack. |
1233 | * | 1247 | * |
1234 | * @secid_to_secctx: | 1248 | * @secid_to_secctx: |
1235 | * Convert secid to security context. | 1249 | * Convert secid to security context. |
1236 | * @secid contains the security ID. | 1250 | * @secid contains the security ID. |
1237 | * @secdata contains the pointer that stores the converted security context. | 1251 | * @secdata contains the pointer that stores the converted security context. |
1238 | * @secctx_to_secid: | 1252 | * @secctx_to_secid: |
1239 | * Convert security context to secid. | 1253 | * Convert security context to secid. |
1240 | * @secid contains the pointer to the generated security ID. | 1254 | * @secid contains the pointer to the generated security ID. |
1241 | * @secdata contains the security context. | 1255 | * @secdata contains the security context. |
1242 | * | 1256 | * |
1243 | * @release_secctx: | 1257 | * @release_secctx: |
1244 | * Release the security context. | 1258 | * Release the security context. |
@@ -1281,49 +1295,49 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1281 | struct security_operations { | 1295 | struct security_operations { |
1282 | char name[SECURITY_NAME_MAX + 1]; | 1296 | char name[SECURITY_NAME_MAX + 1]; |
1283 | 1297 | ||
1284 | int (*ptrace) (struct task_struct * parent, struct task_struct * child); | 1298 | int (*ptrace) (struct task_struct *parent, struct task_struct *child); |
1285 | int (*capget) (struct task_struct * target, | 1299 | int (*capget) (struct task_struct *target, |
1286 | kernel_cap_t * effective, | 1300 | kernel_cap_t *effective, |
1287 | kernel_cap_t * inheritable, kernel_cap_t * permitted); | 1301 | kernel_cap_t *inheritable, kernel_cap_t *permitted); |
1288 | int (*capset_check) (struct task_struct * target, | 1302 | int (*capset_check) (struct task_struct *target, |
1289 | kernel_cap_t * effective, | 1303 | kernel_cap_t *effective, |
1290 | kernel_cap_t * inheritable, | 1304 | kernel_cap_t *inheritable, |
1291 | kernel_cap_t * permitted); | 1305 | kernel_cap_t *permitted); |
1292 | void (*capset_set) (struct task_struct * target, | 1306 | void (*capset_set) (struct task_struct *target, |
1293 | kernel_cap_t * effective, | 1307 | kernel_cap_t *effective, |
1294 | kernel_cap_t * inheritable, | 1308 | kernel_cap_t *inheritable, |
1295 | kernel_cap_t * permitted); | 1309 | kernel_cap_t *permitted); |
1296 | int (*capable) (struct task_struct * tsk, int cap); | 1310 | int (*capable) (struct task_struct *tsk, int cap); |
1297 | int (*acct) (struct file * file); | 1311 | int (*acct) (struct file *file); |
1298 | int (*sysctl) (struct ctl_table * table, int op); | 1312 | int (*sysctl) (struct ctl_table *table, int op); |
1299 | int (*quotactl) (int cmds, int type, int id, struct super_block * sb); | 1313 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); |
1300 | int (*quota_on) (struct dentry * dentry); | 1314 | int (*quota_on) (struct dentry *dentry); |
1301 | int (*syslog) (int type); | 1315 | int (*syslog) (int type); |
1302 | int (*settime) (struct timespec *ts, struct timezone *tz); | 1316 | int (*settime) (struct timespec *ts, struct timezone *tz); |
1303 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); | 1317 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); |
1304 | 1318 | ||
1305 | int (*bprm_alloc_security) (struct linux_binprm * bprm); | 1319 | int (*bprm_alloc_security) (struct linux_binprm *bprm); |
1306 | void (*bprm_free_security) (struct linux_binprm * bprm); | 1320 | void (*bprm_free_security) (struct linux_binprm *bprm); |
1307 | void (*bprm_apply_creds) (struct linux_binprm * bprm, int unsafe); | 1321 | void (*bprm_apply_creds) (struct linux_binprm *bprm, int unsafe); |
1308 | void (*bprm_post_apply_creds) (struct linux_binprm * bprm); | 1322 | void (*bprm_post_apply_creds) (struct linux_binprm *bprm); |
1309 | int (*bprm_set_security) (struct linux_binprm * bprm); | 1323 | int (*bprm_set_security) (struct linux_binprm *bprm); |
1310 | int (*bprm_check_security) (struct linux_binprm * bprm); | 1324 | int (*bprm_check_security) (struct linux_binprm *bprm); |
1311 | int (*bprm_secureexec) (struct linux_binprm * bprm); | 1325 | int (*bprm_secureexec) (struct linux_binprm *bprm); |
1312 | 1326 | ||
1313 | int (*sb_alloc_security) (struct super_block * sb); | 1327 | int (*sb_alloc_security) (struct super_block *sb); |
1314 | void (*sb_free_security) (struct super_block * sb); | 1328 | void (*sb_free_security) (struct super_block *sb); |
1315 | int (*sb_copy_data)(char *orig, char *copy); | 1329 | int (*sb_copy_data) (char *orig, char *copy); |
1316 | int (*sb_kern_mount) (struct super_block *sb, void *data); | 1330 | int (*sb_kern_mount) (struct super_block *sb, void *data); |
1317 | int (*sb_statfs) (struct dentry *dentry); | 1331 | int (*sb_statfs) (struct dentry *dentry); |
1318 | int (*sb_mount) (char *dev_name, struct path *path, | 1332 | int (*sb_mount) (char *dev_name, struct path *path, |
1319 | char *type, unsigned long flags, void *data); | 1333 | char *type, unsigned long flags, void *data); |
1320 | int (*sb_check_sb) (struct vfsmount * mnt, struct path *path); | 1334 | int (*sb_check_sb) (struct vfsmount *mnt, struct path *path); |
1321 | int (*sb_umount) (struct vfsmount * mnt, int flags); | 1335 | int (*sb_umount) (struct vfsmount *mnt, int flags); |
1322 | void (*sb_umount_close) (struct vfsmount * mnt); | 1336 | void (*sb_umount_close) (struct vfsmount *mnt); |
1323 | void (*sb_umount_busy) (struct vfsmount * mnt); | 1337 | void (*sb_umount_busy) (struct vfsmount *mnt); |
1324 | void (*sb_post_remount) (struct vfsmount * mnt, | 1338 | void (*sb_post_remount) (struct vfsmount *mnt, |
1325 | unsigned long flags, void *data); | 1339 | unsigned long flags, void *data); |
1326 | void (*sb_post_addmount) (struct vfsmount * mnt, | 1340 | void (*sb_post_addmount) (struct vfsmount *mnt, |
1327 | struct path *mountpoint); | 1341 | struct path *mountpoint); |
1328 | int (*sb_pivotroot) (struct path *old_path, | 1342 | int (*sb_pivotroot) (struct path *old_path, |
1329 | struct path *new_path); | 1343 | struct path *new_path); |
@@ -1337,177 +1351,177 @@ struct security_operations { | |||
1337 | struct super_block *newsb); | 1351 | struct super_block *newsb); |
1338 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); | 1352 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); |
1339 | 1353 | ||
1340 | int (*inode_alloc_security) (struct inode *inode); | 1354 | int (*inode_alloc_security) (struct inode *inode); |
1341 | void (*inode_free_security) (struct inode *inode); | 1355 | void (*inode_free_security) (struct inode *inode); |
1342 | int (*inode_init_security) (struct inode *inode, struct inode *dir, | 1356 | int (*inode_init_security) (struct inode *inode, struct inode *dir, |
1343 | char **name, void **value, size_t *len); | 1357 | char **name, void **value, size_t *len); |
1344 | int (*inode_create) (struct inode *dir, | 1358 | int (*inode_create) (struct inode *dir, |
1345 | struct dentry *dentry, int mode); | 1359 | struct dentry *dentry, int mode); |
1346 | int (*inode_link) (struct dentry *old_dentry, | 1360 | int (*inode_link) (struct dentry *old_dentry, |
1347 | struct inode *dir, struct dentry *new_dentry); | 1361 | struct inode *dir, struct dentry *new_dentry); |
1348 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); | 1362 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); |
1349 | int (*inode_symlink) (struct inode *dir, | 1363 | int (*inode_symlink) (struct inode *dir, |
1350 | struct dentry *dentry, const char *old_name); | 1364 | struct dentry *dentry, const char *old_name); |
1351 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); | 1365 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); |
1352 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); | 1366 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); |
1353 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, | 1367 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, |
1354 | int mode, dev_t dev); | 1368 | int mode, dev_t dev); |
1355 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, | 1369 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, |
1356 | struct inode *new_dir, struct dentry *new_dentry); | 1370 | struct inode *new_dir, struct dentry *new_dentry); |
1357 | int (*inode_readlink) (struct dentry *dentry); | 1371 | int (*inode_readlink) (struct dentry *dentry); |
1358 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1372 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
1359 | int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); | 1373 | int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); |
1360 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); | 1374 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); |
1361 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); | 1375 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); |
1362 | void (*inode_delete) (struct inode *inode); | 1376 | void (*inode_delete) (struct inode *inode); |
1363 | int (*inode_setxattr) (struct dentry *dentry, char *name, void *value, | 1377 | int (*inode_setxattr) (struct dentry *dentry, const char *name, |
1364 | size_t size, int flags); | 1378 | const void *value, size_t size, int flags); |
1365 | void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value, | 1379 | void (*inode_post_setxattr) (struct dentry *dentry, const char *name, |
1366 | size_t size, int flags); | 1380 | const void *value, size_t size, int flags); |
1367 | int (*inode_getxattr) (struct dentry *dentry, char *name); | 1381 | int (*inode_getxattr) (struct dentry *dentry, const char *name); |
1368 | int (*inode_listxattr) (struct dentry *dentry); | 1382 | int (*inode_listxattr) (struct dentry *dentry); |
1369 | int (*inode_removexattr) (struct dentry *dentry, char *name); | 1383 | int (*inode_removexattr) (struct dentry *dentry, const char *name); |
1370 | int (*inode_need_killpriv) (struct dentry *dentry); | 1384 | int (*inode_need_killpriv) (struct dentry *dentry); |
1371 | int (*inode_killpriv) (struct dentry *dentry); | 1385 | int (*inode_killpriv) (struct dentry *dentry); |
1372 | int (*inode_getsecurity)(const struct inode *inode, const char *name, void **buffer, bool alloc); | 1386 | 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); | 1387 | 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); | 1388 | int (*inode_listsecurity) (struct inode *inode, char *buffer, size_t buffer_size); |
1375 | void (*inode_getsecid)(const struct inode *inode, u32 *secid); | 1389 | void (*inode_getsecid) (const struct inode *inode, u32 *secid); |
1376 | 1390 | ||
1377 | int (*file_permission) (struct file * file, int mask); | 1391 | int (*file_permission) (struct file *file, int mask); |
1378 | int (*file_alloc_security) (struct file * file); | 1392 | int (*file_alloc_security) (struct file *file); |
1379 | void (*file_free_security) (struct file * file); | 1393 | void (*file_free_security) (struct file *file); |
1380 | int (*file_ioctl) (struct file * file, unsigned int cmd, | 1394 | int (*file_ioctl) (struct file *file, unsigned int cmd, |
1381 | unsigned long arg); | 1395 | unsigned long arg); |
1382 | int (*file_mmap) (struct file * file, | 1396 | int (*file_mmap) (struct file *file, |
1383 | unsigned long reqprot, unsigned long prot, | 1397 | unsigned long reqprot, unsigned long prot, |
1384 | unsigned long flags, unsigned long addr, | 1398 | unsigned long flags, unsigned long addr, |
1385 | unsigned long addr_only); | 1399 | unsigned long addr_only); |
1386 | int (*file_mprotect) (struct vm_area_struct * vma, | 1400 | int (*file_mprotect) (struct vm_area_struct *vma, |
1387 | unsigned long reqprot, | 1401 | unsigned long reqprot, |
1388 | unsigned long prot); | 1402 | unsigned long prot); |
1389 | int (*file_lock) (struct file * file, unsigned int cmd); | 1403 | int (*file_lock) (struct file *file, unsigned int cmd); |
1390 | int (*file_fcntl) (struct file * file, unsigned int cmd, | 1404 | int (*file_fcntl) (struct file *file, unsigned int cmd, |
1391 | unsigned long arg); | 1405 | unsigned long arg); |
1392 | int (*file_set_fowner) (struct file * file); | 1406 | int (*file_set_fowner) (struct file *file); |
1393 | int (*file_send_sigiotask) (struct task_struct * tsk, | 1407 | int (*file_send_sigiotask) (struct task_struct *tsk, |
1394 | struct fown_struct * fown, int sig); | 1408 | struct fown_struct *fown, int sig); |
1395 | int (*file_receive) (struct file * file); | 1409 | int (*file_receive) (struct file *file); |
1396 | int (*dentry_open) (struct file *file); | 1410 | int (*dentry_open) (struct file *file); |
1397 | 1411 | ||
1398 | int (*task_create) (unsigned long clone_flags); | 1412 | int (*task_create) (unsigned long clone_flags); |
1399 | int (*task_alloc_security) (struct task_struct * p); | 1413 | int (*task_alloc_security) (struct task_struct *p); |
1400 | void (*task_free_security) (struct task_struct * p); | 1414 | void (*task_free_security) (struct task_struct *p); |
1401 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); | 1415 | 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 */ , | 1416 | int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ , |
1403 | uid_t old_euid, uid_t old_suid, int flags); | 1417 | 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); | 1418 | 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); | 1419 | int (*task_setpgid) (struct task_struct *p, pid_t pgid); |
1406 | int (*task_getpgid) (struct task_struct * p); | 1420 | int (*task_getpgid) (struct task_struct *p); |
1407 | int (*task_getsid) (struct task_struct * p); | 1421 | int (*task_getsid) (struct task_struct *p); |
1408 | void (*task_getsecid) (struct task_struct * p, u32 * secid); | 1422 | void (*task_getsecid) (struct task_struct *p, u32 *secid); |
1409 | int (*task_setgroups) (struct group_info *group_info); | 1423 | int (*task_setgroups) (struct group_info *group_info); |
1410 | int (*task_setnice) (struct task_struct * p, int nice); | 1424 | int (*task_setnice) (struct task_struct *p, int nice); |
1411 | int (*task_setioprio) (struct task_struct * p, int ioprio); | 1425 | int (*task_setioprio) (struct task_struct *p, int ioprio); |
1412 | int (*task_getioprio) (struct task_struct * p); | 1426 | int (*task_getioprio) (struct task_struct *p); |
1413 | int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); | 1427 | int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); |
1414 | int (*task_setscheduler) (struct task_struct * p, int policy, | 1428 | int (*task_setscheduler) (struct task_struct *p, int policy, |
1415 | struct sched_param * lp); | 1429 | struct sched_param *lp); |
1416 | int (*task_getscheduler) (struct task_struct * p); | 1430 | int (*task_getscheduler) (struct task_struct *p); |
1417 | int (*task_movememory) (struct task_struct * p); | 1431 | int (*task_movememory) (struct task_struct *p); |
1418 | int (*task_kill) (struct task_struct * p, | 1432 | int (*task_kill) (struct task_struct *p, |
1419 | struct siginfo * info, int sig, u32 secid); | 1433 | struct siginfo *info, int sig, u32 secid); |
1420 | int (*task_wait) (struct task_struct * p); | 1434 | int (*task_wait) (struct task_struct *p); |
1421 | int (*task_prctl) (int option, unsigned long arg2, | 1435 | int (*task_prctl) (int option, unsigned long arg2, |
1422 | unsigned long arg3, unsigned long arg4, | 1436 | unsigned long arg3, unsigned long arg4, |
1423 | unsigned long arg5); | 1437 | unsigned long arg5, long *rc_p); |
1424 | void (*task_reparent_to_init) (struct task_struct * p); | 1438 | void (*task_reparent_to_init) (struct task_struct *p); |
1425 | void (*task_to_inode)(struct task_struct *p, struct inode *inode); | 1439 | void (*task_to_inode) (struct task_struct *p, struct inode *inode); |
1426 | 1440 | ||
1427 | int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); | 1441 | int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag); |
1428 | void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid); | 1442 | void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid); |
1429 | 1443 | ||
1430 | int (*msg_msg_alloc_security) (struct msg_msg * msg); | 1444 | int (*msg_msg_alloc_security) (struct msg_msg *msg); |
1431 | void (*msg_msg_free_security) (struct msg_msg * msg); | 1445 | void (*msg_msg_free_security) (struct msg_msg *msg); |
1432 | 1446 | ||
1433 | int (*msg_queue_alloc_security) (struct msg_queue * msq); | 1447 | int (*msg_queue_alloc_security) (struct msg_queue *msq); |
1434 | void (*msg_queue_free_security) (struct msg_queue * msq); | 1448 | void (*msg_queue_free_security) (struct msg_queue *msq); |
1435 | int (*msg_queue_associate) (struct msg_queue * msq, int msqflg); | 1449 | int (*msg_queue_associate) (struct msg_queue *msq, int msqflg); |
1436 | int (*msg_queue_msgctl) (struct msg_queue * msq, int cmd); | 1450 | int (*msg_queue_msgctl) (struct msg_queue *msq, int cmd); |
1437 | int (*msg_queue_msgsnd) (struct msg_queue * msq, | 1451 | int (*msg_queue_msgsnd) (struct msg_queue *msq, |
1438 | struct msg_msg * msg, int msqflg); | 1452 | struct msg_msg *msg, int msqflg); |
1439 | int (*msg_queue_msgrcv) (struct msg_queue * msq, | 1453 | int (*msg_queue_msgrcv) (struct msg_queue *msq, |
1440 | struct msg_msg * msg, | 1454 | struct msg_msg *msg, |
1441 | struct task_struct * target, | 1455 | struct task_struct *target, |
1442 | long type, int mode); | 1456 | long type, int mode); |
1443 | 1457 | ||
1444 | int (*shm_alloc_security) (struct shmid_kernel * shp); | 1458 | int (*shm_alloc_security) (struct shmid_kernel *shp); |
1445 | void (*shm_free_security) (struct shmid_kernel * shp); | 1459 | void (*shm_free_security) (struct shmid_kernel *shp); |
1446 | int (*shm_associate) (struct shmid_kernel * shp, int shmflg); | 1460 | int (*shm_associate) (struct shmid_kernel *shp, int shmflg); |
1447 | int (*shm_shmctl) (struct shmid_kernel * shp, int cmd); | 1461 | int (*shm_shmctl) (struct shmid_kernel *shp, int cmd); |
1448 | int (*shm_shmat) (struct shmid_kernel * shp, | 1462 | int (*shm_shmat) (struct shmid_kernel *shp, |
1449 | char __user *shmaddr, int shmflg); | 1463 | char __user *shmaddr, int shmflg); |
1450 | 1464 | ||
1451 | int (*sem_alloc_security) (struct sem_array * sma); | 1465 | int (*sem_alloc_security) (struct sem_array *sma); |
1452 | void (*sem_free_security) (struct sem_array * sma); | 1466 | void (*sem_free_security) (struct sem_array *sma); |
1453 | int (*sem_associate) (struct sem_array * sma, int semflg); | 1467 | int (*sem_associate) (struct sem_array *sma, int semflg); |
1454 | int (*sem_semctl) (struct sem_array * sma, int cmd); | 1468 | int (*sem_semctl) (struct sem_array *sma, int cmd); |
1455 | int (*sem_semop) (struct sem_array * sma, | 1469 | int (*sem_semop) (struct sem_array *sma, |
1456 | struct sembuf * sops, unsigned nsops, int alter); | 1470 | struct sembuf *sops, unsigned nsops, int alter); |
1457 | 1471 | ||
1458 | int (*netlink_send) (struct sock * sk, struct sk_buff * skb); | 1472 | int (*netlink_send) (struct sock *sk, struct sk_buff *skb); |
1459 | int (*netlink_recv) (struct sk_buff * skb, int cap); | 1473 | int (*netlink_recv) (struct sk_buff *skb, int cap); |
1460 | 1474 | ||
1461 | /* allow module stacking */ | 1475 | /* allow module stacking */ |
1462 | int (*register_security) (const char *name, | 1476 | int (*register_security) (const char *name, |
1463 | struct security_operations *ops); | 1477 | struct security_operations *ops); |
1464 | 1478 | ||
1465 | void (*d_instantiate) (struct dentry *dentry, struct inode *inode); | 1479 | void (*d_instantiate) (struct dentry *dentry, struct inode *inode); |
1466 | 1480 | ||
1467 | int (*getprocattr)(struct task_struct *p, char *name, char **value); | 1481 | int (*getprocattr) (struct task_struct *p, char *name, char **value); |
1468 | int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); | 1482 | int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); |
1469 | int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); | 1483 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); |
1470 | int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid); | 1484 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); |
1471 | void (*release_secctx)(char *secdata, u32 seclen); | 1485 | void (*release_secctx) (char *secdata, u32 seclen); |
1472 | 1486 | ||
1473 | #ifdef CONFIG_SECURITY_NETWORK | 1487 | #ifdef CONFIG_SECURITY_NETWORK |
1474 | int (*unix_stream_connect) (struct socket * sock, | 1488 | int (*unix_stream_connect) (struct socket *sock, |
1475 | struct socket * other, struct sock * newsk); | 1489 | struct socket *other, struct sock *newsk); |
1476 | int (*unix_may_send) (struct socket * sock, struct socket * other); | 1490 | int (*unix_may_send) (struct socket *sock, struct socket *other); |
1477 | 1491 | ||
1478 | int (*socket_create) (int family, int type, int protocol, int kern); | 1492 | int (*socket_create) (int family, int type, int protocol, int kern); |
1479 | int (*socket_post_create) (struct socket * sock, int family, | 1493 | int (*socket_post_create) (struct socket *sock, int family, |
1480 | int type, int protocol, int kern); | 1494 | int type, int protocol, int kern); |
1481 | int (*socket_bind) (struct socket * sock, | 1495 | int (*socket_bind) (struct socket *sock, |
1482 | struct sockaddr * address, int addrlen); | 1496 | struct sockaddr *address, int addrlen); |
1483 | int (*socket_connect) (struct socket * sock, | 1497 | int (*socket_connect) (struct socket *sock, |
1484 | struct sockaddr * address, int addrlen); | 1498 | struct sockaddr *address, int addrlen); |
1485 | int (*socket_listen) (struct socket * sock, int backlog); | 1499 | int (*socket_listen) (struct socket *sock, int backlog); |
1486 | int (*socket_accept) (struct socket * sock, struct socket * newsock); | 1500 | int (*socket_accept) (struct socket *sock, struct socket *newsock); |
1487 | void (*socket_post_accept) (struct socket * sock, | 1501 | void (*socket_post_accept) (struct socket *sock, |
1488 | struct socket * newsock); | 1502 | struct socket *newsock); |
1489 | int (*socket_sendmsg) (struct socket * sock, | 1503 | int (*socket_sendmsg) (struct socket *sock, |
1490 | struct msghdr * msg, int size); | 1504 | struct msghdr *msg, int size); |
1491 | int (*socket_recvmsg) (struct socket * sock, | 1505 | int (*socket_recvmsg) (struct socket *sock, |
1492 | struct msghdr * msg, int size, int flags); | 1506 | struct msghdr *msg, int size, int flags); |
1493 | int (*socket_getsockname) (struct socket * sock); | 1507 | int (*socket_getsockname) (struct socket *sock); |
1494 | int (*socket_getpeername) (struct socket * sock); | 1508 | int (*socket_getpeername) (struct socket *sock); |
1495 | int (*socket_getsockopt) (struct socket * sock, int level, int optname); | 1509 | int (*socket_getsockopt) (struct socket *sock, int level, int optname); |
1496 | int (*socket_setsockopt) (struct socket * sock, int level, int optname); | 1510 | int (*socket_setsockopt) (struct socket *sock, int level, int optname); |
1497 | int (*socket_shutdown) (struct socket * sock, int how); | 1511 | int (*socket_shutdown) (struct socket *sock, int how); |
1498 | int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); | 1512 | 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); | 1513 | 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); | 1514 | 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); | 1515 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); |
1502 | void (*sk_free_security) (struct sock *sk); | 1516 | void (*sk_free_security) (struct sock *sk); |
1503 | void (*sk_clone_security) (const struct sock *sk, struct sock *newsk); | 1517 | void (*sk_clone_security) (const struct sock *sk, struct sock *newsk); |
1504 | void (*sk_getsecid) (struct sock *sk, u32 *secid); | 1518 | void (*sk_getsecid) (struct sock *sk, u32 *secid); |
1505 | void (*sock_graft)(struct sock* sk, struct socket *parent); | 1519 | void (*sock_graft) (struct sock *sk, struct socket *parent); |
1506 | int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, | 1520 | int (*inet_conn_request) (struct sock *sk, struct sk_buff *skb, |
1507 | struct request_sock *req); | 1521 | struct request_sock *req); |
1508 | void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); | 1522 | void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); |
1509 | void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb); | 1523 | void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); |
1510 | void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); | 1524 | void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); |
1511 | #endif /* CONFIG_SECURITY_NETWORK */ | 1525 | #endif /* CONFIG_SECURITY_NETWORK */ |
1512 | 1526 | ||
1513 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1527 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
@@ -1521,57 +1535,57 @@ struct security_operations { | |||
1521 | u32 secid); | 1535 | u32 secid); |
1522 | void (*xfrm_state_free_security) (struct xfrm_state *x); | 1536 | void (*xfrm_state_free_security) (struct xfrm_state *x); |
1523 | int (*xfrm_state_delete_security) (struct xfrm_state *x); | 1537 | int (*xfrm_state_delete_security) (struct xfrm_state *x); |
1524 | int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); | 1538 | 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, | 1539 | int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, |
1526 | struct xfrm_policy *xp, struct flowi *fl); | 1540 | struct xfrm_policy *xp, |
1527 | int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); | 1541 | struct flowi *fl); |
1542 | int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); | ||
1528 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | 1543 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
1529 | 1544 | ||
1530 | /* key management security hooks */ | 1545 | /* key management security hooks */ |
1531 | #ifdef CONFIG_KEYS | 1546 | #ifdef CONFIG_KEYS |
1532 | int (*key_alloc)(struct key *key, struct task_struct *tsk, unsigned long flags); | 1547 | int (*key_alloc) (struct key *key, struct task_struct *tsk, unsigned long flags); |
1533 | void (*key_free)(struct key *key); | 1548 | void (*key_free) (struct key *key); |
1534 | int (*key_permission)(key_ref_t key_ref, | 1549 | int (*key_permission) (key_ref_t key_ref, |
1535 | struct task_struct *context, | 1550 | struct task_struct *context, |
1536 | key_perm_t perm); | 1551 | key_perm_t perm); |
1537 | 1552 | int (*key_getsecurity)(struct key *key, char **_buffer); | |
1538 | #endif /* CONFIG_KEYS */ | 1553 | #endif /* CONFIG_KEYS */ |
1539 | 1554 | ||
1540 | #ifdef CONFIG_AUDIT | 1555 | #ifdef CONFIG_AUDIT |
1541 | int (*audit_rule_init)(u32 field, u32 op, char *rulestr, void **lsmrule); | 1556 | int (*audit_rule_init) (u32 field, u32 op, char *rulestr, void **lsmrule); |
1542 | int (*audit_rule_known)(struct audit_krule *krule); | 1557 | int (*audit_rule_known) (struct audit_krule *krule); |
1543 | int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule, | 1558 | int (*audit_rule_match) (u32 secid, u32 field, u32 op, void *lsmrule, |
1544 | struct audit_context *actx); | 1559 | struct audit_context *actx); |
1545 | void (*audit_rule_free)(void *lsmrule); | 1560 | void (*audit_rule_free) (void *lsmrule); |
1546 | #endif /* CONFIG_AUDIT */ | 1561 | #endif /* CONFIG_AUDIT */ |
1547 | }; | 1562 | }; |
1548 | 1563 | ||
1549 | /* prototypes */ | 1564 | /* prototypes */ |
1550 | extern int security_init (void); | 1565 | extern int security_init(void); |
1551 | extern int security_module_enable(struct security_operations *ops); | 1566 | extern int security_module_enable(struct security_operations *ops); |
1552 | extern int register_security (struct security_operations *ops); | 1567 | extern int register_security(struct security_operations *ops); |
1553 | extern int mod_reg_security (const char *name, struct security_operations *ops); | 1568 | extern int mod_reg_security(const char *name, struct security_operations *ops); |
1554 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, | 1569 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, |
1555 | struct dentry *parent, void *data, | 1570 | struct dentry *parent, void *data, |
1556 | const struct file_operations *fops); | 1571 | const struct file_operations *fops); |
1557 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); | 1572 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); |
1558 | extern void securityfs_remove(struct dentry *dentry); | 1573 | extern void securityfs_remove(struct dentry *dentry); |
1559 | 1574 | ||
1560 | |||
1561 | /* Security operations */ | 1575 | /* Security operations */ |
1562 | int security_ptrace(struct task_struct *parent, struct task_struct *child); | 1576 | int security_ptrace(struct task_struct *parent, struct task_struct *child); |
1563 | int security_capget(struct task_struct *target, | 1577 | int security_capget(struct task_struct *target, |
1564 | kernel_cap_t *effective, | 1578 | kernel_cap_t *effective, |
1565 | kernel_cap_t *inheritable, | 1579 | kernel_cap_t *inheritable, |
1566 | kernel_cap_t *permitted); | 1580 | kernel_cap_t *permitted); |
1567 | int security_capset_check(struct task_struct *target, | 1581 | int security_capset_check(struct task_struct *target, |
1568 | kernel_cap_t *effective, | ||
1569 | kernel_cap_t *inheritable, | ||
1570 | kernel_cap_t *permitted); | ||
1571 | void security_capset_set(struct task_struct *target, | ||
1572 | kernel_cap_t *effective, | 1582 | kernel_cap_t *effective, |
1573 | kernel_cap_t *inheritable, | 1583 | kernel_cap_t *inheritable, |
1574 | kernel_cap_t *permitted); | 1584 | kernel_cap_t *permitted); |
1585 | void security_capset_set(struct task_struct *target, | ||
1586 | kernel_cap_t *effective, | ||
1587 | kernel_cap_t *inheritable, | ||
1588 | kernel_cap_t *permitted); | ||
1575 | int security_capable(struct task_struct *tsk, int cap); | 1589 | int security_capable(struct task_struct *tsk, int cap); |
1576 | int security_acct(struct file *file); | 1590 | int security_acct(struct file *file); |
1577 | int security_sysctl(struct ctl_table *table, int op); | 1591 | int security_sysctl(struct ctl_table *table, int op); |
@@ -1594,7 +1608,7 @@ int security_sb_copy_data(char *orig, char *copy); | |||
1594 | int security_sb_kern_mount(struct super_block *sb, void *data); | 1608 | int security_sb_kern_mount(struct super_block *sb, void *data); |
1595 | int security_sb_statfs(struct dentry *dentry); | 1609 | int security_sb_statfs(struct dentry *dentry); |
1596 | int security_sb_mount(char *dev_name, struct path *path, | 1610 | int security_sb_mount(char *dev_name, struct path *path, |
1597 | char *type, unsigned long flags, void *data); | 1611 | char *type, unsigned long flags, void *data); |
1598 | int security_sb_check_sb(struct vfsmount *mnt, struct path *path); | 1612 | int security_sb_check_sb(struct vfsmount *mnt, struct path *path); |
1599 | int security_sb_umount(struct vfsmount *mnt, int flags); | 1613 | int security_sb_umount(struct vfsmount *mnt, int flags); |
1600 | void security_sb_umount_close(struct vfsmount *mnt); | 1614 | void security_sb_umount_close(struct vfsmount *mnt); |
@@ -1619,25 +1633,25 @@ int security_inode_link(struct dentry *old_dentry, struct inode *dir, | |||
1619 | struct dentry *new_dentry); | 1633 | struct dentry *new_dentry); |
1620 | int security_inode_unlink(struct inode *dir, struct dentry *dentry); | 1634 | int security_inode_unlink(struct inode *dir, struct dentry *dentry); |
1621 | int security_inode_symlink(struct inode *dir, struct dentry *dentry, | 1635 | int security_inode_symlink(struct inode *dir, struct dentry *dentry, |
1622 | const char *old_name); | 1636 | const char *old_name); |
1623 | int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 1637 | int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); |
1624 | int security_inode_rmdir(struct inode *dir, struct dentry *dentry); | 1638 | int security_inode_rmdir(struct inode *dir, struct dentry *dentry); |
1625 | int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); | 1639 | int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); |
1626 | int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, | 1640 | int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, |
1627 | struct inode *new_dir, struct dentry *new_dentry); | 1641 | struct inode *new_dir, struct dentry *new_dentry); |
1628 | int security_inode_readlink(struct dentry *dentry); | 1642 | int security_inode_readlink(struct dentry *dentry); |
1629 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); | 1643 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); |
1630 | int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd); | 1644 | int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd); |
1631 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); | 1645 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); |
1632 | int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); | 1646 | int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); |
1633 | void security_inode_delete(struct inode *inode); | 1647 | void security_inode_delete(struct inode *inode); |
1634 | int security_inode_setxattr(struct dentry *dentry, char *name, | 1648 | int security_inode_setxattr(struct dentry *dentry, const char *name, |
1635 | void *value, size_t size, int flags); | 1649 | const void *value, size_t size, int flags); |
1636 | void security_inode_post_setxattr(struct dentry *dentry, char *name, | 1650 | void security_inode_post_setxattr(struct dentry *dentry, const char *name, |
1637 | void *value, size_t size, int flags); | 1651 | const void *value, size_t size, int flags); |
1638 | int security_inode_getxattr(struct dentry *dentry, char *name); | 1652 | int security_inode_getxattr(struct dentry *dentry, const char *name); |
1639 | int security_inode_listxattr(struct dentry *dentry); | 1653 | int security_inode_listxattr(struct dentry *dentry); |
1640 | int security_inode_removexattr(struct dentry *dentry, char *name); | 1654 | int security_inode_removexattr(struct dentry *dentry, const char *name); |
1641 | int security_inode_need_killpriv(struct dentry *dentry); | 1655 | int security_inode_need_killpriv(struct dentry *dentry); |
1642 | int security_inode_killpriv(struct dentry *dentry); | 1656 | int security_inode_killpriv(struct dentry *dentry); |
1643 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); | 1657 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); |
@@ -1652,12 +1666,12 @@ int security_file_mmap(struct file *file, unsigned long reqprot, | |||
1652 | unsigned long prot, unsigned long flags, | 1666 | unsigned long prot, unsigned long flags, |
1653 | unsigned long addr, unsigned long addr_only); | 1667 | unsigned long addr, unsigned long addr_only); |
1654 | int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, | 1668 | int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, |
1655 | unsigned long prot); | 1669 | unsigned long prot); |
1656 | int security_file_lock(struct file *file, unsigned int cmd); | 1670 | int security_file_lock(struct file *file, unsigned int cmd); |
1657 | int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); | 1671 | int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); |
1658 | int security_file_set_fowner(struct file *file); | 1672 | int security_file_set_fowner(struct file *file); |
1659 | int security_file_send_sigiotask(struct task_struct *tsk, | 1673 | int security_file_send_sigiotask(struct task_struct *tsk, |
1660 | struct fown_struct *fown, int sig); | 1674 | struct fown_struct *fown, int sig); |
1661 | int security_file_receive(struct file *file); | 1675 | int security_file_receive(struct file *file); |
1662 | int security_dentry_open(struct file *file); | 1676 | int security_dentry_open(struct file *file); |
1663 | int security_task_create(unsigned long clone_flags); | 1677 | int security_task_create(unsigned long clone_flags); |
@@ -1665,7 +1679,7 @@ int security_task_alloc(struct task_struct *p); | |||
1665 | void security_task_free(struct task_struct *p); | 1679 | void security_task_free(struct task_struct *p); |
1666 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); | 1680 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); |
1667 | int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, | 1681 | int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, |
1668 | uid_t old_suid, int flags); | 1682 | uid_t old_suid, int flags); |
1669 | int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); | 1683 | int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); |
1670 | int security_task_setpgid(struct task_struct *p, pid_t pgid); | 1684 | int security_task_setpgid(struct task_struct *p, pid_t pgid); |
1671 | int security_task_getpgid(struct task_struct *p); | 1685 | int security_task_getpgid(struct task_struct *p); |
@@ -1684,7 +1698,7 @@ int security_task_kill(struct task_struct *p, struct siginfo *info, | |||
1684 | int sig, u32 secid); | 1698 | int sig, u32 secid); |
1685 | int security_task_wait(struct task_struct *p); | 1699 | int security_task_wait(struct task_struct *p); |
1686 | int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, | 1700 | int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
1687 | unsigned long arg4, unsigned long arg5); | 1701 | unsigned long arg4, unsigned long arg5, long *rc_p); |
1688 | void security_task_reparent_to_init(struct task_struct *p); | 1702 | void security_task_reparent_to_init(struct task_struct *p); |
1689 | void security_task_to_inode(struct task_struct *p, struct inode *inode); | 1703 | void security_task_to_inode(struct task_struct *p, struct inode *inode); |
1690 | int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); | 1704 | int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); |
@@ -1696,9 +1710,9 @@ void security_msg_queue_free(struct msg_queue *msq); | |||
1696 | int security_msg_queue_associate(struct msg_queue *msq, int msqflg); | 1710 | int security_msg_queue_associate(struct msg_queue *msq, int msqflg); |
1697 | int security_msg_queue_msgctl(struct msg_queue *msq, int cmd); | 1711 | int security_msg_queue_msgctl(struct msg_queue *msq, int cmd); |
1698 | int security_msg_queue_msgsnd(struct msg_queue *msq, | 1712 | int security_msg_queue_msgsnd(struct msg_queue *msq, |
1699 | struct msg_msg *msg, int msqflg); | 1713 | struct msg_msg *msg, int msqflg); |
1700 | int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, | 1714 | int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, |
1701 | struct task_struct *target, long type, int mode); | 1715 | struct task_struct *target, long type, int mode); |
1702 | int security_shm_alloc(struct shmid_kernel *shp); | 1716 | int security_shm_alloc(struct shmid_kernel *shp); |
1703 | void security_shm_free(struct shmid_kernel *shp); | 1717 | void security_shm_free(struct shmid_kernel *shp); |
1704 | int security_shm_associate(struct shmid_kernel *shp, int shmflg); | 1718 | int security_shm_associate(struct shmid_kernel *shp, int shmflg); |
@@ -1710,13 +1724,13 @@ int security_sem_associate(struct sem_array *sma, int semflg); | |||
1710 | int security_sem_semctl(struct sem_array *sma, int cmd); | 1724 | int security_sem_semctl(struct sem_array *sma, int cmd); |
1711 | int security_sem_semop(struct sem_array *sma, struct sembuf *sops, | 1725 | int security_sem_semop(struct sem_array *sma, struct sembuf *sops, |
1712 | unsigned nsops, int alter); | 1726 | unsigned nsops, int alter); |
1713 | void security_d_instantiate (struct dentry *dentry, struct inode *inode); | 1727 | void security_d_instantiate(struct dentry *dentry, struct inode *inode); |
1714 | int security_getprocattr(struct task_struct *p, char *name, char **value); | 1728 | int security_getprocattr(struct task_struct *p, char *name, char **value); |
1715 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); | 1729 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); |
1716 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); | 1730 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); |
1717 | int security_netlink_recv(struct sk_buff *skb, int cap); | 1731 | int security_netlink_recv(struct sk_buff *skb, int cap); |
1718 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | 1732 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); |
1719 | int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid); | 1733 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
1720 | void security_release_secctx(char *secdata, u32 seclen); | 1734 | void security_release_secctx(char *secdata, u32 seclen); |
1721 | 1735 | ||
1722 | #else /* CONFIG_SECURITY */ | 1736 | #else /* CONFIG_SECURITY */ |
@@ -1741,33 +1755,33 @@ static inline int security_init(void) | |||
1741 | return 0; | 1755 | return 0; |
1742 | } | 1756 | } |
1743 | 1757 | ||
1744 | static inline int security_ptrace (struct task_struct *parent, struct task_struct * child) | 1758 | static inline int security_ptrace(struct task_struct *parent, struct task_struct *child) |
1745 | { | 1759 | { |
1746 | return cap_ptrace (parent, child); | 1760 | return cap_ptrace(parent, child); |
1747 | } | 1761 | } |
1748 | 1762 | ||
1749 | static inline int security_capget (struct task_struct *target, | 1763 | static inline int security_capget(struct task_struct *target, |
1750 | kernel_cap_t *effective, | 1764 | kernel_cap_t *effective, |
1751 | kernel_cap_t *inheritable, | 1765 | kernel_cap_t *inheritable, |
1752 | kernel_cap_t *permitted) | 1766 | kernel_cap_t *permitted) |
1753 | { | 1767 | { |
1754 | return cap_capget (target, effective, inheritable, permitted); | 1768 | return cap_capget(target, effective, inheritable, permitted); |
1755 | } | 1769 | } |
1756 | 1770 | ||
1757 | static inline int security_capset_check (struct task_struct *target, | 1771 | static inline int security_capset_check(struct task_struct *target, |
1758 | kernel_cap_t *effective, | 1772 | kernel_cap_t *effective, |
1759 | kernel_cap_t *inheritable, | 1773 | kernel_cap_t *inheritable, |
1760 | kernel_cap_t *permitted) | 1774 | kernel_cap_t *permitted) |
1761 | { | 1775 | { |
1762 | return cap_capset_check (target, effective, inheritable, permitted); | 1776 | return cap_capset_check(target, effective, inheritable, permitted); |
1763 | } | 1777 | } |
1764 | 1778 | ||
1765 | static inline void security_capset_set (struct task_struct *target, | 1779 | static inline void security_capset_set(struct task_struct *target, |
1766 | kernel_cap_t *effective, | 1780 | kernel_cap_t *effective, |
1767 | kernel_cap_t *inheritable, | 1781 | kernel_cap_t *inheritable, |
1768 | kernel_cap_t *permitted) | 1782 | kernel_cap_t *permitted) |
1769 | { | 1783 | { |
1770 | cap_capset_set (target, effective, inheritable, permitted); | 1784 | cap_capset_set(target, effective, inheritable, permitted); |
1771 | } | 1785 | } |
1772 | 1786 | ||
1773 | static inline int security_capable(struct task_struct *tsk, int cap) | 1787 | static inline int security_capable(struct task_struct *tsk, int cap) |
@@ -1775,7 +1789,7 @@ static inline int security_capable(struct task_struct *tsk, int cap) | |||
1775 | return cap_capable(tsk, cap); | 1789 | return cap_capable(tsk, cap); |
1776 | } | 1790 | } |
1777 | 1791 | ||
1778 | static inline int security_acct (struct file *file) | 1792 | static inline int security_acct(struct file *file) |
1779 | { | 1793 | { |
1780 | return 0; | 1794 | return 0; |
1781 | } | 1795 | } |
@@ -1785,13 +1799,13 @@ static inline int security_sysctl(struct ctl_table *table, int op) | |||
1785 | return 0; | 1799 | return 0; |
1786 | } | 1800 | } |
1787 | 1801 | ||
1788 | static inline int security_quotactl (int cmds, int type, int id, | 1802 | static inline int security_quotactl(int cmds, int type, int id, |
1789 | struct super_block * sb) | 1803 | struct super_block *sb) |
1790 | { | 1804 | { |
1791 | return 0; | 1805 | return 0; |
1792 | } | 1806 | } |
1793 | 1807 | ||
1794 | static inline int security_quota_on (struct dentry * dentry) | 1808 | static inline int security_quota_on(struct dentry *dentry) |
1795 | { | 1809 | { |
1796 | return 0; | 1810 | return 0; |
1797 | } | 1811 | } |
@@ -1816,102 +1830,102 @@ static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) | |||
1816 | return cap_vm_enough_memory(mm, pages); | 1830 | return cap_vm_enough_memory(mm, pages); |
1817 | } | 1831 | } |
1818 | 1832 | ||
1819 | static inline int security_bprm_alloc (struct linux_binprm *bprm) | 1833 | static inline int security_bprm_alloc(struct linux_binprm *bprm) |
1820 | { | 1834 | { |
1821 | return 0; | 1835 | return 0; |
1822 | } | 1836 | } |
1823 | 1837 | ||
1824 | static inline void security_bprm_free (struct linux_binprm *bprm) | 1838 | static inline void security_bprm_free(struct linux_binprm *bprm) |
1825 | { } | 1839 | { } |
1826 | 1840 | ||
1827 | static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe) | 1841 | static inline void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe) |
1828 | { | 1842 | { |
1829 | cap_bprm_apply_creds (bprm, unsafe); | 1843 | cap_bprm_apply_creds(bprm, unsafe); |
1830 | } | 1844 | } |
1831 | 1845 | ||
1832 | static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm) | 1846 | static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm) |
1833 | { | 1847 | { |
1834 | return; | 1848 | return; |
1835 | } | 1849 | } |
1836 | 1850 | ||
1837 | static inline int security_bprm_set (struct linux_binprm *bprm) | 1851 | static inline int security_bprm_set(struct linux_binprm *bprm) |
1838 | { | 1852 | { |
1839 | return cap_bprm_set_security (bprm); | 1853 | return cap_bprm_set_security(bprm); |
1840 | } | 1854 | } |
1841 | 1855 | ||
1842 | static inline int security_bprm_check (struct linux_binprm *bprm) | 1856 | static inline int security_bprm_check(struct linux_binprm *bprm) |
1843 | { | 1857 | { |
1844 | return 0; | 1858 | return 0; |
1845 | } | 1859 | } |
1846 | 1860 | ||
1847 | static inline int security_bprm_secureexec (struct linux_binprm *bprm) | 1861 | static inline int security_bprm_secureexec(struct linux_binprm *bprm) |
1848 | { | 1862 | { |
1849 | return cap_bprm_secureexec(bprm); | 1863 | return cap_bprm_secureexec(bprm); |
1850 | } | 1864 | } |
1851 | 1865 | ||
1852 | static inline int security_sb_alloc (struct super_block *sb) | 1866 | static inline int security_sb_alloc(struct super_block *sb) |
1853 | { | 1867 | { |
1854 | return 0; | 1868 | return 0; |
1855 | } | 1869 | } |
1856 | 1870 | ||
1857 | static inline void security_sb_free (struct super_block *sb) | 1871 | static inline void security_sb_free(struct super_block *sb) |
1858 | { } | 1872 | { } |
1859 | 1873 | ||
1860 | static inline int security_sb_copy_data (char *orig, char *copy) | 1874 | static inline int security_sb_copy_data(char *orig, char *copy) |
1861 | { | 1875 | { |
1862 | return 0; | 1876 | return 0; |
1863 | } | 1877 | } |
1864 | 1878 | ||
1865 | static inline int security_sb_kern_mount (struct super_block *sb, void *data) | 1879 | static inline int security_sb_kern_mount(struct super_block *sb, void *data) |
1866 | { | 1880 | { |
1867 | return 0; | 1881 | return 0; |
1868 | } | 1882 | } |
1869 | 1883 | ||
1870 | static inline int security_sb_statfs (struct dentry *dentry) | 1884 | static inline int security_sb_statfs(struct dentry *dentry) |
1871 | { | 1885 | { |
1872 | return 0; | 1886 | return 0; |
1873 | } | 1887 | } |
1874 | 1888 | ||
1875 | static inline int security_sb_mount (char *dev_name, struct path *path, | 1889 | static inline int security_sb_mount(char *dev_name, struct path *path, |
1876 | char *type, unsigned long flags, | 1890 | char *type, unsigned long flags, |
1877 | void *data) | 1891 | void *data) |
1878 | { | 1892 | { |
1879 | return 0; | 1893 | return 0; |
1880 | } | 1894 | } |
1881 | 1895 | ||
1882 | static inline int security_sb_check_sb (struct vfsmount *mnt, | 1896 | static inline int security_sb_check_sb(struct vfsmount *mnt, |
1883 | struct path *path) | 1897 | struct path *path) |
1884 | { | 1898 | { |
1885 | return 0; | 1899 | return 0; |
1886 | } | 1900 | } |
1887 | 1901 | ||
1888 | static inline int security_sb_umount (struct vfsmount *mnt, int flags) | 1902 | static inline int security_sb_umount(struct vfsmount *mnt, int flags) |
1889 | { | 1903 | { |
1890 | return 0; | 1904 | return 0; |
1891 | } | 1905 | } |
1892 | 1906 | ||
1893 | static inline void security_sb_umount_close (struct vfsmount *mnt) | 1907 | static inline void security_sb_umount_close(struct vfsmount *mnt) |
1894 | { } | 1908 | { } |
1895 | 1909 | ||
1896 | static inline void security_sb_umount_busy (struct vfsmount *mnt) | 1910 | static inline void security_sb_umount_busy(struct vfsmount *mnt) |
1897 | { } | 1911 | { } |
1898 | 1912 | ||
1899 | static inline void security_sb_post_remount (struct vfsmount *mnt, | 1913 | static inline void security_sb_post_remount(struct vfsmount *mnt, |
1900 | unsigned long flags, void *data) | 1914 | unsigned long flags, void *data) |
1901 | { } | 1915 | { } |
1902 | 1916 | ||
1903 | static inline void security_sb_post_addmount (struct vfsmount *mnt, | 1917 | static inline void security_sb_post_addmount(struct vfsmount *mnt, |
1904 | struct path *mountpoint) | 1918 | struct path *mountpoint) |
1905 | { } | 1919 | { } |
1906 | 1920 | ||
1907 | static inline int security_sb_pivotroot (struct path *old_path, | 1921 | static inline int security_sb_pivotroot(struct path *old_path, |
1908 | struct path *new_path) | 1922 | struct path *new_path) |
1909 | { | 1923 | { |
1910 | return 0; | 1924 | return 0; |
1911 | } | 1925 | } |
1912 | 1926 | ||
1913 | static inline void security_sb_post_pivotroot (struct path *old_path, | 1927 | static inline void security_sb_post_pivotroot(struct path *old_path, |
1914 | struct path *new_path) | 1928 | struct path *new_path) |
1915 | { } | 1929 | { } |
1916 | static inline int security_sb_get_mnt_opts(const struct super_block *sb, | 1930 | static inline int security_sb_get_mnt_opts(const struct super_block *sb, |
1917 | struct security_mnt_opts *opts) | 1931 | struct security_mnt_opts *opts) |
@@ -1935,15 +1949,15 @@ static inline int security_sb_parse_opts_str(char *options, struct security_mnt_ | |||
1935 | return 0; | 1949 | return 0; |
1936 | } | 1950 | } |
1937 | 1951 | ||
1938 | static inline int security_inode_alloc (struct inode *inode) | 1952 | static inline int security_inode_alloc(struct inode *inode) |
1939 | { | 1953 | { |
1940 | return 0; | 1954 | return 0; |
1941 | } | 1955 | } |
1942 | 1956 | ||
1943 | static inline void security_inode_free (struct inode *inode) | 1957 | static inline void security_inode_free(struct inode *inode) |
1944 | { } | 1958 | { } |
1945 | 1959 | ||
1946 | static inline int security_inode_init_security (struct inode *inode, | 1960 | static inline int security_inode_init_security(struct inode *inode, |
1947 | struct inode *dir, | 1961 | struct inode *dir, |
1948 | char **name, | 1962 | char **name, |
1949 | void **value, | 1963 | void **value, |
@@ -1951,55 +1965,55 @@ static inline int security_inode_init_security (struct inode *inode, | |||
1951 | { | 1965 | { |
1952 | return -EOPNOTSUPP; | 1966 | return -EOPNOTSUPP; |
1953 | } | 1967 | } |
1954 | 1968 | ||
1955 | static inline int security_inode_create (struct inode *dir, | 1969 | static inline int security_inode_create(struct inode *dir, |
1956 | struct dentry *dentry, | 1970 | struct dentry *dentry, |
1957 | int mode) | 1971 | int mode) |
1958 | { | 1972 | { |
1959 | return 0; | 1973 | return 0; |
1960 | } | 1974 | } |
1961 | 1975 | ||
1962 | static inline int security_inode_link (struct dentry *old_dentry, | 1976 | static inline int security_inode_link(struct dentry *old_dentry, |
1963 | struct inode *dir, | 1977 | struct inode *dir, |
1964 | struct dentry *new_dentry) | 1978 | struct dentry *new_dentry) |
1965 | { | 1979 | { |
1966 | return 0; | 1980 | return 0; |
1967 | } | 1981 | } |
1968 | 1982 | ||
1969 | static inline int security_inode_unlink (struct inode *dir, | 1983 | static inline int security_inode_unlink(struct inode *dir, |
1970 | struct dentry *dentry) | 1984 | struct dentry *dentry) |
1971 | { | 1985 | { |
1972 | return 0; | 1986 | return 0; |
1973 | } | 1987 | } |
1974 | 1988 | ||
1975 | static inline int security_inode_symlink (struct inode *dir, | 1989 | static inline int security_inode_symlink(struct inode *dir, |
1976 | struct dentry *dentry, | 1990 | struct dentry *dentry, |
1977 | const char *old_name) | 1991 | const char *old_name) |
1978 | { | 1992 | { |
1979 | return 0; | 1993 | return 0; |
1980 | } | 1994 | } |
1981 | 1995 | ||
1982 | static inline int security_inode_mkdir (struct inode *dir, | 1996 | static inline int security_inode_mkdir(struct inode *dir, |
1983 | struct dentry *dentry, | 1997 | struct dentry *dentry, |
1984 | int mode) | 1998 | int mode) |
1985 | { | 1999 | { |
1986 | return 0; | 2000 | return 0; |
1987 | } | 2001 | } |
1988 | 2002 | ||
1989 | static inline int security_inode_rmdir (struct inode *dir, | 2003 | static inline int security_inode_rmdir(struct inode *dir, |
1990 | struct dentry *dentry) | 2004 | struct dentry *dentry) |
1991 | { | 2005 | { |
1992 | return 0; | 2006 | return 0; |
1993 | } | 2007 | } |
1994 | 2008 | ||
1995 | static inline int security_inode_mknod (struct inode *dir, | 2009 | static inline int security_inode_mknod(struct inode *dir, |
1996 | struct dentry *dentry, | 2010 | struct dentry *dentry, |
1997 | int mode, dev_t dev) | 2011 | int mode, dev_t dev) |
1998 | { | 2012 | { |
1999 | return 0; | 2013 | return 0; |
2000 | } | 2014 | } |
2001 | 2015 | ||
2002 | static inline int security_inode_rename (struct inode *old_dir, | 2016 | static inline int security_inode_rename(struct inode *old_dir, |
2003 | struct dentry *old_dentry, | 2017 | struct dentry *old_dentry, |
2004 | struct inode *new_dir, | 2018 | struct inode *new_dir, |
2005 | struct dentry *new_dentry) | 2019 | struct dentry *new_dentry) |
@@ -2007,59 +2021,61 @@ static inline int security_inode_rename (struct inode *old_dir, | |||
2007 | return 0; | 2021 | return 0; |
2008 | } | 2022 | } |
2009 | 2023 | ||
2010 | static inline int security_inode_readlink (struct dentry *dentry) | 2024 | static inline int security_inode_readlink(struct dentry *dentry) |
2011 | { | 2025 | { |
2012 | return 0; | 2026 | return 0; |
2013 | } | 2027 | } |
2014 | 2028 | ||
2015 | static inline int security_inode_follow_link (struct dentry *dentry, | 2029 | static inline int security_inode_follow_link(struct dentry *dentry, |
2016 | struct nameidata *nd) | 2030 | struct nameidata *nd) |
2017 | { | 2031 | { |
2018 | return 0; | 2032 | return 0; |
2019 | } | 2033 | } |
2020 | 2034 | ||
2021 | static inline int security_inode_permission (struct inode *inode, int mask, | 2035 | static inline int security_inode_permission(struct inode *inode, int mask, |
2022 | struct nameidata *nd) | 2036 | struct nameidata *nd) |
2023 | { | 2037 | { |
2024 | return 0; | 2038 | return 0; |
2025 | } | 2039 | } |
2026 | 2040 | ||
2027 | static inline int security_inode_setattr (struct dentry *dentry, | 2041 | static inline int security_inode_setattr(struct dentry *dentry, |
2028 | struct iattr *attr) | 2042 | struct iattr *attr) |
2029 | { | 2043 | { |
2030 | return 0; | 2044 | return 0; |
2031 | } | 2045 | } |
2032 | 2046 | ||
2033 | static inline int security_inode_getattr (struct vfsmount *mnt, | 2047 | static inline int security_inode_getattr(struct vfsmount *mnt, |
2034 | struct dentry *dentry) | 2048 | struct dentry *dentry) |
2035 | { | 2049 | { |
2036 | return 0; | 2050 | return 0; |
2037 | } | 2051 | } |
2038 | 2052 | ||
2039 | static inline void security_inode_delete (struct inode *inode) | 2053 | static inline void security_inode_delete(struct inode *inode) |
2040 | { } | 2054 | { } |
2041 | 2055 | ||
2042 | static inline int security_inode_setxattr (struct dentry *dentry, char *name, | 2056 | static inline int security_inode_setxattr(struct dentry *dentry, |
2043 | void *value, size_t size, int flags) | 2057 | const char *name, const void *value, size_t size, int flags) |
2044 | { | 2058 | { |
2045 | return cap_inode_setxattr(dentry, name, value, size, flags); | 2059 | return cap_inode_setxattr(dentry, name, value, size, flags); |
2046 | } | 2060 | } |
2047 | 2061 | ||
2048 | static inline void security_inode_post_setxattr (struct dentry *dentry, char *name, | 2062 | static inline void security_inode_post_setxattr(struct dentry *dentry, |
2049 | void *value, size_t size, int flags) | 2063 | const char *name, const void *value, size_t size, int flags) |
2050 | { } | 2064 | { } |
2051 | 2065 | ||
2052 | static inline int security_inode_getxattr (struct dentry *dentry, char *name) | 2066 | static inline int security_inode_getxattr(struct dentry *dentry, |
2067 | const char *name) | ||
2053 | { | 2068 | { |
2054 | return 0; | 2069 | return 0; |
2055 | } | 2070 | } |
2056 | 2071 | ||
2057 | static inline int security_inode_listxattr (struct dentry *dentry) | 2072 | static inline int security_inode_listxattr(struct dentry *dentry) |
2058 | { | 2073 | { |
2059 | return 0; | 2074 | return 0; |
2060 | } | 2075 | } |
2061 | 2076 | ||
2062 | static inline int security_inode_removexattr (struct dentry *dentry, char *name) | 2077 | static inline int security_inode_removexattr(struct dentry *dentry, |
2078 | const char *name) | ||
2063 | { | 2079 | { |
2064 | return cap_inode_removexattr(dentry, name); | 2080 | return cap_inode_removexattr(dentry, name); |
2065 | } | 2081 | } |
@@ -2094,198 +2110,198 @@ static inline void security_inode_getsecid(const struct inode *inode, u32 *secid | |||
2094 | *secid = 0; | 2110 | *secid = 0; |
2095 | } | 2111 | } |
2096 | 2112 | ||
2097 | static inline int security_file_permission (struct file *file, int mask) | 2113 | static inline int security_file_permission(struct file *file, int mask) |
2098 | { | 2114 | { |
2099 | return 0; | 2115 | return 0; |
2100 | } | 2116 | } |
2101 | 2117 | ||
2102 | static inline int security_file_alloc (struct file *file) | 2118 | static inline int security_file_alloc(struct file *file) |
2103 | { | 2119 | { |
2104 | return 0; | 2120 | return 0; |
2105 | } | 2121 | } |
2106 | 2122 | ||
2107 | static inline void security_file_free (struct file *file) | 2123 | static inline void security_file_free(struct file *file) |
2108 | { } | 2124 | { } |
2109 | 2125 | ||
2110 | static inline int security_file_ioctl (struct file *file, unsigned int cmd, | 2126 | static inline int security_file_ioctl(struct file *file, unsigned int cmd, |
2111 | unsigned long arg) | 2127 | unsigned long arg) |
2112 | { | 2128 | { |
2113 | return 0; | 2129 | return 0; |
2114 | } | 2130 | } |
2115 | 2131 | ||
2116 | static inline int security_file_mmap (struct file *file, unsigned long reqprot, | 2132 | static inline int security_file_mmap(struct file *file, unsigned long reqprot, |
2117 | unsigned long prot, | 2133 | unsigned long prot, |
2118 | unsigned long flags, | 2134 | unsigned long flags, |
2119 | unsigned long addr, | 2135 | unsigned long addr, |
2120 | unsigned long addr_only) | 2136 | unsigned long addr_only) |
2121 | { | 2137 | { |
2122 | return 0; | 2138 | return 0; |
2123 | } | 2139 | } |
2124 | 2140 | ||
2125 | static inline int security_file_mprotect (struct vm_area_struct *vma, | 2141 | static inline int security_file_mprotect(struct vm_area_struct *vma, |
2126 | unsigned long reqprot, | 2142 | unsigned long reqprot, |
2127 | unsigned long prot) | 2143 | unsigned long prot) |
2128 | { | 2144 | { |
2129 | return 0; | 2145 | return 0; |
2130 | } | 2146 | } |
2131 | 2147 | ||
2132 | static inline int security_file_lock (struct file *file, unsigned int cmd) | 2148 | static inline int security_file_lock(struct file *file, unsigned int cmd) |
2133 | { | 2149 | { |
2134 | return 0; | 2150 | return 0; |
2135 | } | 2151 | } |
2136 | 2152 | ||
2137 | static inline int security_file_fcntl (struct file *file, unsigned int cmd, | 2153 | static inline int security_file_fcntl(struct file *file, unsigned int cmd, |
2138 | unsigned long arg) | 2154 | unsigned long arg) |
2139 | { | 2155 | { |
2140 | return 0; | 2156 | return 0; |
2141 | } | 2157 | } |
2142 | 2158 | ||
2143 | static inline int security_file_set_fowner (struct file *file) | 2159 | static inline int security_file_set_fowner(struct file *file) |
2144 | { | 2160 | { |
2145 | return 0; | 2161 | return 0; |
2146 | } | 2162 | } |
2147 | 2163 | ||
2148 | static inline int security_file_send_sigiotask (struct task_struct *tsk, | 2164 | static inline int security_file_send_sigiotask(struct task_struct *tsk, |
2149 | struct fown_struct *fown, | 2165 | struct fown_struct *fown, |
2150 | int sig) | 2166 | int sig) |
2151 | { | 2167 | { |
2152 | return 0; | 2168 | return 0; |
2153 | } | 2169 | } |
2154 | 2170 | ||
2155 | static inline int security_file_receive (struct file *file) | 2171 | static inline int security_file_receive(struct file *file) |
2156 | { | 2172 | { |
2157 | return 0; | 2173 | return 0; |
2158 | } | 2174 | } |
2159 | 2175 | ||
2160 | static inline int security_dentry_open (struct file *file) | 2176 | static inline int security_dentry_open(struct file *file) |
2161 | { | 2177 | { |
2162 | return 0; | 2178 | return 0; |
2163 | } | 2179 | } |
2164 | 2180 | ||
2165 | static inline int security_task_create (unsigned long clone_flags) | 2181 | static inline int security_task_create(unsigned long clone_flags) |
2166 | { | 2182 | { |
2167 | return 0; | 2183 | return 0; |
2168 | } | 2184 | } |
2169 | 2185 | ||
2170 | static inline int security_task_alloc (struct task_struct *p) | 2186 | static inline int security_task_alloc(struct task_struct *p) |
2171 | { | 2187 | { |
2172 | return 0; | 2188 | return 0; |
2173 | } | 2189 | } |
2174 | 2190 | ||
2175 | static inline void security_task_free (struct task_struct *p) | 2191 | static inline void security_task_free(struct task_struct *p) |
2176 | { } | 2192 | { } |
2177 | 2193 | ||
2178 | static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2, | 2194 | static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, |
2179 | int flags) | 2195 | int flags) |
2180 | { | 2196 | { |
2181 | return 0; | 2197 | return 0; |
2182 | } | 2198 | } |
2183 | 2199 | ||
2184 | static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid, | 2200 | static inline int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, |
2185 | uid_t old_suid, int flags) | 2201 | uid_t old_suid, int flags) |
2186 | { | 2202 | { |
2187 | return cap_task_post_setuid (old_ruid, old_euid, old_suid, flags); | 2203 | return cap_task_post_setuid(old_ruid, old_euid, old_suid, flags); |
2188 | } | 2204 | } |
2189 | 2205 | ||
2190 | static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2, | 2206 | static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, |
2191 | int flags) | 2207 | int flags) |
2192 | { | 2208 | { |
2193 | return 0; | 2209 | return 0; |
2194 | } | 2210 | } |
2195 | 2211 | ||
2196 | static inline int security_task_setpgid (struct task_struct *p, pid_t pgid) | 2212 | static inline int security_task_setpgid(struct task_struct *p, pid_t pgid) |
2197 | { | 2213 | { |
2198 | return 0; | 2214 | return 0; |
2199 | } | 2215 | } |
2200 | 2216 | ||
2201 | static inline int security_task_getpgid (struct task_struct *p) | 2217 | static inline int security_task_getpgid(struct task_struct *p) |
2202 | { | 2218 | { |
2203 | return 0; | 2219 | return 0; |
2204 | } | 2220 | } |
2205 | 2221 | ||
2206 | static inline int security_task_getsid (struct task_struct *p) | 2222 | static inline int security_task_getsid(struct task_struct *p) |
2207 | { | 2223 | { |
2208 | return 0; | 2224 | return 0; |
2209 | } | 2225 | } |
2210 | 2226 | ||
2211 | static inline void security_task_getsecid (struct task_struct *p, u32 *secid) | 2227 | static inline void security_task_getsecid(struct task_struct *p, u32 *secid) |
2212 | { | 2228 | { |
2213 | *secid = 0; | 2229 | *secid = 0; |
2214 | } | 2230 | } |
2215 | 2231 | ||
2216 | static inline int security_task_setgroups (struct group_info *group_info) | 2232 | static inline int security_task_setgroups(struct group_info *group_info) |
2217 | { | 2233 | { |
2218 | return 0; | 2234 | return 0; |
2219 | } | 2235 | } |
2220 | 2236 | ||
2221 | static inline int security_task_setnice (struct task_struct *p, int nice) | 2237 | static inline int security_task_setnice(struct task_struct *p, int nice) |
2222 | { | 2238 | { |
2223 | return cap_task_setnice(p, nice); | 2239 | return cap_task_setnice(p, nice); |
2224 | } | 2240 | } |
2225 | 2241 | ||
2226 | static inline int security_task_setioprio (struct task_struct *p, int ioprio) | 2242 | static inline int security_task_setioprio(struct task_struct *p, int ioprio) |
2227 | { | 2243 | { |
2228 | return cap_task_setioprio(p, ioprio); | 2244 | return cap_task_setioprio(p, ioprio); |
2229 | } | 2245 | } |
2230 | 2246 | ||
2231 | static inline int security_task_getioprio (struct task_struct *p) | 2247 | static inline int security_task_getioprio(struct task_struct *p) |
2232 | { | 2248 | { |
2233 | return 0; | 2249 | return 0; |
2234 | } | 2250 | } |
2235 | 2251 | ||
2236 | static inline int security_task_setrlimit (unsigned int resource, | 2252 | static inline int security_task_setrlimit(unsigned int resource, |
2237 | struct rlimit *new_rlim) | 2253 | struct rlimit *new_rlim) |
2238 | { | 2254 | { |
2239 | return 0; | 2255 | return 0; |
2240 | } | 2256 | } |
2241 | 2257 | ||
2242 | static inline int security_task_setscheduler (struct task_struct *p, | 2258 | static inline int security_task_setscheduler(struct task_struct *p, |
2243 | int policy, | 2259 | int policy, |
2244 | struct sched_param *lp) | 2260 | struct sched_param *lp) |
2245 | { | 2261 | { |
2246 | return cap_task_setscheduler(p, policy, lp); | 2262 | return cap_task_setscheduler(p, policy, lp); |
2247 | } | 2263 | } |
2248 | 2264 | ||
2249 | static inline int security_task_getscheduler (struct task_struct *p) | 2265 | static inline int security_task_getscheduler(struct task_struct *p) |
2250 | { | 2266 | { |
2251 | return 0; | 2267 | return 0; |
2252 | } | 2268 | } |
2253 | 2269 | ||
2254 | static inline int security_task_movememory (struct task_struct *p) | 2270 | static inline int security_task_movememory(struct task_struct *p) |
2255 | { | 2271 | { |
2256 | return 0; | 2272 | return 0; |
2257 | } | 2273 | } |
2258 | 2274 | ||
2259 | static inline int security_task_kill (struct task_struct *p, | 2275 | static inline int security_task_kill(struct task_struct *p, |
2260 | struct siginfo *info, int sig, | 2276 | struct siginfo *info, int sig, |
2261 | u32 secid) | 2277 | u32 secid) |
2262 | { | 2278 | { |
2263 | return 0; | 2279 | return 0; |
2264 | } | 2280 | } |
2265 | 2281 | ||
2266 | static inline int security_task_wait (struct task_struct *p) | 2282 | static inline int security_task_wait(struct task_struct *p) |
2267 | { | 2283 | { |
2268 | return 0; | 2284 | return 0; |
2269 | } | 2285 | } |
2270 | 2286 | ||
2271 | static inline int security_task_prctl (int option, unsigned long arg2, | 2287 | static inline int security_task_prctl(int option, unsigned long arg2, |
2272 | unsigned long arg3, | 2288 | unsigned long arg3, |
2273 | unsigned long arg4, | 2289 | unsigned long arg4, |
2274 | unsigned long arg5) | 2290 | unsigned long arg5, long *rc_p) |
2275 | { | 2291 | { |
2276 | return 0; | 2292 | return cap_task_prctl(option, arg2, arg3, arg3, arg5, rc_p); |
2277 | } | 2293 | } |
2278 | 2294 | ||
2279 | static inline void security_task_reparent_to_init (struct task_struct *p) | 2295 | static inline void security_task_reparent_to_init(struct task_struct *p) |
2280 | { | 2296 | { |
2281 | cap_task_reparent_to_init (p); | 2297 | cap_task_reparent_to_init(p); |
2282 | } | 2298 | } |
2283 | 2299 | ||
2284 | static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) | 2300 | static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) |
2285 | { } | 2301 | { } |
2286 | 2302 | ||
2287 | static inline int security_ipc_permission (struct kern_ipc_perm *ipcp, | 2303 | static inline int security_ipc_permission(struct kern_ipc_perm *ipcp, |
2288 | short flag) | 2304 | short flag) |
2289 | { | 2305 | { |
2290 | return 0; | 2306 | return 0; |
2291 | } | 2307 | } |
@@ -2295,98 +2311,98 @@ static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid) | |||
2295 | *secid = 0; | 2311 | *secid = 0; |
2296 | } | 2312 | } |
2297 | 2313 | ||
2298 | static inline int security_msg_msg_alloc (struct msg_msg * msg) | 2314 | static inline int security_msg_msg_alloc(struct msg_msg *msg) |
2299 | { | 2315 | { |
2300 | return 0; | 2316 | return 0; |
2301 | } | 2317 | } |
2302 | 2318 | ||
2303 | static inline void security_msg_msg_free (struct msg_msg * msg) | 2319 | static inline void security_msg_msg_free(struct msg_msg *msg) |
2304 | { } | 2320 | { } |
2305 | 2321 | ||
2306 | static inline int security_msg_queue_alloc (struct msg_queue *msq) | 2322 | static inline int security_msg_queue_alloc(struct msg_queue *msq) |
2307 | { | 2323 | { |
2308 | return 0; | 2324 | return 0; |
2309 | } | 2325 | } |
2310 | 2326 | ||
2311 | static inline void security_msg_queue_free (struct msg_queue *msq) | 2327 | static inline void security_msg_queue_free(struct msg_queue *msq) |
2312 | { } | 2328 | { } |
2313 | 2329 | ||
2314 | static inline int security_msg_queue_associate (struct msg_queue * msq, | 2330 | static inline int security_msg_queue_associate(struct msg_queue *msq, |
2315 | int msqflg) | 2331 | int msqflg) |
2316 | { | 2332 | { |
2317 | return 0; | 2333 | return 0; |
2318 | } | 2334 | } |
2319 | 2335 | ||
2320 | static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd) | 2336 | static inline int security_msg_queue_msgctl(struct msg_queue *msq, int cmd) |
2321 | { | 2337 | { |
2322 | return 0; | 2338 | return 0; |
2323 | } | 2339 | } |
2324 | 2340 | ||
2325 | static inline int security_msg_queue_msgsnd (struct msg_queue * msq, | 2341 | static inline int security_msg_queue_msgsnd(struct msg_queue *msq, |
2326 | struct msg_msg * msg, int msqflg) | 2342 | struct msg_msg *msg, int msqflg) |
2327 | { | 2343 | { |
2328 | return 0; | 2344 | return 0; |
2329 | } | 2345 | } |
2330 | 2346 | ||
2331 | static inline int security_msg_queue_msgrcv (struct msg_queue * msq, | 2347 | static inline int security_msg_queue_msgrcv(struct msg_queue *msq, |
2332 | struct msg_msg * msg, | 2348 | struct msg_msg *msg, |
2333 | struct task_struct * target, | 2349 | struct task_struct *target, |
2334 | long type, int mode) | 2350 | long type, int mode) |
2335 | { | 2351 | { |
2336 | return 0; | 2352 | return 0; |
2337 | } | 2353 | } |
2338 | 2354 | ||
2339 | static inline int security_shm_alloc (struct shmid_kernel *shp) | 2355 | static inline int security_shm_alloc(struct shmid_kernel *shp) |
2340 | { | 2356 | { |
2341 | return 0; | 2357 | return 0; |
2342 | } | 2358 | } |
2343 | 2359 | ||
2344 | static inline void security_shm_free (struct shmid_kernel *shp) | 2360 | static inline void security_shm_free(struct shmid_kernel *shp) |
2345 | { } | 2361 | { } |
2346 | 2362 | ||
2347 | static inline int security_shm_associate (struct shmid_kernel * shp, | 2363 | static inline int security_shm_associate(struct shmid_kernel *shp, |
2348 | int shmflg) | 2364 | int shmflg) |
2349 | { | 2365 | { |
2350 | return 0; | 2366 | return 0; |
2351 | } | 2367 | } |
2352 | 2368 | ||
2353 | static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd) | 2369 | static inline int security_shm_shmctl(struct shmid_kernel *shp, int cmd) |
2354 | { | 2370 | { |
2355 | return 0; | 2371 | return 0; |
2356 | } | 2372 | } |
2357 | 2373 | ||
2358 | static inline int security_shm_shmat (struct shmid_kernel * shp, | 2374 | static inline int security_shm_shmat(struct shmid_kernel *shp, |
2359 | char __user *shmaddr, int shmflg) | 2375 | char __user *shmaddr, int shmflg) |
2360 | { | 2376 | { |
2361 | return 0; | 2377 | return 0; |
2362 | } | 2378 | } |
2363 | 2379 | ||
2364 | static inline int security_sem_alloc (struct sem_array *sma) | 2380 | static inline int security_sem_alloc(struct sem_array *sma) |
2365 | { | 2381 | { |
2366 | return 0; | 2382 | return 0; |
2367 | } | 2383 | } |
2368 | 2384 | ||
2369 | static inline void security_sem_free (struct sem_array *sma) | 2385 | static inline void security_sem_free(struct sem_array *sma) |
2370 | { } | 2386 | { } |
2371 | 2387 | ||
2372 | static inline int security_sem_associate (struct sem_array * sma, int semflg) | 2388 | static inline int security_sem_associate(struct sem_array *sma, int semflg) |
2373 | { | 2389 | { |
2374 | return 0; | 2390 | return 0; |
2375 | } | 2391 | } |
2376 | 2392 | ||
2377 | static inline int security_sem_semctl (struct sem_array * sma, int cmd) | 2393 | static inline int security_sem_semctl(struct sem_array *sma, int cmd) |
2378 | { | 2394 | { |
2379 | return 0; | 2395 | return 0; |
2380 | } | 2396 | } |
2381 | 2397 | ||
2382 | static inline int security_sem_semop (struct sem_array * sma, | 2398 | static inline int security_sem_semop(struct sem_array *sma, |
2383 | struct sembuf * sops, unsigned nsops, | 2399 | struct sembuf *sops, unsigned nsops, |
2384 | int alter) | 2400 | int alter) |
2385 | { | 2401 | { |
2386 | return 0; | 2402 | return 0; |
2387 | } | 2403 | } |
2388 | 2404 | ||
2389 | static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode) | 2405 | static inline void security_d_instantiate(struct dentry *dentry, struct inode *inode) |
2390 | { } | 2406 | { } |
2391 | 2407 | ||
2392 | static inline int security_getprocattr(struct task_struct *p, char *name, char **value) | 2408 | static inline int security_getprocattr(struct task_struct *p, char *name, char **value) |
@@ -2399,14 +2415,14 @@ static inline int security_setprocattr(struct task_struct *p, char *name, void * | |||
2399 | return -EINVAL; | 2415 | return -EINVAL; |
2400 | } | 2416 | } |
2401 | 2417 | ||
2402 | static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb) | 2418 | static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb) |
2403 | { | 2419 | { |
2404 | return cap_netlink_send (sk, skb); | 2420 | return cap_netlink_send(sk, skb); |
2405 | } | 2421 | } |
2406 | 2422 | ||
2407 | static inline int security_netlink_recv (struct sk_buff *skb, int cap) | 2423 | static inline int security_netlink_recv(struct sk_buff *skb, int cap) |
2408 | { | 2424 | { |
2409 | return cap_netlink_recv (skb, cap); | 2425 | return cap_netlink_recv(skb, cap); |
2410 | } | 2426 | } |
2411 | 2427 | ||
2412 | static inline struct dentry *securityfs_create_dir(const char *name, | 2428 | static inline struct dentry *securityfs_create_dir(const char *name, |
@@ -2433,7 +2449,7 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle | |||
2433 | return -EOPNOTSUPP; | 2449 | return -EOPNOTSUPP; |
2434 | } | 2450 | } |
2435 | 2451 | ||
2436 | static inline int security_secctx_to_secid(char *secdata, | 2452 | static inline int security_secctx_to_secid(const char *secdata, |
2437 | u32 seclen, | 2453 | u32 seclen, |
2438 | u32 *secid) | 2454 | u32 *secid) |
2439 | { | 2455 | { |
@@ -2484,26 +2500,26 @@ void security_inet_conn_established(struct sock *sk, | |||
2484 | struct sk_buff *skb); | 2500 | struct sk_buff *skb); |
2485 | 2501 | ||
2486 | #else /* CONFIG_SECURITY_NETWORK */ | 2502 | #else /* CONFIG_SECURITY_NETWORK */ |
2487 | static inline int security_unix_stream_connect(struct socket * sock, | 2503 | static inline int security_unix_stream_connect(struct socket *sock, |
2488 | struct socket * other, | 2504 | struct socket *other, |
2489 | struct sock * newsk) | 2505 | struct sock *newsk) |
2490 | { | 2506 | { |
2491 | return 0; | 2507 | return 0; |
2492 | } | 2508 | } |
2493 | 2509 | ||
2494 | static inline int security_unix_may_send(struct socket * sock, | 2510 | static inline int security_unix_may_send(struct socket *sock, |
2495 | struct socket * other) | 2511 | struct socket *other) |
2496 | { | 2512 | { |
2497 | return 0; | 2513 | return 0; |
2498 | } | 2514 | } |
2499 | 2515 | ||
2500 | static inline int security_socket_create (int family, int type, | 2516 | static inline int security_socket_create(int family, int type, |
2501 | int protocol, int kern) | 2517 | int protocol, int kern) |
2502 | { | 2518 | { |
2503 | return 0; | 2519 | return 0; |
2504 | } | 2520 | } |
2505 | 2521 | ||
2506 | static inline int security_socket_post_create(struct socket * sock, | 2522 | static inline int security_socket_post_create(struct socket *sock, |
2507 | int family, | 2523 | int family, |
2508 | int type, | 2524 | int type, |
2509 | int protocol, int kern) | 2525 | int protocol, int kern) |
@@ -2511,77 +2527,77 @@ static inline int security_socket_post_create(struct socket * sock, | |||
2511 | return 0; | 2527 | return 0; |
2512 | } | 2528 | } |
2513 | 2529 | ||
2514 | static inline int security_socket_bind(struct socket * sock, | 2530 | static inline int security_socket_bind(struct socket *sock, |
2515 | struct sockaddr * address, | 2531 | struct sockaddr *address, |
2516 | int addrlen) | 2532 | int addrlen) |
2517 | { | 2533 | { |
2518 | return 0; | 2534 | return 0; |
2519 | } | 2535 | } |
2520 | 2536 | ||
2521 | static inline int security_socket_connect(struct socket * sock, | 2537 | static inline int security_socket_connect(struct socket *sock, |
2522 | struct sockaddr * address, | 2538 | struct sockaddr *address, |
2523 | int addrlen) | 2539 | int addrlen) |
2524 | { | 2540 | { |
2525 | return 0; | 2541 | return 0; |
2526 | } | 2542 | } |
2527 | 2543 | ||
2528 | static inline int security_socket_listen(struct socket * sock, int backlog) | 2544 | static inline int security_socket_listen(struct socket *sock, int backlog) |
2529 | { | 2545 | { |
2530 | return 0; | 2546 | return 0; |
2531 | } | 2547 | } |
2532 | 2548 | ||
2533 | static inline int security_socket_accept(struct socket * sock, | 2549 | static inline int security_socket_accept(struct socket *sock, |
2534 | struct socket * newsock) | 2550 | struct socket *newsock) |
2535 | { | 2551 | { |
2536 | return 0; | 2552 | return 0; |
2537 | } | 2553 | } |
2538 | 2554 | ||
2539 | static inline void security_socket_post_accept(struct socket * sock, | 2555 | static inline void security_socket_post_accept(struct socket *sock, |
2540 | struct socket * newsock) | 2556 | struct socket *newsock) |
2541 | { | 2557 | { |
2542 | } | 2558 | } |
2543 | 2559 | ||
2544 | static inline int security_socket_sendmsg(struct socket * sock, | 2560 | static inline int security_socket_sendmsg(struct socket *sock, |
2545 | struct msghdr * msg, int size) | 2561 | struct msghdr *msg, int size) |
2546 | { | 2562 | { |
2547 | return 0; | 2563 | return 0; |
2548 | } | 2564 | } |
2549 | 2565 | ||
2550 | static inline int security_socket_recvmsg(struct socket * sock, | 2566 | static inline int security_socket_recvmsg(struct socket *sock, |
2551 | struct msghdr * msg, int size, | 2567 | struct msghdr *msg, int size, |
2552 | int flags) | 2568 | int flags) |
2553 | { | 2569 | { |
2554 | return 0; | 2570 | return 0; |
2555 | } | 2571 | } |
2556 | 2572 | ||
2557 | static inline int security_socket_getsockname(struct socket * sock) | 2573 | static inline int security_socket_getsockname(struct socket *sock) |
2558 | { | 2574 | { |
2559 | return 0; | 2575 | return 0; |
2560 | } | 2576 | } |
2561 | 2577 | ||
2562 | static inline int security_socket_getpeername(struct socket * sock) | 2578 | static inline int security_socket_getpeername(struct socket *sock) |
2563 | { | 2579 | { |
2564 | return 0; | 2580 | return 0; |
2565 | } | 2581 | } |
2566 | 2582 | ||
2567 | static inline int security_socket_getsockopt(struct socket * sock, | 2583 | static inline int security_socket_getsockopt(struct socket *sock, |
2568 | int level, int optname) | 2584 | int level, int optname) |
2569 | { | 2585 | { |
2570 | return 0; | 2586 | return 0; |
2571 | } | 2587 | } |
2572 | 2588 | ||
2573 | static inline int security_socket_setsockopt(struct socket * sock, | 2589 | static inline int security_socket_setsockopt(struct socket *sock, |
2574 | int level, int optname) | 2590 | int level, int optname) |
2575 | { | 2591 | { |
2576 | return 0; | 2592 | return 0; |
2577 | } | 2593 | } |
2578 | 2594 | ||
2579 | static inline int security_socket_shutdown(struct socket * sock, int how) | 2595 | static inline int security_socket_shutdown(struct socket *sock, int how) |
2580 | { | 2596 | { |
2581 | return 0; | 2597 | return 0; |
2582 | } | 2598 | } |
2583 | static inline int security_sock_rcv_skb (struct sock * sk, | 2599 | static inline int security_sock_rcv_skb(struct sock *sk, |
2584 | struct sk_buff * skb) | 2600 | struct sk_buff *skb) |
2585 | { | 2601 | { |
2586 | return 0; | 2602 | return 0; |
2587 | } | 2603 | } |
@@ -2618,7 +2634,7 @@ static inline void security_req_classify_flow(const struct request_sock *req, st | |||
2618 | { | 2634 | { |
2619 | } | 2635 | } |
2620 | 2636 | ||
2621 | static inline void security_sock_graft(struct sock* sk, struct socket *parent) | 2637 | static inline void security_sock_graft(struct sock *sk, struct socket *parent) |
2622 | { | 2638 | { |
2623 | } | 2639 | } |
2624 | 2640 | ||
@@ -2727,6 +2743,7 @@ int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long f | |||
2727 | void security_key_free(struct key *key); | 2743 | void security_key_free(struct key *key); |
2728 | int security_key_permission(key_ref_t key_ref, | 2744 | int security_key_permission(key_ref_t key_ref, |
2729 | struct task_struct *context, key_perm_t perm); | 2745 | struct task_struct *context, key_perm_t perm); |
2746 | int security_key_getsecurity(struct key *key, char **_buffer); | ||
2730 | 2747 | ||
2731 | #else | 2748 | #else |
2732 | 2749 | ||
@@ -2748,6 +2765,12 @@ static inline int security_key_permission(key_ref_t key_ref, | |||
2748 | return 0; | 2765 | return 0; |
2749 | } | 2766 | } |
2750 | 2767 | ||
2768 | static inline int security_key_getsecurity(struct key *key, char **_buffer) | ||
2769 | { | ||
2770 | *_buffer = NULL; | ||
2771 | return 0; | ||
2772 | } | ||
2773 | |||
2751 | #endif | 2774 | #endif |
2752 | #endif /* CONFIG_KEYS */ | 2775 | #endif /* CONFIG_KEYS */ |
2753 | 2776 | ||
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 5b5369c3c209..a66304a09955 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #ifndef _LINUX_SEQ_FILE_H | 1 | #ifndef _LINUX_SEQ_FILE_H |
2 | #define _LINUX_SEQ_FILE_H | 2 | #define _LINUX_SEQ_FILE_H |
3 | #ifdef __KERNEL__ | ||
4 | 3 | ||
5 | #include <linux/types.h> | 4 | #include <linux/types.h> |
6 | #include <linux/string.h> | 5 | #include <linux/string.h> |
@@ -69,4 +68,3 @@ extern struct list_head *seq_list_next(void *v, struct list_head *head, | |||
69 | loff_t *ppos); | 68 | loff_t *ppos); |
70 | 69 | ||
71 | #endif | 70 | #endif |
72 | #endif | ||
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/serial_core.h b/include/linux/serial_core.h index 7cb094a82456..d32123ae08ad 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -149,13 +149,15 @@ | |||
149 | /* Freescale ColdFire */ | 149 | /* Freescale ColdFire */ |
150 | #define PORT_MCF 78 | 150 | #define PORT_MCF 78 |
151 | 151 | ||
152 | #define PORT_SC26XX 79 | 152 | /* Blackfin SPORT */ |
153 | 153 | #define PORT_BFIN_SPORT 79 | |
154 | 154 | ||
155 | /* MN10300 on-chip UART numbers */ | 155 | /* MN10300 on-chip UART numbers */ |
156 | #define PORT_MN10300 80 | 156 | #define PORT_MN10300 80 |
157 | #define PORT_MN10300_CTS 81 | 157 | #define PORT_MN10300_CTS 81 |
158 | 158 | ||
159 | #define PORT_SC26XX 82 | ||
160 | |||
159 | #ifdef __KERNEL__ | 161 | #ifdef __KERNEL__ |
160 | 162 | ||
161 | #include <linux/compiler.h> | 163 | #include <linux/compiler.h> |
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 | ||
41 | static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) | 40 | static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) |
diff --git a/include/linux/signal.h b/include/linux/signal.h index 42d2e0a948f4..84f997f8aa53 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -362,8 +362,6 @@ int unhandled_signal(struct task_struct *tsk, int sig); | |||
362 | #define sig_kernel_stop(sig) \ | 362 | #define sig_kernel_stop(sig) \ |
363 | (((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK)) | 363 | (((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK)) |
364 | 364 | ||
365 | #define sig_needs_tasklist(sig) ((sig) == SIGCONT) | ||
366 | |||
367 | #define sig_user_defined(t, signr) \ | 365 | #define sig_user_defined(t, signr) \ |
368 | (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \ | 366 | (((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \ |
369 | ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN)) | 367 | ((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN)) |
diff --git a/include/linux/slab.h b/include/linux/slab.h index f62caaad94e0..805ed4b92f9a 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -9,8 +9,6 @@ | |||
9 | #ifndef _LINUX_SLAB_H | 9 | #ifndef _LINUX_SLAB_H |
10 | #define _LINUX_SLAB_H | 10 | #define _LINUX_SLAB_H |
11 | 11 | ||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #include <linux/gfp.h> | 12 | #include <linux/gfp.h> |
15 | #include <linux/types.h> | 13 | #include <linux/types.h> |
16 | 14 | ||
@@ -29,6 +27,13 @@ | |||
29 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ | 27 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ |
30 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ | 28 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ |
31 | 29 | ||
30 | /* Flag to prevent checks on free */ | ||
31 | #ifdef CONFIG_DEBUG_OBJECTS | ||
32 | # define SLAB_DEBUG_OBJECTS 0x00400000UL | ||
33 | #else | ||
34 | # define SLAB_DEBUG_OBJECTS 0x00000000UL | ||
35 | #endif | ||
36 | |||
32 | /* The following flags affect the page allocator grouping pages by mobility */ | 37 | /* The following flags affect the page allocator grouping pages by mobility */ |
33 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ | 38 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ |
34 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ | 39 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ |
@@ -276,5 +281,4 @@ extern const struct seq_operations slabinfo_op; | |||
276 | ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); | 281 | ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); |
277 | #endif | 282 | #endif |
278 | 283 | ||
279 | #endif /* __KERNEL__ */ | ||
280 | #endif /* _LINUX_SLAB_H */ | 284 | #endif /* _LINUX_SLAB_H */ |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 79d59c937fac..71e43a12ebbb 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -29,6 +29,7 @@ enum stat_item { | |||
29 | DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */ | 29 | DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */ |
30 | DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ | 30 | DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ |
31 | DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ | 31 | DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ |
32 | ORDER_FALLBACK, /* Number of times fallback was necessary */ | ||
32 | NR_SLUB_STAT_ITEMS }; | 33 | NR_SLUB_STAT_ITEMS }; |
33 | 34 | ||
34 | struct kmem_cache_cpu { | 35 | struct kmem_cache_cpu { |
@@ -48,11 +49,21 @@ struct kmem_cache_node { | |||
48 | struct list_head partial; | 49 | struct list_head partial; |
49 | #ifdef CONFIG_SLUB_DEBUG | 50 | #ifdef CONFIG_SLUB_DEBUG |
50 | atomic_long_t nr_slabs; | 51 | atomic_long_t nr_slabs; |
52 | atomic_long_t total_objects; | ||
51 | struct list_head full; | 53 | struct list_head full; |
52 | #endif | 54 | #endif |
53 | }; | 55 | }; |
54 | 56 | ||
55 | /* | 57 | /* |
58 | * Word size structure that can be atomically updated or read and that | ||
59 | * contains both the order and the number of objects that a slab of the | ||
60 | * given order would contain. | ||
61 | */ | ||
62 | struct kmem_cache_order_objects { | ||
63 | unsigned long x; | ||
64 | }; | ||
65 | |||
66 | /* | ||
56 | * Slab cache management. | 67 | * Slab cache management. |
57 | */ | 68 | */ |
58 | struct kmem_cache { | 69 | struct kmem_cache { |
@@ -61,7 +72,7 @@ struct kmem_cache { | |||
61 | int size; /* The size of an object including meta data */ | 72 | int size; /* The size of an object including meta data */ |
62 | int objsize; /* The size of an object without meta data */ | 73 | int objsize; /* The size of an object without meta data */ |
63 | int offset; /* Free pointer offset. */ | 74 | int offset; /* Free pointer offset. */ |
64 | int order; /* Current preferred allocation order */ | 75 | struct kmem_cache_order_objects oo; |
65 | 76 | ||
66 | /* | 77 | /* |
67 | * Avoid an extra cache line for UP, SMP and for the node local to | 78 | * Avoid an extra cache line for UP, SMP and for the node local to |
@@ -70,7 +81,8 @@ struct kmem_cache { | |||
70 | struct kmem_cache_node local_node; | 81 | struct kmem_cache_node local_node; |
71 | 82 | ||
72 | /* Allocation and freeing of slabs */ | 83 | /* Allocation and freeing of slabs */ |
73 | int objects; /* Number of objects in slab */ | 84 | struct kmem_cache_order_objects max; |
85 | struct kmem_cache_order_objects min; | ||
74 | gfp_t allocflags; /* gfp flags to use on each alloc */ | 86 | gfp_t allocflags; /* gfp flags to use on each alloc */ |
75 | int refcount; /* Refcount for slab cache destroy */ | 87 | int refcount; /* Refcount for slab cache destroy */ |
76 | void (*ctor)(struct kmem_cache *, void *); | 88 | void (*ctor)(struct kmem_cache *, void *); |
diff --git a/include/linux/smb.h b/include/linux/smb.h index f098dff93f6b..caa43b2370cb 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/magic.h> | 13 | #include <linux/magic.h> |
14 | #include <linux/time.h> | ||
14 | 15 | ||
15 | enum smb_protocol { | 16 | enum smb_protocol { |
16 | SMB_PROTOCOL_NONE, | 17 | SMB_PROTOCOL_NONE, |
diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h index 8516954a5141..8ccf4eca2c3d 100644 --- a/include/linux/smb_fs_i.h +++ b/include/linux/smb_fs_i.h | |||
@@ -9,7 +9,6 @@ | |||
9 | #ifndef _LINUX_SMB_FS_I | 9 | #ifndef _LINUX_SMB_FS_I |
10 | #define _LINUX_SMB_FS_I | 10 | #define _LINUX_SMB_FS_I |
11 | 11 | ||
12 | #ifdef __KERNEL__ | ||
13 | #include <linux/types.h> | 12 | #include <linux/types.h> |
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | 14 | ||
@@ -36,4 +35,3 @@ struct smb_inode_info { | |||
36 | }; | 35 | }; |
37 | 36 | ||
38 | #endif | 37 | #endif |
39 | #endif | ||
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h index 3aa97aa4277f..8a060a7040d8 100644 --- a/include/linux/smb_fs_sb.h +++ b/include/linux/smb_fs_sb.h | |||
@@ -9,8 +9,6 @@ | |||
9 | #ifndef _SMB_FS_SB | 9 | #ifndef _SMB_FS_SB |
10 | #define _SMB_FS_SB | 10 | #define _SMB_FS_SB |
11 | 11 | ||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #include <linux/types.h> | 12 | #include <linux/types.h> |
15 | #include <linux/smb.h> | 13 | #include <linux/smb.h> |
16 | 14 | ||
@@ -96,6 +94,4 @@ smb_unlock_server(struct smb_sb_info *server) | |||
96 | up(&(server->sem)); | 94 | up(&(server->sem)); |
97 | } | 95 | } |
98 | 96 | ||
99 | #endif /* __KERNEL__ */ | ||
100 | |||
101 | #endif | 97 | #endif |
diff --git a/include/linux/string.h b/include/linux/string.h index c5d3fcad7b57..efdc44593b52 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -109,5 +109,7 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp); | |||
109 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); | 109 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); |
110 | extern void argv_free(char **argv); | 110 | extern void argv_free(char **argv); |
111 | 111 | ||
112 | extern bool sysfs_streq(const char *s1, const char *s2); | ||
113 | |||
112 | #endif | 114 | #endif |
113 | #endif /* _LINUX_STRING_H_ */ | 115 | #endif /* _LINUX_STRING_H_ */ |
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) |
15 | extern void pm_set_vt_switch(int); | ||
15 | extern int pm_prepare_console(void); | 16 | extern int pm_prepare_console(void); |
16 | extern void pm_restore_console(void); | 17 | extern void pm_restore_console(void); |
17 | #else | 18 | #else |
18 | static inline int pm_prepare_console(void) { return 0; } | 19 | static inline void pm_set_vt_switch(int do_switch) |
19 | static inline void pm_restore_console(void) {} | 20 | { |
21 | } | ||
22 | |||
23 | static inline int pm_prepare_console(void) | ||
24 | { | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | static inline void pm_restore_console(void) | ||
29 | { | ||
30 | } | ||
20 | #endif | 31 | #endif |
21 | 32 | ||
22 | typedef int __bitwise suspend_state_t; | 33 | typedef int __bitwise suspend_state_t; |
diff --git a/include/linux/svga.h b/include/linux/svga.h index 13ad0b82ac28..c59a51a2b0e7 100644 --- a/include/linux/svga.h +++ b/include/linux/svga.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _LINUX_SVGA_H | 1 | #ifndef _LINUX_SVGA_H |
2 | #define _LINUX_SVGA_H | 2 | #define _LINUX_SVGA_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
7 | #include <video/vga.h> | 5 | #include <video/vga.h> |
8 | 6 | ||
@@ -122,6 +120,5 @@ void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninf | |||
122 | 120 | ||
123 | int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); | 121 | int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); |
124 | 122 | ||
125 | #endif /* __KERNEL__ */ | ||
126 | #endif /* _LINUX_SVGA_H */ | 123 | #endif /* _LINUX_SVGA_H */ |
127 | 124 | ||
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 *); | |||
177 | extern void mark_page_accessed(struct page *); | 177 | extern void mark_page_accessed(struct page *); |
178 | extern void lru_add_drain(void); | 178 | extern void lru_add_drain(void); |
179 | extern int lru_add_drain_all(void); | 179 | extern int lru_add_drain_all(void); |
180 | extern int rotate_reclaimable_page(struct page *page); | 180 | extern void rotate_reclaimable_page(struct page *page); |
181 | extern void swap_setup(void); | 181 | extern void swap_setup(void); |
182 | 182 | ||
183 | /* linux/mm/vmscan.c */ | 183 | /* linux/mm/vmscan.c */ |
184 | extern unsigned long try_to_free_pages(struct zone **zones, int order, | 184 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |
185 | gfp_t gfp_mask); | 185 | gfp_t gfp_mask); |
186 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | 186 | extern 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/syscalls.h b/include/linux/syscalls.h index 8df6d1382ac8..0522f368f9d7 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -240,26 +240,28 @@ asmlinkage long sys_truncate64(const char __user *path, loff_t length); | |||
240 | asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); | 240 | asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); |
241 | #endif | 241 | #endif |
242 | 242 | ||
243 | asmlinkage long sys_setxattr(char __user *path, char __user *name, | 243 | asmlinkage long sys_setxattr(const char __user *path, const char __user *name, |
244 | void __user *value, size_t size, int flags); | 244 | const void __user *value, size_t size, int flags); |
245 | asmlinkage long sys_lsetxattr(char __user *path, char __user *name, | 245 | asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name, |
246 | void __user *value, size_t size, int flags); | 246 | const void __user *value, size_t size, int flags); |
247 | asmlinkage long sys_fsetxattr(int fd, char __user *name, void __user *value, | 247 | asmlinkage long sys_fsetxattr(int fd, const char __user *name, |
248 | size_t size, int flags); | 248 | const void __user *value, size_t size, int flags); |
249 | asmlinkage ssize_t sys_getxattr(char __user *path, char __user *name, | 249 | asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name, |
250 | void __user *value, size_t size); | 250 | void __user *value, size_t size); |
251 | asmlinkage ssize_t sys_lgetxattr(char __user *path, char __user *name, | 251 | asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name, |
252 | void __user *value, size_t size); | 252 | void __user *value, size_t size); |
253 | asmlinkage ssize_t sys_fgetxattr(int fd, char __user *name, | 253 | asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name, |
254 | void __user *value, size_t size); | 254 | void __user *value, size_t size); |
255 | asmlinkage ssize_t sys_listxattr(char __user *path, char __user *list, | 255 | asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list, |
256 | size_t size); | 256 | size_t size); |
257 | asmlinkage ssize_t sys_llistxattr(char __user *path, char __user *list, | 257 | asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list, |
258 | size_t size); | 258 | size_t size); |
259 | asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); | 259 | asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); |
260 | asmlinkage long sys_removexattr(char __user *path, char __user *name); | 260 | asmlinkage long sys_removexattr(const char __user *path, |
261 | asmlinkage long sys_lremovexattr(char __user *path, char __user *name); | 261 | const char __user *name); |
262 | asmlinkage long sys_fremovexattr(int fd, char __user *name); | 262 | asmlinkage long sys_lremovexattr(const char __user *path, |
263 | const char __user *name); | ||
264 | asmlinkage long sys_fremovexattr(int fd, const char __user *name); | ||
263 | 265 | ||
264 | asmlinkage unsigned long sys_brk(unsigned long brk); | 266 | asmlinkage unsigned long sys_brk(unsigned long brk); |
265 | asmlinkage long sys_mprotect(unsigned long start, size_t len, | 267 | asmlinkage long sys_mprotect(unsigned long start, size_t len, |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 571f01d20a86..24141b4d1a11 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -945,11 +945,14 @@ enum | |||
945 | /* For the /proc/sys support */ | 945 | /* For the /proc/sys support */ |
946 | struct ctl_table; | 946 | struct ctl_table; |
947 | struct nsproxy; | 947 | struct nsproxy; |
948 | struct ctl_table_root; | ||
949 | |||
948 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | 950 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); |
949 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | 951 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, |
950 | struct ctl_table_header *prev); | 952 | struct ctl_table_header *prev); |
951 | extern void sysctl_head_finish(struct ctl_table_header *prev); | 953 | extern void sysctl_head_finish(struct ctl_table_header *prev); |
952 | extern int sysctl_perm(struct ctl_table *table, int op); | 954 | extern int sysctl_perm(struct ctl_table_root *root, |
955 | struct ctl_table *table, int op); | ||
953 | 956 | ||
954 | typedef struct ctl_table ctl_table; | 957 | typedef struct ctl_table ctl_table; |
955 | 958 | ||
@@ -981,11 +984,6 @@ extern int do_sysctl (int __user *name, int nlen, | |||
981 | void __user *oldval, size_t __user *oldlenp, | 984 | void __user *oldval, size_t __user *oldlenp, |
982 | void __user *newval, size_t newlen); | 985 | void __user *newval, size_t newlen); |
983 | 986 | ||
984 | extern int do_sysctl_strategy (struct ctl_table *table, | ||
985 | int __user *name, int nlen, | ||
986 | void __user *oldval, size_t __user *oldlenp, | ||
987 | void __user *newval, size_t newlen); | ||
988 | |||
989 | extern ctl_handler sysctl_data; | 987 | extern ctl_handler sysctl_data; |
990 | extern ctl_handler sysctl_string; | 988 | extern ctl_handler sysctl_string; |
991 | extern ctl_handler sysctl_intvec; | 989 | extern ctl_handler sysctl_intvec; |
@@ -1054,6 +1052,8 @@ struct ctl_table_root { | |||
1054 | struct list_head header_list; | 1052 | struct list_head header_list; |
1055 | struct list_head *(*lookup)(struct ctl_table_root *root, | 1053 | struct list_head *(*lookup)(struct ctl_table_root *root, |
1056 | struct nsproxy *namespaces); | 1054 | struct nsproxy *namespaces); |
1055 | int (*permissions)(struct ctl_table_root *root, | ||
1056 | struct nsproxy *namespaces, struct ctl_table *table); | ||
1057 | }; | 1057 | }; |
1058 | 1058 | ||
1059 | /* struct ctl_table_header is used to maintain dynamic lists of | 1059 | /* struct ctl_table_header is used to maintain dynamic lists of |
@@ -1085,8 +1085,6 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, | |||
1085 | void unregister_sysctl_table(struct ctl_table_header * table); | 1085 | void unregister_sysctl_table(struct ctl_table_header * table); |
1086 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); | 1086 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); |
1087 | 1087 | ||
1088 | #else /* __KERNEL__ */ | ||
1089 | |||
1090 | #endif /* __KERNEL__ */ | 1088 | #endif /* __KERNEL__ */ |
1091 | 1089 | ||
1092 | #endif /* _LINUX_SYSCTL_H */ | 1090 | #endif /* _LINUX_SYSCTL_H */ |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index add3c5a40827..27bad59dae79 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -190,6 +190,18 @@ static inline int sysfs_create_group(struct kobject *kobj, | |||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
192 | 192 | ||
193 | static inline int sysfs_update_group(struct kobject *kobj, | ||
194 | const struct attribute_group *grp) | ||
195 | { | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static inline int sysfs_update_group(struct kobject *kobj, | ||
200 | const struct attribute_group *grp) | ||
201 | { | ||
202 | return 0; | ||
203 | } | ||
204 | |||
193 | static inline void sysfs_remove_group(struct kobject *kobj, | 205 | static inline void sysfs_remove_group(struct kobject *kobj, |
194 | const struct attribute_group *grp) | 206 | const struct attribute_group *grp) |
195 | { | 207 | { |
diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index e0248631e461..96411306eec6 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h | |||
@@ -1,11 +1,7 @@ | |||
1 | #ifndef _LINUX_SYSV_FS_H | 1 | #ifndef _LINUX_SYSV_FS_H |
2 | #define _LINUX_SYSV_FS_H | 2 | #define _LINUX_SYSV_FS_H |
3 | 3 | ||
4 | #if defined(__GNUC__) | 4 | #define __packed2__ __attribute__((packed, aligned(2))) |
5 | # define __packed2__ __attribute__((packed, aligned(2))) | ||
6 | #else | ||
7 | >> I want to scream! << | ||
8 | #endif | ||
9 | 5 | ||
10 | 6 | ||
11 | #ifndef __KERNEL__ | 7 | #ifndef __KERNEL__ |
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h index 004808a6df1d..6f371f24160b 100644 --- a/include/linux/textsearch.h +++ b/include/linux/textsearch.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef __LINUX_TEXTSEARCH_H | 1 | #ifndef __LINUX_TEXTSEARCH_H |
2 | #define __LINUX_TEXTSEARCH_H | 2 | #define __LINUX_TEXTSEARCH_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/types.h> | 4 | #include <linux/types.h> |
7 | #include <linux/list.h> | 5 | #include <linux/list.h> |
8 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
@@ -177,6 +175,4 @@ static inline void *ts_config_priv(struct ts_config *conf) | |||
177 | return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); | 175 | return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config))); |
178 | } | 176 | } |
179 | 177 | ||
180 | #endif /* __KERNEL__ */ | ||
181 | |||
182 | #endif | 178 | #endif |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 90c1c191ea69..06d3e6eb9ca8 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -41,6 +41,7 @@ struct thermal_zone_device_ops { | |||
41 | int (*set_mode) (struct thermal_zone_device *, const char *); | 41 | int (*set_mode) (struct thermal_zone_device *, const char *); |
42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); | 42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); |
43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); | 43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); |
44 | int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); | ||
44 | }; | 45 | }; |
45 | 46 | ||
46 | struct thermal_cooling_device_ops { | 47 | struct thermal_cooling_device_ops { |
@@ -65,6 +66,23 @@ struct thermal_cooling_device { | |||
65 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) | 66 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) |
66 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) | 67 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) |
67 | 68 | ||
69 | #if defined(CONFIG_HWMON) || \ | ||
70 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
71 | /* thermal zone devices with the same type share one hwmon device */ | ||
72 | struct thermal_hwmon_device { | ||
73 | char type[THERMAL_NAME_LENGTH]; | ||
74 | struct device *device; | ||
75 | int count; | ||
76 | struct list_head tz_list; | ||
77 | struct list_head node; | ||
78 | }; | ||
79 | |||
80 | struct thermal_hwmon_attr { | ||
81 | struct device_attribute attr; | ||
82 | char name[16]; | ||
83 | }; | ||
84 | #endif | ||
85 | |||
68 | struct thermal_zone_device { | 86 | struct thermal_zone_device { |
69 | int id; | 87 | int id; |
70 | char type[THERMAL_NAME_LENGTH]; | 88 | char type[THERMAL_NAME_LENGTH]; |
@@ -76,6 +94,13 @@ struct thermal_zone_device { | |||
76 | struct idr idr; | 94 | struct idr idr; |
77 | struct mutex lock; /* protect cooling devices list */ | 95 | struct mutex lock; /* protect cooling devices list */ |
78 | struct list_head node; | 96 | struct list_head node; |
97 | #if defined(CONFIG_HWMON) || \ | ||
98 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
99 | struct list_head hwmon_node; | ||
100 | struct thermal_hwmon_device *hwmon; | ||
101 | struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ | ||
102 | struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */ | ||
103 | #endif | ||
79 | }; | 104 | }; |
80 | 105 | ||
81 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, | 106 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, |
@@ -88,24 +113,10 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | |||
88 | struct thermal_cooling_device *); | 113 | struct thermal_cooling_device *); |
89 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, | 114 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, |
90 | struct thermal_cooling_device *); | 115 | struct thermal_cooling_device *); |
91 | |||
92 | #ifdef CONFIG_THERMAL | ||
93 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 116 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
94 | struct | 117 | struct |
95 | thermal_cooling_device_ops | 118 | thermal_cooling_device_ops |
96 | *); | 119 | *); |
97 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 120 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
98 | #else | ||
99 | static inline struct thermal_cooling_device | ||
100 | *thermal_cooling_device_register(char *c, void *v, | ||
101 | struct thermal_cooling_device_ops *t) | ||
102 | { | ||
103 | return NULL; | ||
104 | } | ||
105 | static inline | ||
106 | void thermal_cooling_device_unregister(struct thermal_cooling_device *t) | ||
107 | { | ||
108 | }; | ||
109 | #endif | ||
110 | 121 | ||
111 | #endif /* __THERMAL_H__ */ | 122 | #endif /* __THERMAL_H__ */ |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index accd7bad35b0..38a56477f27a 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
@@ -92,6 +92,31 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) | |||
92 | #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) | 92 | #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) |
93 | #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) | 93 | #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) |
94 | 94 | ||
95 | #endif | 95 | #if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK |
96 | /* | ||
97 | * An arch can define its own version of set_restore_sigmask() to get the | ||
98 | * job done however works, with or without TIF_RESTORE_SIGMASK. | ||
99 | */ | ||
100 | #define HAVE_SET_RESTORE_SIGMASK 1 | ||
101 | |||
102 | /** | ||
103 | * set_restore_sigmask() - make sure saved_sigmask processing gets done | ||
104 | * | ||
105 | * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code | ||
106 | * will run before returning to user mode, to process the flag. For | ||
107 | * all callers, TIF_SIGPENDING is already set or it's no harm to set | ||
108 | * it. TIF_RESTORE_SIGMASK need not be in the set of bits that the | ||
109 | * arch code will notice on return to user mode, in case those bits | ||
110 | * are scarce. We set TIF_SIGPENDING here to ensure that the arch | ||
111 | * signal code always gets run when TIF_RESTORE_SIGMASK is set. | ||
112 | */ | ||
113 | static inline void set_restore_sigmask(void) | ||
114 | { | ||
115 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
116 | set_thread_flag(TIF_SIGPENDING); | ||
117 | } | ||
118 | #endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */ | ||
119 | |||
120 | #endif /* __KERNEL__ */ | ||
96 | 121 | ||
97 | #endif /* _LINUX_THREAD_INFO_H */ | 122 | #endif /* _LINUX_THREAD_INFO_H */ |
diff --git a/include/linux/timer.h b/include/linux/timer.h index 979fefdeb862..d4ba79248a27 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/ktime.h> | 5 | #include <linux/ktime.h> |
6 | #include <linux/stddef.h> | 6 | #include <linux/stddef.h> |
7 | #include <linux/debugobjects.h> | ||
7 | 8 | ||
8 | struct tvec_base; | 9 | struct tvec_base; |
9 | 10 | ||
@@ -25,6 +26,7 @@ struct timer_list { | |||
25 | extern struct tvec_base boot_tvec_bases; | 26 | extern struct tvec_base boot_tvec_bases; |
26 | 27 | ||
27 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ | 28 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ |
29 | .entry = { .prev = TIMER_ENTRY_STATIC }, \ | ||
28 | .function = (_function), \ | 30 | .function = (_function), \ |
29 | .expires = (_expires), \ | 31 | .expires = (_expires), \ |
30 | .data = (_data), \ | 32 | .data = (_data), \ |
@@ -38,6 +40,17 @@ extern struct tvec_base boot_tvec_bases; | |||
38 | void init_timer(struct timer_list *timer); | 40 | void init_timer(struct timer_list *timer); |
39 | void init_timer_deferrable(struct timer_list *timer); | 41 | void init_timer_deferrable(struct timer_list *timer); |
40 | 42 | ||
43 | #ifdef CONFIG_DEBUG_OBJECTS_TIMERS | ||
44 | extern void init_timer_on_stack(struct timer_list *timer); | ||
45 | extern void destroy_timer_on_stack(struct timer_list *timer); | ||
46 | #else | ||
47 | static inline void destroy_timer_on_stack(struct timer_list *timer) { } | ||
48 | static inline void init_timer_on_stack(struct timer_list *timer) | ||
49 | { | ||
50 | init_timer(timer); | ||
51 | } | ||
52 | #endif | ||
53 | |||
41 | static inline void setup_timer(struct timer_list * timer, | 54 | static inline void setup_timer(struct timer_list * timer, |
42 | void (*function)(unsigned long), | 55 | void (*function)(unsigned long), |
43 | unsigned long data) | 56 | unsigned long data) |
@@ -47,6 +60,15 @@ static inline void setup_timer(struct timer_list * timer, | |||
47 | init_timer(timer); | 60 | init_timer(timer); |
48 | } | 61 | } |
49 | 62 | ||
63 | static inline void setup_timer_on_stack(struct timer_list *timer, | ||
64 | void (*function)(unsigned long), | ||
65 | unsigned long data) | ||
66 | { | ||
67 | timer->function = function; | ||
68 | timer->data = data; | ||
69 | init_timer_on_stack(timer); | ||
70 | } | ||
71 | |||
50 | /** | 72 | /** |
51 | * timer_pending - is a timer pending? | 73 | * timer_pending - is a timer pending? |
52 | * @timer: the timer in question | 74 | * @timer: the timer in question |
@@ -164,5 +186,4 @@ unsigned long __round_jiffies_relative(unsigned long j, int cpu); | |||
164 | unsigned long round_jiffies(unsigned long j); | 186 | unsigned long round_jiffies(unsigned long j); |
165 | unsigned long round_jiffies_relative(unsigned long j); | 187 | unsigned long round_jiffies_relative(unsigned long j); |
166 | 188 | ||
167 | |||
168 | #endif | 189 | #endif |
diff --git a/include/linux/timex.h b/include/linux/timex.h index 8ea3e71ba7fa..fc6035d29d56 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -58,6 +58,8 @@ | |||
58 | 58 | ||
59 | #include <asm/param.h> | 59 | #include <asm/param.h> |
60 | 60 | ||
61 | #define NTP_API 4 /* NTP API version */ | ||
62 | |||
61 | /* | 63 | /* |
62 | * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen | 64 | * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen |
63 | * for a slightly underdamped convergence characteristic. SHIFT_KH | 65 | * for a slightly underdamped convergence characteristic. SHIFT_KH |
@@ -74,24 +76,22 @@ | |||
74 | #define MAXTC 10 /* maximum time constant (shift) */ | 76 | #define MAXTC 10 /* maximum time constant (shift) */ |
75 | 77 | ||
76 | /* | 78 | /* |
77 | * The SHIFT_UPDATE define establishes the decimal point of the | ||
78 | * time_offset variable which represents the current offset with | ||
79 | * respect to standard time. | ||
80 | * | ||
81 | * SHIFT_USEC defines the scaling (shift) of the time_freq and | 79 | * SHIFT_USEC defines the scaling (shift) of the time_freq and |
82 | * time_tolerance variables, which represent the current frequency | 80 | * time_tolerance variables, which represent the current frequency |
83 | * offset and maximum frequency tolerance. | 81 | * offset and maximum frequency tolerance. |
84 | */ | 82 | */ |
85 | #define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */ | ||
86 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ | 83 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ |
87 | #define SHIFT_NSEC 12 /* kernel frequency offset scale */ | 84 | #define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) |
88 | 85 | #define PPM_SCALE_INV_SHIFT 20 | |
89 | #define MAXPHASE 512000L /* max phase error (us) */ | 86 | #define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ |
90 | #define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ | 87 | PPM_SCALE + 1) |
91 | #define MAXFREQ_NSEC (512000L << SHIFT_NSEC) /* max frequency error (ppb) */ | 88 | |
89 | #define MAXPHASE 500000000l /* max phase error (ns) */ | ||
90 | #define MAXFREQ 500000 /* max frequency error (ns/s) */ | ||
91 | #define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) | ||
92 | #define MINSEC 256 /* min interval between updates (s) */ | 92 | #define MINSEC 256 /* min interval between updates (s) */ |
93 | #define MAXSEC 2048 /* max interval between updates (s) */ | 93 | #define MAXSEC 2048 /* max interval between updates (s) */ |
94 | #define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ | 94 | #define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */ |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * syscall interface - used (mainly by NTP daemon) | 97 | * syscall interface - used (mainly by NTP daemon) |
@@ -121,9 +121,11 @@ struct timex { | |||
121 | long errcnt; /* calibration errors (ro) */ | 121 | long errcnt; /* calibration errors (ro) */ |
122 | long stbcnt; /* stability limit exceeded (ro) */ | 122 | long stbcnt; /* stability limit exceeded (ro) */ |
123 | 123 | ||
124 | int tai; /* TAI offset (ro) */ | ||
125 | |||
124 | int :32; int :32; int :32; int :32; | 126 | int :32; int :32; int :32; int :32; |
125 | int :32; int :32; int :32; int :32; | 127 | int :32; int :32; int :32; int :32; |
126 | int :32; int :32; int :32; int :32; | 128 | int :32; int :32; int :32; |
127 | }; | 129 | }; |
128 | 130 | ||
129 | /* | 131 | /* |
@@ -135,6 +137,9 @@ struct timex { | |||
135 | #define ADJ_ESTERROR 0x0008 /* estimated time error */ | 137 | #define ADJ_ESTERROR 0x0008 /* estimated time error */ |
136 | #define ADJ_STATUS 0x0010 /* clock status */ | 138 | #define ADJ_STATUS 0x0010 /* clock status */ |
137 | #define ADJ_TIMECONST 0x0020 /* pll time constant */ | 139 | #define ADJ_TIMECONST 0x0020 /* pll time constant */ |
140 | #define ADJ_TAI 0x0080 /* set TAI offset */ | ||
141 | #define ADJ_MICRO 0x1000 /* select microsecond resolution */ | ||
142 | #define ADJ_NANO 0x2000 /* select nanosecond resolution */ | ||
138 | #define ADJ_TICK 0x4000 /* tick value */ | 143 | #define ADJ_TICK 0x4000 /* tick value */ |
139 | #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ | 144 | #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ |
140 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ | 145 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ |
@@ -146,8 +151,6 @@ struct timex { | |||
146 | #define MOD_ESTERROR ADJ_ESTERROR | 151 | #define MOD_ESTERROR ADJ_ESTERROR |
147 | #define MOD_STATUS ADJ_STATUS | 152 | #define MOD_STATUS ADJ_STATUS |
148 | #define MOD_TIMECONST ADJ_TIMECONST | 153 | #define MOD_TIMECONST ADJ_TIMECONST |
149 | #define MOD_CLKB ADJ_TICK | ||
150 | #define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ | ||
151 | 154 | ||
152 | 155 | ||
153 | /* | 156 | /* |
@@ -169,9 +172,13 @@ struct timex { | |||
169 | #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ | 172 | #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ |
170 | 173 | ||
171 | #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ | 174 | #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ |
175 | #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ | ||
176 | #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ | ||
177 | #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ | ||
172 | 178 | ||
179 | /* read-only bits */ | ||
173 | #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ | 180 | #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ |
174 | STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ | 181 | STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) |
175 | 182 | ||
176 | /* | 183 | /* |
177 | * Clock states (time_state) | 184 | * Clock states (time_state) |
@@ -203,10 +210,9 @@ extern int time_status; /* clock synchronization status bits */ | |||
203 | extern long time_maxerror; /* maximum error */ | 210 | extern long time_maxerror; /* maximum error */ |
204 | extern long time_esterror; /* estimated error */ | 211 | extern long time_esterror; /* estimated error */ |
205 | 212 | ||
206 | extern long time_freq; /* frequency offset (scaled ppm) */ | ||
207 | |||
208 | extern long time_adjust; /* The amount of adjtime left */ | 213 | extern long time_adjust; /* The amount of adjtime left */ |
209 | 214 | ||
215 | extern void ntp_init(void); | ||
210 | extern void ntp_clear(void); | 216 | extern void ntp_clear(void); |
211 | 217 | ||
212 | /** | 218 | /** |
@@ -225,7 +231,7 @@ static inline int ntp_synced(void) | |||
225 | __x < 0 ? -(-__x >> __s) : __x >> __s; \ | 231 | __x < 0 ? -(-__x >> __s) : __x >> __s; \ |
226 | }) | 232 | }) |
227 | 233 | ||
228 | #define TICK_LENGTH_SHIFT 32 | 234 | #define NTP_SCALE_SHIFT 32 |
229 | 235 | ||
230 | #ifdef CONFIG_NO_HZ | 236 | #ifdef CONFIG_NO_HZ |
231 | #define NTP_INTERVAL_FREQ (2) | 237 | #define NTP_INTERVAL_FREQ (2) |
@@ -234,8 +240,8 @@ static inline int ntp_synced(void) | |||
234 | #endif | 240 | #endif |
235 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 241 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
236 | 242 | ||
237 | /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ | 243 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ |
238 | extern u64 current_tick_length(void); | 244 | extern u64 tick_length; |
239 | 245 | ||
240 | extern void second_overflow(void); | 246 | extern void second_overflow(void); |
241 | extern void update_ntp_one_tick(void); | 247 | extern void update_ntp_one_tick(void); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index dd8e08fe8855..7f7121f9c968 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -177,27 +177,33 @@ struct signal_struct; | |||
177 | * size each time the window is created or resized anyway. | 177 | * size each time the window is created or resized anyway. |
178 | * - TYT, 9/14/92 | 178 | * - TYT, 9/14/92 |
179 | */ | 179 | */ |
180 | |||
181 | struct tty_operations; | ||
182 | |||
180 | struct tty_struct { | 183 | struct tty_struct { |
181 | int magic; | 184 | int magic; |
182 | struct tty_driver *driver; | 185 | struct tty_driver *driver; |
186 | const struct tty_operations *ops; | ||
183 | int index; | 187 | int index; |
184 | struct tty_ldisc ldisc; | 188 | struct tty_ldisc ldisc; |
185 | struct mutex termios_mutex; | 189 | struct mutex termios_mutex; |
190 | spinlock_t ctrl_lock; | ||
191 | /* Termios values are protected by the termios mutex */ | ||
186 | struct ktermios *termios, *termios_locked; | 192 | struct ktermios *termios, *termios_locked; |
187 | char name[64]; | 193 | char name[64]; |
188 | struct pid *pgrp; | 194 | struct pid *pgrp; /* Protected by ctrl lock */ |
189 | struct pid *session; | 195 | struct pid *session; |
190 | unsigned long flags; | 196 | unsigned long flags; |
191 | int count; | 197 | int count; |
192 | struct winsize winsize; | 198 | struct winsize winsize; /* termios mutex */ |
193 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; | 199 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; |
194 | unsigned char low_latency:1, warned:1; | 200 | unsigned char low_latency:1, warned:1; |
195 | unsigned char ctrl_status; | 201 | unsigned char ctrl_status; /* ctrl_lock */ |
196 | unsigned int receive_room; /* Bytes free for queue */ | 202 | unsigned int receive_room; /* Bytes free for queue */ |
197 | 203 | ||
198 | struct tty_struct *link; | 204 | struct tty_struct *link; |
199 | struct fasync_struct *fasync; | 205 | struct fasync_struct *fasync; |
200 | struct tty_bufhead buf; | 206 | struct tty_bufhead buf; /* Locked internally */ |
201 | int alt_speed; /* For magic substitution of 38400 bps */ | 207 | int alt_speed; /* For magic substitution of 38400 bps */ |
202 | wait_queue_head_t write_wait; | 208 | wait_queue_head_t write_wait; |
203 | wait_queue_head_t read_wait; | 209 | wait_queue_head_t read_wait; |
@@ -211,6 +217,7 @@ struct tty_struct { | |||
211 | /* | 217 | /* |
212 | * The following is data for the N_TTY line discipline. For | 218 | * The following is data for the N_TTY line discipline. For |
213 | * historical reasons, this is included in the tty structure. | 219 | * historical reasons, this is included in the tty structure. |
220 | * Mostly locked by the BKL. | ||
214 | */ | 221 | */ |
215 | unsigned int column; | 222 | unsigned int column; |
216 | unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1; | 223 | unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1; |
@@ -292,15 +299,21 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index); | |||
292 | extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, | 299 | extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, |
293 | int buflen); | 300 | int buflen); |
294 | extern void tty_write_message(struct tty_struct *tty, char *msg); | 301 | extern void tty_write_message(struct tty_struct *tty, char *msg); |
302 | extern int tty_put_char(struct tty_struct *tty, unsigned char c); | ||
303 | extern int tty_chars_in_buffer(struct tty_struct *tty); | ||
304 | extern int tty_write_room(struct tty_struct *tty); | ||
305 | extern void tty_driver_flush_buffer(struct tty_struct *tty); | ||
306 | extern void tty_throttle(struct tty_struct *tty); | ||
307 | extern void tty_unthrottle(struct tty_struct *tty); | ||
295 | 308 | ||
296 | extern int is_current_pgrp_orphaned(void); | 309 | extern int is_current_pgrp_orphaned(void); |
310 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); | ||
297 | extern int is_ignored(int sig); | 311 | extern int is_ignored(int sig); |
298 | extern int tty_signal(int sig, struct tty_struct *tty); | 312 | extern int tty_signal(int sig, struct tty_struct *tty); |
299 | extern void tty_hangup(struct tty_struct * tty); | 313 | extern void tty_hangup(struct tty_struct * tty); |
300 | extern void tty_vhangup(struct tty_struct * tty); | 314 | extern void tty_vhangup(struct tty_struct * tty); |
301 | extern void tty_unhangup(struct file *filp); | 315 | extern void tty_unhangup(struct file *filp); |
302 | extern int tty_hung_up_p(struct file * filp); | 316 | extern int tty_hung_up_p(struct file * filp); |
303 | extern int is_tty(struct file *filp); | ||
304 | extern void do_SAK(struct tty_struct *tty); | 317 | extern void do_SAK(struct tty_struct *tty); |
305 | extern void __do_SAK(struct tty_struct *tty); | 318 | extern void __do_SAK(struct tty_struct *tty); |
306 | extern void disassociate_ctty(int priv); | 319 | extern void disassociate_ctty(int priv); |
@@ -324,8 +337,7 @@ extern void tty_ldisc_put(int); | |||
324 | extern void tty_wakeup(struct tty_struct *tty); | 337 | extern void tty_wakeup(struct tty_struct *tty); |
325 | extern void tty_ldisc_flush(struct tty_struct *tty); | 338 | extern void tty_ldisc_flush(struct tty_struct *tty); |
326 | 339 | ||
327 | extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 340 | extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
328 | unsigned long arg); | ||
329 | extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | 341 | extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, |
330 | unsigned int cmd, unsigned long arg); | 342 | unsigned int cmd, unsigned long arg); |
331 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); | 343 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); |
@@ -351,8 +363,7 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, | |||
351 | extern void tty_audit_exit(void); | 363 | extern void tty_audit_exit(void); |
352 | extern void tty_audit_fork(struct signal_struct *sig); | 364 | extern void tty_audit_fork(struct signal_struct *sig); |
353 | extern void tty_audit_push(struct tty_struct *tty); | 365 | extern void tty_audit_push(struct tty_struct *tty); |
354 | extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid); | 366 | extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid); |
355 | extern void tty_audit_opening(void); | ||
356 | #else | 367 | #else |
357 | static inline void tty_audit_add_data(struct tty_struct *tty, | 368 | static inline void tty_audit_add_data(struct tty_struct *tty, |
358 | unsigned char *data, size_t size) | 369 | unsigned char *data, size_t size) |
@@ -367,10 +378,7 @@ static inline void tty_audit_fork(struct signal_struct *sig) | |||
367 | static inline void tty_audit_push(struct tty_struct *tty) | 378 | static inline void tty_audit_push(struct tty_struct *tty) |
368 | { | 379 | { |
369 | } | 380 | } |
370 | static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid) | 381 | static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) |
371 | { | ||
372 | } | ||
373 | static inline void tty_audit_opening(void) | ||
374 | { | 382 | { |
375 | } | 383 | } |
376 | #endif | 384 | #endif |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 21f69aca4505..59f1c0bd8f9c 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -12,11 +12,15 @@ | |||
12 | * This routine is called when a particular tty device is opened. | 12 | * This routine is called when a particular tty device is opened. |
13 | * This routine is mandatory; if this routine is not filled in, | 13 | * This routine is mandatory; if this routine is not filled in, |
14 | * the attempted open will fail with ENODEV. | 14 | * the attempted open will fail with ENODEV. |
15 | * | ||
16 | * Required method. | ||
15 | * | 17 | * |
16 | * void (*close)(struct tty_struct * tty, struct file * filp); | 18 | * void (*close)(struct tty_struct * tty, struct file * filp); |
17 | * | 19 | * |
18 | * This routine is called when a particular tty device is closed. | 20 | * This routine is called when a particular tty device is closed. |
19 | * | 21 | * |
22 | * Required method. | ||
23 | * | ||
20 | * int (*write)(struct tty_struct * tty, | 24 | * int (*write)(struct tty_struct * tty, |
21 | * const unsigned char *buf, int count); | 25 | * const unsigned char *buf, int count); |
22 | * | 26 | * |
@@ -26,7 +30,9 @@ | |||
26 | * number of characters actually accepted for writing. This | 30 | * number of characters actually accepted for writing. This |
27 | * routine is mandatory. | 31 | * routine is mandatory. |
28 | * | 32 | * |
29 | * void (*put_char)(struct tty_struct *tty, unsigned char ch); | 33 | * Optional: Required for writable devices. |
34 | * | ||
35 | * int (*put_char)(struct tty_struct *tty, unsigned char ch); | ||
30 | * | 36 | * |
31 | * This routine is called by the kernel to write a single | 37 | * This routine is called by the kernel to write a single |
32 | * character to the tty device. If the kernel uses this routine, | 38 | * character to the tty device. If the kernel uses this routine, |
@@ -34,10 +40,18 @@ | |||
34 | * done stuffing characters into the driver. If there is no room | 40 | * done stuffing characters into the driver. If there is no room |
35 | * in the queue, the character is ignored. | 41 | * in the queue, the character is ignored. |
36 | * | 42 | * |
43 | * Optional: Kernel will use the write method if not provided. | ||
44 | * | ||
45 | * Note: Do not call this function directly, call tty_put_char | ||
46 | * | ||
37 | * void (*flush_chars)(struct tty_struct *tty); | 47 | * void (*flush_chars)(struct tty_struct *tty); |
38 | * | 48 | * |
39 | * This routine is called by the kernel after it has written a | 49 | * This routine is called by the kernel after it has written a |
40 | * series of characters to the tty device using put_char(). | 50 | * series of characters to the tty device using put_char(). |
51 | * | ||
52 | * Optional: | ||
53 | * | ||
54 | * Note: Do not call this function directly, call tty_driver_flush_chars | ||
41 | * | 55 | * |
42 | * int (*write_room)(struct tty_struct *tty); | 56 | * int (*write_room)(struct tty_struct *tty); |
43 | * | 57 | * |
@@ -45,6 +59,10 @@ | |||
45 | * will accept for queuing to be written. This number is subject | 59 | * will accept for queuing to be written. This number is subject |
46 | * to change as output buffers get emptied, or if the output flow | 60 | * to change as output buffers get emptied, or if the output flow |
47 | * control is acted. | 61 | * control is acted. |
62 | * | ||
63 | * Required if write method is provided else not needed. | ||
64 | * | ||
65 | * Note: Do not call this function directly, call tty_write_room | ||
48 | * | 66 | * |
49 | * int (*ioctl)(struct tty_struct *tty, struct file * file, | 67 | * int (*ioctl)(struct tty_struct *tty, struct file * file, |
50 | * unsigned int cmd, unsigned long arg); | 68 | * unsigned int cmd, unsigned long arg); |
@@ -53,28 +71,37 @@ | |||
53 | * device-specific ioctl's. If the ioctl number passed in cmd | 71 | * device-specific ioctl's. If the ioctl number passed in cmd |
54 | * is not recognized by the driver, it should return ENOIOCTLCMD. | 72 | * is not recognized by the driver, it should return ENOIOCTLCMD. |
55 | * | 73 | * |
74 | * Optional | ||
75 | * | ||
56 | * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, | 76 | * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, |
57 | * unsigned int cmd, unsigned long arg); | 77 | * unsigned int cmd, unsigned long arg); |
58 | * | 78 | * |
59 | * implement ioctl processing for 32 bit process on 64 bit system | 79 | * implement ioctl processing for 32 bit process on 64 bit system |
80 | * | ||
81 | * Optional | ||
60 | * | 82 | * |
61 | * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); | 83 | * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); |
62 | * | 84 | * |
63 | * This routine allows the tty driver to be notified when | 85 | * This routine allows the tty driver to be notified when |
64 | * device's termios settings have changed. Note that a | 86 | * device's termios settings have changed. |
65 | * well-designed tty driver should be prepared to accept the case | 87 | * |
66 | * where old == NULL, and try to do something rational. | 88 | * Optional: Called under the termios lock |
89 | * | ||
67 | * | 90 | * |
68 | * void (*set_ldisc)(struct tty_struct *tty); | 91 | * void (*set_ldisc)(struct tty_struct *tty); |
69 | * | 92 | * |
70 | * This routine allows the tty driver to be notified when the | 93 | * This routine allows the tty driver to be notified when the |
71 | * device's termios settings have changed. | 94 | * device's termios settings have changed. |
95 | * | ||
96 | * Optional: Called under BKL (currently) | ||
72 | * | 97 | * |
73 | * void (*throttle)(struct tty_struct * tty); | 98 | * void (*throttle)(struct tty_struct * tty); |
74 | * | 99 | * |
75 | * This routine notifies the tty driver that input buffers for | 100 | * This routine notifies the tty driver that input buffers for |
76 | * the line discipline are close to full, and it should somehow | 101 | * the line discipline are close to full, and it should somehow |
77 | * signal that no more characters should be sent to the tty. | 102 | * signal that no more characters should be sent to the tty. |
103 | * | ||
104 | * Optional: Always invoke via tty_throttle(); | ||
78 | * | 105 | * |
79 | * void (*unthrottle)(struct tty_struct * tty); | 106 | * void (*unthrottle)(struct tty_struct * tty); |
80 | * | 107 | * |
@@ -82,21 +109,33 @@ | |||
82 | * that characters can now be sent to the tty without fear of | 109 | * that characters can now be sent to the tty without fear of |
83 | * overrunning the input buffers of the line disciplines. | 110 | * overrunning the input buffers of the line disciplines. |
84 | * | 111 | * |
112 | * Optional: Always invoke via tty_unthrottle(); | ||
113 | * | ||
85 | * void (*stop)(struct tty_struct *tty); | 114 | * void (*stop)(struct tty_struct *tty); |
86 | * | 115 | * |
87 | * This routine notifies the tty driver that it should stop | 116 | * This routine notifies the tty driver that it should stop |
88 | * outputting characters to the tty device. | 117 | * outputting characters to the tty device. |
118 | * | ||
119 | * Optional: | ||
120 | * | ||
121 | * Note: Call stop_tty not this method. | ||
89 | * | 122 | * |
90 | * void (*start)(struct tty_struct *tty); | 123 | * void (*start)(struct tty_struct *tty); |
91 | * | 124 | * |
92 | * This routine notifies the tty driver that it resume sending | 125 | * This routine notifies the tty driver that it resume sending |
93 | * characters to the tty device. | 126 | * characters to the tty device. |
127 | * | ||
128 | * Optional: | ||
129 | * | ||
130 | * Note: Call start_tty not this method. | ||
94 | * | 131 | * |
95 | * void (*hangup)(struct tty_struct *tty); | 132 | * void (*hangup)(struct tty_struct *tty); |
96 | * | 133 | * |
97 | * This routine notifies the tty driver that it should hangup the | 134 | * This routine notifies the tty driver that it should hangup the |
98 | * tty device. | 135 | * tty device. |
99 | * | 136 | * |
137 | * Required: | ||
138 | * | ||
100 | * void (*break_ctl)(struct tty_stuct *tty, int state); | 139 | * void (*break_ctl)(struct tty_stuct *tty, int state); |
101 | * | 140 | * |
102 | * This optional routine requests the tty driver to turn on or | 141 | * This optional routine requests the tty driver to turn on or |
@@ -106,18 +145,26 @@ | |||
106 | * | 145 | * |
107 | * If this routine is implemented, the high-level tty driver will | 146 | * If this routine is implemented, the high-level tty driver will |
108 | * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, | 147 | * handle the following ioctls: TCSBRK, TCSBRKP, TIOCSBRK, |
109 | * TIOCCBRK. Otherwise, these ioctls will be passed down to the | 148 | * TIOCCBRK. |
110 | * driver to handle. | 149 | * |
150 | * Optional: Required for TCSBRK/BRKP/etc handling. | ||
111 | * | 151 | * |
112 | * void (*wait_until_sent)(struct tty_struct *tty, int timeout); | 152 | * void (*wait_until_sent)(struct tty_struct *tty, int timeout); |
113 | * | 153 | * |
114 | * This routine waits until the device has written out all of the | 154 | * This routine waits until the device has written out all of the |
115 | * characters in its transmitter FIFO. | 155 | * characters in its transmitter FIFO. |
116 | * | 156 | * |
157 | * Optional: If not provided the device is assumed to have no FIFO | ||
158 | * | ||
159 | * Note: Usually correct to call tty_wait_until_sent | ||
160 | * | ||
117 | * void (*send_xchar)(struct tty_struct *tty, char ch); | 161 | * void (*send_xchar)(struct tty_struct *tty, char ch); |
118 | * | 162 | * |
119 | * This routine is used to send a high-priority XON/XOFF | 163 | * This routine is used to send a high-priority XON/XOFF |
120 | * character to the device. | 164 | * character to the device. |
165 | * | ||
166 | * Optional: If not provided then the write method is called under | ||
167 | * the atomic write lock to keep it serialized with the ldisc. | ||
121 | */ | 168 | */ |
122 | 169 | ||
123 | #include <linux/fs.h> | 170 | #include <linux/fs.h> |
@@ -132,7 +179,7 @@ struct tty_operations { | |||
132 | void (*close)(struct tty_struct * tty, struct file * filp); | 179 | void (*close)(struct tty_struct * tty, struct file * filp); |
133 | int (*write)(struct tty_struct * tty, | 180 | int (*write)(struct tty_struct * tty, |
134 | const unsigned char *buf, int count); | 181 | const unsigned char *buf, int count); |
135 | void (*put_char)(struct tty_struct *tty, unsigned char ch); | 182 | int (*put_char)(struct tty_struct *tty, unsigned char ch); |
136 | void (*flush_chars)(struct tty_struct *tty); | 183 | void (*flush_chars)(struct tty_struct *tty); |
137 | int (*write_room)(struct tty_struct *tty); | 184 | int (*write_room)(struct tty_struct *tty); |
138 | int (*chars_in_buffer)(struct tty_struct *tty); | 185 | int (*chars_in_buffer)(struct tty_struct *tty); |
@@ -153,8 +200,6 @@ struct tty_operations { | |||
153 | void (*send_xchar)(struct tty_struct *tty, char ch); | 200 | void (*send_xchar)(struct tty_struct *tty, char ch); |
154 | int (*read_proc)(char *page, char **start, off_t off, | 201 | int (*read_proc)(char *page, char **start, off_t off, |
155 | int count, int *eof, void *data); | 202 | int count, int *eof, void *data); |
156 | int (*write_proc)(struct file *file, const char __user *buffer, | ||
157 | unsigned long count, void *data); | ||
158 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 203 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
159 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 204 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
160 | unsigned int set, unsigned int clear); | 205 | unsigned int set, unsigned int clear); |
@@ -190,48 +235,13 @@ struct tty_driver { | |||
190 | struct tty_struct **ttys; | 235 | struct tty_struct **ttys; |
191 | struct ktermios **termios; | 236 | struct ktermios **termios; |
192 | struct ktermios **termios_locked; | 237 | struct ktermios **termios_locked; |
193 | void *driver_state; /* only used for the PTY driver */ | 238 | void *driver_state; |
194 | 239 | ||
195 | /* | 240 | /* |
196 | * Interface routines from the upper tty layer to the tty | 241 | * Driver methods |
197 | * driver. Will be replaced with struct tty_operations. | ||
198 | */ | 242 | */ |
199 | int (*open)(struct tty_struct * tty, struct file * filp); | ||
200 | void (*close)(struct tty_struct * tty, struct file * filp); | ||
201 | int (*write)(struct tty_struct * tty, | ||
202 | const unsigned char *buf, int count); | ||
203 | void (*put_char)(struct tty_struct *tty, unsigned char ch); | ||
204 | void (*flush_chars)(struct tty_struct *tty); | ||
205 | int (*write_room)(struct tty_struct *tty); | ||
206 | int (*chars_in_buffer)(struct tty_struct *tty); | ||
207 | int (*ioctl)(struct tty_struct *tty, struct file * file, | ||
208 | unsigned int cmd, unsigned long arg); | ||
209 | long (*compat_ioctl)(struct tty_struct *tty, struct file * file, | ||
210 | unsigned int cmd, unsigned long arg); | ||
211 | void (*set_termios)(struct tty_struct *tty, struct ktermios * old); | ||
212 | void (*throttle)(struct tty_struct * tty); | ||
213 | void (*unthrottle)(struct tty_struct * tty); | ||
214 | void (*stop)(struct tty_struct *tty); | ||
215 | void (*start)(struct tty_struct *tty); | ||
216 | void (*hangup)(struct tty_struct *tty); | ||
217 | void (*break_ctl)(struct tty_struct *tty, int state); | ||
218 | void (*flush_buffer)(struct tty_struct *tty); | ||
219 | void (*set_ldisc)(struct tty_struct *tty); | ||
220 | void (*wait_until_sent)(struct tty_struct *tty, int timeout); | ||
221 | void (*send_xchar)(struct tty_struct *tty, char ch); | ||
222 | int (*read_proc)(char *page, char **start, off_t off, | ||
223 | int count, int *eof, void *data); | ||
224 | int (*write_proc)(struct file *file, const char __user *buffer, | ||
225 | unsigned long count, void *data); | ||
226 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | ||
227 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | ||
228 | unsigned int set, unsigned int clear); | ||
229 | #ifdef CONFIG_CONSOLE_POLL | ||
230 | int (*poll_init)(struct tty_driver *driver, int line, char *options); | ||
231 | int (*poll_get_char)(struct tty_driver *driver, int line); | ||
232 | void (*poll_put_char)(struct tty_driver *driver, int line, char ch); | ||
233 | #endif | ||
234 | 243 | ||
244 | const struct tty_operations *ops; | ||
235 | struct list_head tty_drivers; | 245 | struct list_head tty_drivers; |
236 | }; | 246 | }; |
237 | 247 | ||
diff --git a/include/linux/unaligned/access_ok.h b/include/linux/unaligned/access_ok.h new file mode 100644 index 000000000000..99c1b4d20b0f --- /dev/null +++ b/include/linux/unaligned/access_ok.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_ACCESS_OK_H | ||
2 | #define _LINUX_UNALIGNED_ACCESS_OK_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | #include <asm/byteorder.h> | ||
6 | |||
7 | static inline u16 get_unaligned_le16(const void *p) | ||
8 | { | ||
9 | return le16_to_cpup((__le16 *)p); | ||
10 | } | ||
11 | |||
12 | static inline u32 get_unaligned_le32(const void *p) | ||
13 | { | ||
14 | return le32_to_cpup((__le32 *)p); | ||
15 | } | ||
16 | |||
17 | static inline u64 get_unaligned_le64(const void *p) | ||
18 | { | ||
19 | return le64_to_cpup((__le64 *)p); | ||
20 | } | ||
21 | |||
22 | static inline u16 get_unaligned_be16(const void *p) | ||
23 | { | ||
24 | return be16_to_cpup((__be16 *)p); | ||
25 | } | ||
26 | |||
27 | static inline u32 get_unaligned_be32(const void *p) | ||
28 | { | ||
29 | return be32_to_cpup((__be32 *)p); | ||
30 | } | ||
31 | |||
32 | static inline u64 get_unaligned_be64(const void *p) | ||
33 | { | ||
34 | return be64_to_cpup((__be64 *)p); | ||
35 | } | ||
36 | |||
37 | static inline void put_unaligned_le16(u16 val, void *p) | ||
38 | { | ||
39 | *((__le16 *)p) = cpu_to_le16(val); | ||
40 | } | ||
41 | |||
42 | static inline void put_unaligned_le32(u32 val, void *p) | ||
43 | { | ||
44 | *((__le32 *)p) = cpu_to_le32(val); | ||
45 | } | ||
46 | |||
47 | static inline void put_unaligned_le64(u64 val, void *p) | ||
48 | { | ||
49 | *((__le64 *)p) = cpu_to_le64(val); | ||
50 | } | ||
51 | |||
52 | static inline void put_unaligned_be16(u16 val, void *p) | ||
53 | { | ||
54 | *((__be16 *)p) = cpu_to_be16(val); | ||
55 | } | ||
56 | |||
57 | static inline void put_unaligned_be32(u32 val, void *p) | ||
58 | { | ||
59 | *((__be32 *)p) = cpu_to_be32(val); | ||
60 | } | ||
61 | |||
62 | static inline void put_unaligned_be64(u64 val, void *p) | ||
63 | { | ||
64 | *((__be64 *)p) = cpu_to_be64(val); | ||
65 | } | ||
66 | |||
67 | #endif /* _LINUX_UNALIGNED_ACCESS_OK_H */ | ||
diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h new file mode 100644 index 000000000000..46dd12c5709e --- /dev/null +++ b/include/linux/unaligned/be_byteshift.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H | ||
2 | #define _LINUX_UNALIGNED_BE_BYTESHIFT_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | |||
6 | static inline u16 __get_unaligned_be16(const u8 *p) | ||
7 | { | ||
8 | return p[0] << 8 | p[1]; | ||
9 | } | ||
10 | |||
11 | static inline u32 __get_unaligned_be32(const u8 *p) | ||
12 | { | ||
13 | return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; | ||
14 | } | ||
15 | |||
16 | static inline u64 __get_unaligned_be64(const u8 *p) | ||
17 | { | ||
18 | return (u64)__get_unaligned_be32(p) << 32 | | ||
19 | __get_unaligned_be32(p + 4); | ||
20 | } | ||
21 | |||
22 | static inline void __put_unaligned_be16(u16 val, u8 *p) | ||
23 | { | ||
24 | *p++ = val >> 8; | ||
25 | *p++ = val; | ||
26 | } | ||
27 | |||
28 | static inline void __put_unaligned_be32(u32 val, u8 *p) | ||
29 | { | ||
30 | __put_unaligned_be16(val >> 16, p); | ||
31 | __put_unaligned_be16(val, p + 2); | ||
32 | } | ||
33 | |||
34 | static inline void __put_unaligned_be64(u64 val, u8 *p) | ||
35 | { | ||
36 | __put_unaligned_be32(val >> 32, p); | ||
37 | __put_unaligned_be32(val, p + 4); | ||
38 | } | ||
39 | |||
40 | static inline u16 get_unaligned_be16(const void *p) | ||
41 | { | ||
42 | return __get_unaligned_be16((const u8 *)p); | ||
43 | } | ||
44 | |||
45 | static inline u32 get_unaligned_be32(const void *p) | ||
46 | { | ||
47 | return __get_unaligned_be32((const u8 *)p); | ||
48 | } | ||
49 | |||
50 | static inline u64 get_unaligned_be64(const void *p) | ||
51 | { | ||
52 | return __get_unaligned_be64((const u8 *)p); | ||
53 | } | ||
54 | |||
55 | static inline void put_unaligned_be16(u16 val, void *p) | ||
56 | { | ||
57 | __put_unaligned_be16(val, p); | ||
58 | } | ||
59 | |||
60 | static inline void put_unaligned_be32(u32 val, void *p) | ||
61 | { | ||
62 | __put_unaligned_be32(val, p); | ||
63 | } | ||
64 | |||
65 | static inline void put_unaligned_be64(u64 val, void *p) | ||
66 | { | ||
67 | __put_unaligned_be64(val, p); | ||
68 | } | ||
69 | |||
70 | #endif /* _LINUX_UNALIGNED_BE_BYTESHIFT_H */ | ||
diff --git a/include/linux/unaligned/be_memmove.h b/include/linux/unaligned/be_memmove.h new file mode 100644 index 000000000000..c2a76c5c9ed0 --- /dev/null +++ b/include/linux/unaligned/be_memmove.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_BE_MEMMOVE_H | ||
2 | #define _LINUX_UNALIGNED_BE_MEMMOVE_H | ||
3 | |||
4 | #include <linux/unaligned/memmove.h> | ||
5 | |||
6 | static inline u16 get_unaligned_be16(const void *p) | ||
7 | { | ||
8 | return __get_unaligned_memmove16((const u8 *)p); | ||
9 | } | ||
10 | |||
11 | static inline u32 get_unaligned_be32(const void *p) | ||
12 | { | ||
13 | return __get_unaligned_memmove32((const u8 *)p); | ||
14 | } | ||
15 | |||
16 | static inline u64 get_unaligned_be64(const void *p) | ||
17 | { | ||
18 | return __get_unaligned_memmove64((const u8 *)p); | ||
19 | } | ||
20 | |||
21 | static inline void put_unaligned_be16(u16 val, void *p) | ||
22 | { | ||
23 | __put_unaligned_memmove16(val, p); | ||
24 | } | ||
25 | |||
26 | static inline void put_unaligned_be32(u32 val, void *p) | ||
27 | { | ||
28 | __put_unaligned_memmove32(val, p); | ||
29 | } | ||
30 | |||
31 | static inline void put_unaligned_be64(u64 val, void *p) | ||
32 | { | ||
33 | __put_unaligned_memmove64(val, p); | ||
34 | } | ||
35 | |||
36 | #endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ | ||
diff --git a/include/linux/unaligned/be_struct.h b/include/linux/unaligned/be_struct.h new file mode 100644 index 000000000000..132415836c50 --- /dev/null +++ b/include/linux/unaligned/be_struct.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_BE_STRUCT_H | ||
2 | #define _LINUX_UNALIGNED_BE_STRUCT_H | ||
3 | |||
4 | #include <linux/unaligned/packed_struct.h> | ||
5 | |||
6 | static inline u16 get_unaligned_be16(const void *p) | ||
7 | { | ||
8 | return __get_unaligned_cpu16((const u8 *)p); | ||
9 | } | ||
10 | |||
11 | static inline u32 get_unaligned_be32(const void *p) | ||
12 | { | ||
13 | return __get_unaligned_cpu32((const u8 *)p); | ||
14 | } | ||
15 | |||
16 | static inline u64 get_unaligned_be64(const void *p) | ||
17 | { | ||
18 | return __get_unaligned_cpu64((const u8 *)p); | ||
19 | } | ||
20 | |||
21 | static inline void put_unaligned_be16(u16 val, void *p) | ||
22 | { | ||
23 | __put_unaligned_cpu16(val, p); | ||
24 | } | ||
25 | |||
26 | static inline void put_unaligned_be32(u32 val, void *p) | ||
27 | { | ||
28 | __put_unaligned_cpu32(val, p); | ||
29 | } | ||
30 | |||
31 | static inline void put_unaligned_be64(u64 val, void *p) | ||
32 | { | ||
33 | __put_unaligned_cpu64(val, p); | ||
34 | } | ||
35 | |||
36 | #endif /* _LINUX_UNALIGNED_BE_STRUCT_H */ | ||
diff --git a/include/linux/unaligned/generic.h b/include/linux/unaligned/generic.h new file mode 100644 index 000000000000..02d97ff3df70 --- /dev/null +++ b/include/linux/unaligned/generic.h | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_GENERIC_H | ||
2 | #define _LINUX_UNALIGNED_GENERIC_H | ||
3 | |||
4 | /* | ||
5 | * Cause a link-time error if we try an unaligned access other than | ||
6 | * 1,2,4 or 8 bytes long | ||
7 | */ | ||
8 | extern void __bad_unaligned_access_size(void); | ||
9 | |||
10 | #define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \ | ||
11 | __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ | ||
12 | __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \ | ||
13 | __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \ | ||
14 | __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \ | ||
15 | __bad_unaligned_access_size())))); \ | ||
16 | })) | ||
17 | |||
18 | #define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \ | ||
19 | __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ | ||
20 | __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \ | ||
21 | __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \ | ||
22 | __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \ | ||
23 | __bad_unaligned_access_size())))); \ | ||
24 | })) | ||
25 | |||
26 | #define __put_unaligned_le(val, ptr) ({ \ | ||
27 | void *__gu_p = (ptr); \ | ||
28 | switch (sizeof(*(ptr))) { \ | ||
29 | case 1: \ | ||
30 | *(u8 *)__gu_p = (__force u8)(val); \ | ||
31 | break; \ | ||
32 | case 2: \ | ||
33 | put_unaligned_le16((__force u16)(val), __gu_p); \ | ||
34 | break; \ | ||
35 | case 4: \ | ||
36 | put_unaligned_le32((__force u32)(val), __gu_p); \ | ||
37 | break; \ | ||
38 | case 8: \ | ||
39 | put_unaligned_le64((__force u64)(val), __gu_p); \ | ||
40 | break; \ | ||
41 | default: \ | ||
42 | __bad_unaligned_access_size(); \ | ||
43 | break; \ | ||
44 | } \ | ||
45 | (void)0; }) | ||
46 | |||
47 | #define __put_unaligned_be(val, ptr) ({ \ | ||
48 | void *__gu_p = (ptr); \ | ||
49 | switch (sizeof(*(ptr))) { \ | ||
50 | case 1: \ | ||
51 | *(u8 *)__gu_p = (__force u8)(val); \ | ||
52 | break; \ | ||
53 | case 2: \ | ||
54 | put_unaligned_be16((__force u16)(val), __gu_p); \ | ||
55 | break; \ | ||
56 | case 4: \ | ||
57 | put_unaligned_be32((__force u32)(val), __gu_p); \ | ||
58 | break; \ | ||
59 | case 8: \ | ||
60 | put_unaligned_be64((__force u64)(val), __gu_p); \ | ||
61 | break; \ | ||
62 | default: \ | ||
63 | __bad_unaligned_access_size(); \ | ||
64 | break; \ | ||
65 | } \ | ||
66 | (void)0; }) | ||
67 | |||
68 | #endif /* _LINUX_UNALIGNED_GENERIC_H */ | ||
diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h new file mode 100644 index 000000000000..59777e951baf --- /dev/null +++ b/include/linux/unaligned/le_byteshift.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H | ||
2 | #define _LINUX_UNALIGNED_LE_BYTESHIFT_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | |||
6 | static inline u16 __get_unaligned_le16(const u8 *p) | ||
7 | { | ||
8 | return p[0] | p[1] << 8; | ||
9 | } | ||
10 | |||
11 | static inline u32 __get_unaligned_le32(const u8 *p) | ||
12 | { | ||
13 | return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; | ||
14 | } | ||
15 | |||
16 | static inline u64 __get_unaligned_le64(const u8 *p) | ||
17 | { | ||
18 | return (u64)__get_unaligned_le32(p + 4) << 32 | | ||
19 | __get_unaligned_le32(p); | ||
20 | } | ||
21 | |||
22 | static inline void __put_unaligned_le16(u16 val, u8 *p) | ||
23 | { | ||
24 | *p++ = val; | ||
25 | *p++ = val >> 8; | ||
26 | } | ||
27 | |||
28 | static inline void __put_unaligned_le32(u32 val, u8 *p) | ||
29 | { | ||
30 | __put_unaligned_le16(val >> 16, p + 2); | ||
31 | __put_unaligned_le16(val, p); | ||
32 | } | ||
33 | |||
34 | static inline void __put_unaligned_le64(u64 val, u8 *p) | ||
35 | { | ||
36 | __put_unaligned_le32(val >> 32, p + 4); | ||
37 | __put_unaligned_le32(val, p); | ||
38 | } | ||
39 | |||
40 | static inline u16 get_unaligned_le16(const void *p) | ||
41 | { | ||
42 | return __get_unaligned_le16((const u8 *)p); | ||
43 | } | ||
44 | |||
45 | static inline u32 get_unaligned_le32(const void *p) | ||
46 | { | ||
47 | return __get_unaligned_le32((const u8 *)p); | ||
48 | } | ||
49 | |||
50 | static inline u64 get_unaligned_le64(const void *p) | ||
51 | { | ||
52 | return __get_unaligned_le64((const u8 *)p); | ||
53 | } | ||
54 | |||
55 | static inline void put_unaligned_le16(u16 val, void *p) | ||
56 | { | ||
57 | __put_unaligned_le16(val, p); | ||
58 | } | ||
59 | |||
60 | static inline void put_unaligned_le32(u32 val, void *p) | ||
61 | { | ||
62 | __put_unaligned_le32(val, p); | ||
63 | } | ||
64 | |||
65 | static inline void put_unaligned_le64(u64 val, void *p) | ||
66 | { | ||
67 | __put_unaligned_le64(val, p); | ||
68 | } | ||
69 | |||
70 | #endif /* _LINUX_UNALIGNED_LE_BYTESHIFT_H */ | ||
diff --git a/include/linux/unaligned/le_memmove.h b/include/linux/unaligned/le_memmove.h new file mode 100644 index 000000000000..269849bee4ec --- /dev/null +++ b/include/linux/unaligned/le_memmove.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_LE_MEMMOVE_H | ||
2 | #define _LINUX_UNALIGNED_LE_MEMMOVE_H | ||
3 | |||
4 | #include <linux/unaligned/memmove.h> | ||
5 | |||
6 | static inline u16 get_unaligned_le16(const void *p) | ||
7 | { | ||
8 | return __get_unaligned_memmove16((const u8 *)p); | ||
9 | } | ||
10 | |||
11 | static inline u32 get_unaligned_le32(const void *p) | ||
12 | { | ||
13 | return __get_unaligned_memmove32((const u8 *)p); | ||
14 | } | ||
15 | |||
16 | static inline u64 get_unaligned_le64(const void *p) | ||
17 | { | ||
18 | return __get_unaligned_memmove64((const u8 *)p); | ||
19 | } | ||
20 | |||
21 | static inline void put_unaligned_le16(u16 val, void *p) | ||
22 | { | ||
23 | __put_unaligned_memmove16(val, p); | ||
24 | } | ||
25 | |||
26 | static inline void put_unaligned_le32(u32 val, void *p) | ||
27 | { | ||
28 | __put_unaligned_memmove32(val, p); | ||
29 | } | ||
30 | |||
31 | static inline void put_unaligned_le64(u64 val, void *p) | ||
32 | { | ||
33 | __put_unaligned_memmove64(val, p); | ||
34 | } | ||
35 | |||
36 | #endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ | ||
diff --git a/include/linux/unaligned/le_struct.h b/include/linux/unaligned/le_struct.h new file mode 100644 index 000000000000..088c4572faa8 --- /dev/null +++ b/include/linux/unaligned/le_struct.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_LE_STRUCT_H | ||
2 | #define _LINUX_UNALIGNED_LE_STRUCT_H | ||
3 | |||
4 | #include <linux/unaligned/packed_struct.h> | ||
5 | |||
6 | static inline u16 get_unaligned_le16(const void *p) | ||
7 | { | ||
8 | return __get_unaligned_cpu16((const u8 *)p); | ||
9 | } | ||
10 | |||
11 | static inline u32 get_unaligned_le32(const void *p) | ||
12 | { | ||
13 | return __get_unaligned_cpu32((const u8 *)p); | ||
14 | } | ||
15 | |||
16 | static inline u64 get_unaligned_le64(const void *p) | ||
17 | { | ||
18 | return __get_unaligned_cpu64((const u8 *)p); | ||
19 | } | ||
20 | |||
21 | static inline void put_unaligned_le16(u16 val, void *p) | ||
22 | { | ||
23 | __put_unaligned_cpu16(val, p); | ||
24 | } | ||
25 | |||
26 | static inline void put_unaligned_le32(u32 val, void *p) | ||
27 | { | ||
28 | __put_unaligned_cpu32(val, p); | ||
29 | } | ||
30 | |||
31 | static inline void put_unaligned_le64(u64 val, void *p) | ||
32 | { | ||
33 | __put_unaligned_cpu64(val, p); | ||
34 | } | ||
35 | |||
36 | #endif /* _LINUX_UNALIGNED_LE_STRUCT_H */ | ||
diff --git a/include/linux/unaligned/memmove.h b/include/linux/unaligned/memmove.h new file mode 100644 index 000000000000..eeb5a779a4fd --- /dev/null +++ b/include/linux/unaligned/memmove.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_MEMMOVE_H | ||
2 | #define _LINUX_UNALIGNED_MEMMOVE_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/string.h> | ||
6 | |||
7 | /* Use memmove here, so gcc does not insert a __builtin_memcpy. */ | ||
8 | |||
9 | static inline u16 __get_unaligned_memmove16(const void *p) | ||
10 | { | ||
11 | u16 tmp; | ||
12 | memmove(&tmp, p, 2); | ||
13 | return tmp; | ||
14 | } | ||
15 | |||
16 | static inline u32 __get_unaligned_memmove32(const void *p) | ||
17 | { | ||
18 | u32 tmp; | ||
19 | memmove(&tmp, p, 4); | ||
20 | return tmp; | ||
21 | } | ||
22 | |||
23 | static inline u64 __get_unaligned_memmove64(const void *p) | ||
24 | { | ||
25 | u64 tmp; | ||
26 | memmove(&tmp, p, 8); | ||
27 | return tmp; | ||
28 | } | ||
29 | |||
30 | static inline void __put_unaligned_memmove16(u16 val, void *p) | ||
31 | { | ||
32 | memmove(p, &val, 2); | ||
33 | } | ||
34 | |||
35 | static inline void __put_unaligned_memmove32(u32 val, void *p) | ||
36 | { | ||
37 | memmove(p, &val, 4); | ||
38 | } | ||
39 | |||
40 | static inline void __put_unaligned_memmove64(u64 val, void *p) | ||
41 | { | ||
42 | memmove(p, &val, 8); | ||
43 | } | ||
44 | |||
45 | #endif /* _LINUX_UNALIGNED_MEMMOVE_H */ | ||
diff --git a/include/linux/unaligned/packed_struct.h b/include/linux/unaligned/packed_struct.h new file mode 100644 index 000000000000..2498bb9fe002 --- /dev/null +++ b/include/linux/unaligned/packed_struct.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H | ||
2 | #define _LINUX_UNALIGNED_PACKED_STRUCT_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | |||
6 | struct __una_u16 { u16 x __attribute__((packed)); }; | ||
7 | struct __una_u32 { u32 x __attribute__((packed)); }; | ||
8 | struct __una_u64 { u64 x __attribute__((packed)); }; | ||
9 | |||
10 | static inline u16 __get_unaligned_cpu16(const void *p) | ||
11 | { | ||
12 | const struct __una_u16 *ptr = (const struct __una_u16 *)p; | ||
13 | return ptr->x; | ||
14 | } | ||
15 | |||
16 | static inline u32 __get_unaligned_cpu32(const void *p) | ||
17 | { | ||
18 | const struct __una_u32 *ptr = (const struct __una_u32 *)p; | ||
19 | return ptr->x; | ||
20 | } | ||
21 | |||
22 | static inline u64 __get_unaligned_cpu64(const void *p) | ||
23 | { | ||
24 | const struct __una_u64 *ptr = (const struct __una_u64 *)p; | ||
25 | return ptr->x; | ||
26 | } | ||
27 | |||
28 | static inline void __put_unaligned_cpu16(u16 val, void *p) | ||
29 | { | ||
30 | struct __una_u16 *ptr = (struct __una_u16 *)p; | ||
31 | ptr->x = val; | ||
32 | } | ||
33 | |||
34 | static inline void __put_unaligned_cpu32(u32 val, void *p) | ||
35 | { | ||
36 | struct __una_u32 *ptr = (struct __una_u32 *)p; | ||
37 | ptr->x = val; | ||
38 | } | ||
39 | |||
40 | static inline void __put_unaligned_cpu64(u64 val, void *p) | ||
41 | { | ||
42 | struct __una_u64 *ptr = (struct __una_u64 *)p; | ||
43 | ptr->x = val; | ||
44 | } | ||
45 | |||
46 | #endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */ | ||
diff --git a/include/linux/usb/c67x00.h b/include/linux/usb/c67x00.h new file mode 100644 index 000000000000..83c6b45470ca --- /dev/null +++ b/include/linux/usb/c67x00.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * usb_c67x00.h: platform definitions for the Cypress C67X00 USB chip | ||
3 | * | ||
4 | * Copyright (C) 2006-2008 Barco N.V. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
19 | * MA 02110-1301 USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef _LINUX_USB_C67X00_H | ||
23 | #define _LINUX_USB_C67X00_H | ||
24 | |||
25 | /* SIE configuration */ | ||
26 | #define C67X00_SIE_UNUSED 0 | ||
27 | #define C67X00_SIE_HOST 1 | ||
28 | #define C67X00_SIE_PERIPHERAL_A 2 /* peripheral on A port */ | ||
29 | #define C67X00_SIE_PERIPHERAL_B 3 /* peripheral on B port */ | ||
30 | |||
31 | #define c67x00_sie_config(config, n) (((config)>>(4*(n)))&0x3) | ||
32 | |||
33 | #define C67X00_SIE1_UNUSED (C67X00_SIE_UNUSED << 0) | ||
34 | #define C67X00_SIE1_HOST (C67X00_SIE_HOST << 0) | ||
35 | #define C67X00_SIE1_PERIPHERAL_A (C67X00_SIE_PERIPHERAL_A << 0) | ||
36 | #define C67X00_SIE1_PERIPHERAL_B (C67X00_SIE_PERIPHERAL_B << 0) | ||
37 | |||
38 | #define C67X00_SIE2_UNUSED (C67X00_SIE_UNUSED << 4) | ||
39 | #define C67X00_SIE2_HOST (C67X00_SIE_HOST << 4) | ||
40 | #define C67X00_SIE2_PERIPHERAL_A (C67X00_SIE_PERIPHERAL_A << 4) | ||
41 | #define C67X00_SIE2_PERIPHERAL_B (C67X00_SIE_PERIPHERAL_B << 4) | ||
42 | |||
43 | struct c67x00_platform_data { | ||
44 | int sie_config; /* SIEs config (C67X00_SIEx_*) */ | ||
45 | unsigned long hpi_regstep; /* Step between HPI registers */ | ||
46 | }; | ||
47 | |||
48 | #endif /* _LINUX_USB_C67X00_H */ | ||
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 7e0d3084f76c..73a2f4eb1f7a 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -455,7 +455,7 @@ struct usb_encryption_descriptor { | |||
455 | 455 | ||
456 | /*-------------------------------------------------------------------------*/ | 456 | /*-------------------------------------------------------------------------*/ |
457 | 457 | ||
458 | /* USB_DT_BOS: group of wireless capabilities */ | 458 | /* USB_DT_BOS: group of device-level capabilities */ |
459 | struct usb_bos_descriptor { | 459 | struct usb_bos_descriptor { |
460 | __u8 bLength; | 460 | __u8 bLength; |
461 | __u8 bDescriptorType; | 461 | __u8 bDescriptorType; |
@@ -501,6 +501,16 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ | |||
501 | __u8 bReserved; | 501 | __u8 bReserved; |
502 | } __attribute__((packed)); | 502 | } __attribute__((packed)); |
503 | 503 | ||
504 | #define USB_CAP_TYPE_EXT 2 | ||
505 | |||
506 | struct usb_ext_cap_descriptor { /* Link Power Management */ | ||
507 | __u8 bLength; | ||
508 | __u8 bDescriptorType; | ||
509 | __u8 bDevCapabilityType; | ||
510 | __u8 bmAttributes; | ||
511 | #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ | ||
512 | } __attribute__((packed)); | ||
513 | |||
504 | /*-------------------------------------------------------------------------*/ | 514 | /*-------------------------------------------------------------------------*/ |
505 | 515 | ||
506 | /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with | 516 | /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with |
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index d8128f7102c9..cf468fbdbf8e 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -114,6 +114,8 @@ struct usb_ep_ops { | |||
114 | int (*dequeue) (struct usb_ep *ep, struct usb_request *req); | 114 | int (*dequeue) (struct usb_ep *ep, struct usb_request *req); |
115 | 115 | ||
116 | int (*set_halt) (struct usb_ep *ep, int value); | 116 | int (*set_halt) (struct usb_ep *ep, int value); |
117 | int (*set_wedge) (struct usb_ep *ep); | ||
118 | |||
117 | int (*fifo_status) (struct usb_ep *ep); | 119 | int (*fifo_status) (struct usb_ep *ep); |
118 | void (*fifo_flush) (struct usb_ep *ep); | 120 | void (*fifo_flush) (struct usb_ep *ep); |
119 | }; | 121 | }; |
@@ -349,6 +351,25 @@ static inline int usb_ep_clear_halt(struct usb_ep *ep) | |||
349 | } | 351 | } |
350 | 352 | ||
351 | /** | 353 | /** |
354 | * usb_ep_set_wedge - sets the halt feature and ignores clear requests | ||
355 | * @ep: the endpoint being wedged | ||
356 | * | ||
357 | * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) | ||
358 | * requests. If the gadget driver clears the halt status, it will | ||
359 | * automatically unwedge the endpoint. | ||
360 | * | ||
361 | * Returns zero on success, else negative errno. | ||
362 | */ | ||
363 | static inline int | ||
364 | usb_ep_set_wedge(struct usb_ep *ep) | ||
365 | { | ||
366 | if (ep->ops->set_wedge) | ||
367 | return ep->ops->set_wedge(ep); | ||
368 | else | ||
369 | return ep->ops->set_halt(ep, 1); | ||
370 | } | ||
371 | |||
372 | /** | ||
352 | * usb_ep_fifo_status - returns number of bytes in fifo, or error | 373 | * usb_ep_fifo_status - returns number of bytes in fifo, or error |
353 | * @ep: the endpoint whose fifo status is being checked. | 374 | * @ep: the endpoint whose fifo status is being checked. |
354 | * | 375 | * |
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index e7d10845b3c1..06005fa9e982 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -76,6 +76,7 @@ struct virtqueue_ops { | |||
76 | * @dev: underlying device. | 76 | * @dev: underlying device. |
77 | * @id: the device type identification (used to match it with a driver). | 77 | * @id: the device type identification (used to match it with a driver). |
78 | * @config: the configuration ops for this device. | 78 | * @config: the configuration ops for this device. |
79 | * @features: the features supported by both driver and device. | ||
79 | * @priv: private pointer for the driver's use. | 80 | * @priv: private pointer for the driver's use. |
80 | */ | 81 | */ |
81 | struct virtio_device | 82 | struct virtio_device |
@@ -84,6 +85,8 @@ struct virtio_device | |||
84 | struct device dev; | 85 | struct device dev; |
85 | struct virtio_device_id id; | 86 | struct virtio_device_id id; |
86 | struct virtio_config_ops *config; | 87 | struct virtio_config_ops *config; |
88 | /* Note that this is a Linux set_bit-style bitmap. */ | ||
89 | unsigned long features[1]; | ||
87 | void *priv; | 90 | void *priv; |
88 | }; | 91 | }; |
89 | 92 | ||
@@ -94,6 +97,8 @@ void unregister_virtio_device(struct virtio_device *dev); | |||
94 | * virtio_driver - operations for a virtio I/O driver | 97 | * virtio_driver - operations for a virtio I/O driver |
95 | * @driver: underlying device driver (populate name and owner). | 98 | * @driver: underlying device driver (populate name and owner). |
96 | * @id_table: the ids serviced by this driver. | 99 | * @id_table: the ids serviced by this driver. |
100 | * @feature_table: an array of feature numbers supported by this device. | ||
101 | * @feature_table_size: number of entries in the feature table array. | ||
97 | * @probe: the function to call when a device is found. Returns a token for | 102 | * @probe: the function to call when a device is found. Returns a token for |
98 | * remove, or PTR_ERR(). | 103 | * remove, or PTR_ERR(). |
99 | * @remove: the function when a device is removed. | 104 | * @remove: the function when a device is removed. |
@@ -103,6 +108,8 @@ void unregister_virtio_device(struct virtio_device *dev); | |||
103 | struct virtio_driver { | 108 | struct virtio_driver { |
104 | struct device_driver driver; | 109 | struct device_driver driver; |
105 | const struct virtio_device_id *id_table; | 110 | const struct virtio_device_id *id_table; |
111 | const unsigned int *feature_table; | ||
112 | unsigned int feature_table_size; | ||
106 | int (*probe)(struct virtio_device *dev); | 113 | int (*probe)(struct virtio_device *dev); |
107 | void (*remove)(struct virtio_device *dev); | 114 | void (*remove)(struct virtio_device *dev); |
108 | void (*config_changed)(struct virtio_device *dev); | 115 | void (*config_changed)(struct virtio_device *dev); |
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index bca0b10d7947..d4695a3356d0 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ | 9 | #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ |
10 | #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ | 10 | #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ |
11 | #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ | 11 | #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ |
12 | #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ | ||
12 | 13 | ||
13 | struct virtio_blk_config | 14 | struct virtio_blk_config |
14 | { | 15 | { |
@@ -18,6 +19,12 @@ struct virtio_blk_config | |||
18 | __le32 size_max; | 19 | __le32 size_max; |
19 | /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ | 20 | /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ |
20 | __le32 seg_max; | 21 | __le32 seg_max; |
22 | /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ | ||
23 | struct virtio_blk_geometry { | ||
24 | __le16 cylinders; | ||
25 | __u8 heads; | ||
26 | __u8 sectors; | ||
27 | } geometry; | ||
21 | } __attribute__((packed)); | 28 | } __attribute__((packed)); |
22 | 29 | ||
23 | /* These two define direction. */ | 30 | /* These two define direction. */ |
@@ -41,13 +48,8 @@ struct virtio_blk_outhdr | |||
41 | __u64 sector; | 48 | __u64 sector; |
42 | }; | 49 | }; |
43 | 50 | ||
51 | /* And this is the final byte of the write scatter-gather list. */ | ||
44 | #define VIRTIO_BLK_S_OK 0 | 52 | #define VIRTIO_BLK_S_OK 0 |
45 | #define VIRTIO_BLK_S_IOERR 1 | 53 | #define VIRTIO_BLK_S_IOERR 1 |
46 | #define VIRTIO_BLK_S_UNSUPP 2 | 54 | #define VIRTIO_BLK_S_UNSUPP 2 |
47 | |||
48 | /* This is the first element of the write scatter-gather list */ | ||
49 | struct virtio_blk_inhdr | ||
50 | { | ||
51 | unsigned char status; | ||
52 | }; | ||
53 | #endif /* _LINUX_VIRTIO_BLK_H */ | 55 | #endif /* _LINUX_VIRTIO_BLK_H */ |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index d581b2914b34..50db245c81ad 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -16,27 +16,20 @@ | |||
16 | #define VIRTIO_CONFIG_S_FAILED 0x80 | 16 | #define VIRTIO_CONFIG_S_FAILED 0x80 |
17 | 17 | ||
18 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
19 | struct virtio_device; | 19 | #include <linux/virtio.h> |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * virtio_config_ops - operations for configuring a virtio device | 22 | * virtio_config_ops - operations for configuring a virtio device |
23 | * @feature: search for a feature in this config | ||
24 | * vdev: the virtio_device | ||
25 | * bit: the feature bit | ||
26 | * Returns true if the feature is supported. Acknowledges the feature | ||
27 | * so the host can see it. | ||
28 | * @get: read the value of a configuration field | 23 | * @get: read the value of a configuration field |
29 | * vdev: the virtio_device | 24 | * vdev: the virtio_device |
30 | * offset: the offset of the configuration field | 25 | * offset: the offset of the configuration field |
31 | * buf: the buffer to write the field value into. | 26 | * buf: the buffer to write the field value into. |
32 | * len: the length of the buffer | 27 | * len: the length of the buffer |
33 | * Note that contents are conventionally little-endian. | ||
34 | * @set: write the value of a configuration field | 28 | * @set: write the value of a configuration field |
35 | * vdev: the virtio_device | 29 | * vdev: the virtio_device |
36 | * offset: the offset of the configuration field | 30 | * offset: the offset of the configuration field |
37 | * buf: the buffer to read the field value from. | 31 | * buf: the buffer to read the field value from. |
38 | * len: the length of the buffer | 32 | * len: the length of the buffer |
39 | * Note that contents are conventionally little-endian. | ||
40 | * @get_status: read the status byte | 33 | * @get_status: read the status byte |
41 | * vdev: the virtio_device | 34 | * vdev: the virtio_device |
42 | * Returns the status byte | 35 | * Returns the status byte |
@@ -52,10 +45,15 @@ struct virtio_device; | |||
52 | * callback: the virqtueue callback | 45 | * callback: the virqtueue callback |
53 | * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). | 46 | * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). |
54 | * @del_vq: free a virtqueue found by find_vq(). | 47 | * @del_vq: free a virtqueue found by find_vq(). |
48 | * @get_features: get the array of feature bits for this device. | ||
49 | * vdev: the virtio_device | ||
50 | * Returns the first 32 feature bits (all we currently need). | ||
51 | * @set_features: confirm what device features we'll be using. | ||
52 | * vdev: the virtio_device | ||
53 | * feature: the first 32 feature bits | ||
55 | */ | 54 | */ |
56 | struct virtio_config_ops | 55 | struct virtio_config_ops |
57 | { | 56 | { |
58 | bool (*feature)(struct virtio_device *vdev, unsigned bit); | ||
59 | void (*get)(struct virtio_device *vdev, unsigned offset, | 57 | void (*get)(struct virtio_device *vdev, unsigned offset, |
60 | void *buf, unsigned len); | 58 | void *buf, unsigned len); |
61 | void (*set)(struct virtio_device *vdev, unsigned offset, | 59 | void (*set)(struct virtio_device *vdev, unsigned offset, |
@@ -67,43 +65,52 @@ struct virtio_config_ops | |||
67 | unsigned index, | 65 | unsigned index, |
68 | void (*callback)(struct virtqueue *)); | 66 | void (*callback)(struct virtqueue *)); |
69 | void (*del_vq)(struct virtqueue *vq); | 67 | void (*del_vq)(struct virtqueue *vq); |
68 | u32 (*get_features)(struct virtio_device *vdev); | ||
69 | void (*set_features)(struct virtio_device *vdev, u32 features); | ||
70 | }; | 70 | }; |
71 | 71 | ||
72 | /* If driver didn't advertise the feature, it will never appear. */ | ||
73 | void virtio_check_driver_offered_feature(const struct virtio_device *vdev, | ||
74 | unsigned int fbit); | ||
75 | |||
72 | /** | 76 | /** |
73 | * virtio_config_val - look for a feature and get a single virtio config. | 77 | * virtio_has_feature - helper to determine if this device has this feature. |
74 | * @vdev: the virtio device | 78 | * @vdev: the device |
75 | * @fbit: the feature bit | 79 | * @fbit: the feature bit |
76 | * @offset: the type to search for. | 80 | */ |
77 | * @val: a pointer to the value to fill in. | 81 | static inline bool virtio_has_feature(const struct virtio_device *vdev, |
78 | * | 82 | unsigned int fbit) |
79 | * The return value is -ENOENT if the feature doesn't exist. Otherwise | 83 | { |
80 | * the value is endian-corrected and returned in v. */ | 84 | /* Did you forget to fix assumptions on max features? */ |
81 | #define virtio_config_val(vdev, fbit, offset, v) ({ \ | 85 | if (__builtin_constant_p(fbit)) |
82 | int _err; \ | 86 | BUILD_BUG_ON(fbit >= 32); |
83 | if ((vdev)->config->feature((vdev), (fbit))) { \ | 87 | |
84 | __virtio_config_val((vdev), (offset), (v)); \ | 88 | virtio_check_driver_offered_feature(vdev, fbit); |
85 | _err = 0; \ | 89 | return test_bit(fbit, vdev->features); |
86 | } else \ | 90 | } |
87 | _err = -ENOENT; \ | ||
88 | _err; \ | ||
89 | }) | ||
90 | 91 | ||
91 | /** | 92 | /** |
92 | * __virtio_config_val - get a single virtio config without feature check. | 93 | * virtio_config_val - look for a feature and get a virtio config entry. |
93 | * @vdev: the virtio device | 94 | * @vdev: the virtio device |
95 | * @fbit: the feature bit | ||
94 | * @offset: the type to search for. | 96 | * @offset: the type to search for. |
95 | * @val: a pointer to the value to fill in. | 97 | * @val: a pointer to the value to fill in. |
96 | * | 98 | * |
97 | * The value is endian-corrected and returned in v. */ | 99 | * The return value is -ENOENT if the feature doesn't exist. Otherwise |
98 | #define __virtio_config_val(vdev, offset, v) do { \ | 100 | * the config value is copied into whatever is pointed to by v. */ |
99 | BUILD_BUG_ON(sizeof(*(v)) != 1 && sizeof(*(v)) != 2 \ | 101 | #define virtio_config_val(vdev, fbit, offset, v) \ |
100 | && sizeof(*(v)) != 4 && sizeof(*(v)) != 8); \ | 102 | virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(v)) |
101 | (vdev)->config->get((vdev), (offset), (v), sizeof(*(v))); \ | 103 | |
102 | switch (sizeof(*(v))) { \ | 104 | static inline int virtio_config_buf(struct virtio_device *vdev, |
103 | case 2: le16_to_cpus((__u16 *) v); break; \ | 105 | unsigned int fbit, |
104 | case 4: le32_to_cpus((__u32 *) v); break; \ | 106 | unsigned int offset, |
105 | case 8: le64_to_cpus((__u64 *) v); break; \ | 107 | void *buf, unsigned len) |
106 | } \ | 108 | { |
107 | } while(0) | 109 | if (!virtio_has_feature(vdev, fbit)) |
110 | return -ENOENT; | ||
111 | |||
112 | vdev->config->get(vdev, offset, buf, len); | ||
113 | return 0; | ||
114 | } | ||
108 | #endif /* __KERNEL__ */ | 115 | #endif /* __KERNEL__ */ |
109 | #endif /* _LINUX_VIRTIO_CONFIG_H */ | 116 | #endif /* _LINUX_VIRTIO_CONFIG_H */ |
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 1ea3351df609..9405aa6cdf26 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
@@ -6,9 +6,18 @@ | |||
6 | #define VIRTIO_ID_NET 1 | 6 | #define VIRTIO_ID_NET 1 |
7 | 7 | ||
8 | /* The feature bitmap for virtio net */ | 8 | /* The feature bitmap for virtio net */ |
9 | #define VIRTIO_NET_F_CSUM 0 /* Can handle pkts w/ partial csum */ | 9 | #define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ |
10 | #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ | ||
10 | #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ | 11 | #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ |
11 | #define VIRTIO_NET_F_GSO 6 /* Can handle pkts w/ any GSO type */ | 12 | #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ |
13 | #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ | ||
14 | #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ | ||
15 | #define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */ | ||
16 | #define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */ | ||
17 | #define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */ | ||
18 | #define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ | ||
19 | #define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ | ||
20 | #define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ | ||
12 | 21 | ||
13 | struct virtio_net_config | 22 | struct virtio_net_config |
14 | { | 23 | { |
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 | ||
68 | extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); | 69 | extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); |
70 | extern struct vm_struct *get_vm_area_caller(unsigned long size, | ||
71 | unsigned long flags, void *caller); | ||
69 | extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, | 72 | extern 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); |
71 | extern struct vm_struct *get_vm_area_node(unsigned long size, | 74 | extern struct vm_struct *get_vm_area_node(unsigned long size, |
@@ -87,4 +90,6 @@ extern void free_vm_area(struct vm_struct *area); | |||
87 | extern rwlock_t vmlist_lock; | 90 | extern rwlock_t vmlist_lock; |
88 | extern struct vm_struct *vmlist; | 91 | extern struct vm_struct *vmlist; |
89 | 92 | ||
93 | extern 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 | ||
30 | enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | 31 | enum 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 | ||
177 | extern void zone_statistics(struct zonelist *, struct zone *); | 181 | extern void zone_statistics(struct zone *, struct zone *); |
178 | 182 | ||
179 | #else | 183 | #else |
180 | 184 | ||
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index b7b3362f7717..f462439cc288 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -114,6 +114,9 @@ struct file; | |||
114 | int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, | 114 | int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, |
115 | void __user *, size_t *, loff_t *); | 115 | void __user *, size_t *, loff_t *); |
116 | 116 | ||
117 | void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty, | ||
118 | struct backing_dev_info *bdi); | ||
119 | |||
117 | void page_writeback_init(void); | 120 | void page_writeback_init(void); |
118 | void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, | 121 | void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, |
119 | unsigned long nr_pages_dirtied); | 122 | unsigned long nr_pages_dirtied); |
diff --git a/include/linux/xattr.h b/include/linux/xattr.h index df6b95d2218e..d131e352cfe1 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h | |||
@@ -47,10 +47,10 @@ struct xattr_handler { | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); | 49 | ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); |
50 | ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t); | 50 | ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t); |
51 | ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); | 51 | ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); |
52 | int vfs_setxattr(struct dentry *, char *, void *, size_t, int); | 52 | int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); |
53 | int vfs_removexattr(struct dentry *, char *); | 53 | int vfs_removexattr(struct dentry *, const char *); |
54 | 54 | ||
55 | ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); | 55 | ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); |
56 | ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); | 56 | ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); |