aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/a.out.h12
-rw-r--r--include/linux/atmel_pwm.h70
-rw-r--r--include/linux/byteorder/generic.h30
-rw-r--r--include/linux/cpuset.h9
-rw-r--r--include/linux/dmar.h2
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/elf-em.h3
-rw-r--r--include/linux/fs.h31
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/hugetlb.h1
-rw-r--r--include/linux/ipc.h52
-rw-r--r--include/linux/ipc_namespace.h81
-rw-r--r--include/linux/irq.h19
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/kernel.h27
-rw-r--r--include/linux/mm.h14
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/mutex.h12
-rw-r--r--include/linux/nbd.h1
-rw-r--r--include/linux/pfkeyv2.h1
-rw-r--r--include/linux/pid.h22
-rw-r--r--include/linux/pid_namespace.h6
-rw-r--r--include/linux/preempt.h4
-rw-r--r--include/linux/proc_fs.h16
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/rcupreempt.h4
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/sched.h11
-rw-r--r--include/linux/serial_core.h4
-rw-r--r--include/linux/shmem_fs.h5
-rw-r--r--include/linux/signal.h1
-rw-r--r--include/linux/spinlock.h2
-rw-r--r--include/linux/time.h2
-rw-r--r--include/linux/timer.h6
-rw-r--r--include/linux/types.h6
-rw-r--r--include/linux/udf_fs.h7
-rw-r--r--include/linux/udf_fs_sb.h12
-rw-r--r--include/linux/ufs_fs.h953
-rw-r--r--include/linux/utsname.h21
40 files changed, 358 insertions, 1110 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 2ebf068ba504..5cae9b5960ea 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -338,7 +338,6 @@ unifdef-y += tty.h
338unifdef-y += types.h 338unifdef-y += types.h
339unifdef-y += udf_fs_i.h 339unifdef-y += udf_fs_i.h
340unifdef-y += udp.h 340unifdef-y += udp.h
341unifdef-y += ufs_fs.h
342unifdef-y += uinput.h 341unifdef-y += uinput.h
343unifdef-y += uio.h 342unifdef-y += uio.h
344unifdef-y += unistd.h 343unifdef-y += unistd.h
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index 82cd918f2ab7..208f4e8ed304 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -1,6 +1,8 @@
1#ifndef __A_OUT_GNU_H__ 1#ifndef __A_OUT_GNU_H__
2#define __A_OUT_GNU_H__ 2#define __A_OUT_GNU_H__
3 3
4#ifdef CONFIG_ARCH_SUPPORTS_AOUT
5
4#define __GNU_EXEC_MACROS__ 6#define __GNU_EXEC_MACROS__
5 7
6#ifndef __STRUCT_EXEC_OVERRIDE__ 8#ifndef __STRUCT_EXEC_OVERRIDE__
@@ -9,6 +11,8 @@
9 11
10#endif /* __STRUCT_EXEC_OVERRIDE__ */ 12#endif /* __STRUCT_EXEC_OVERRIDE__ */
11 13
14#ifndef __ASSEMBLY__
15
12/* these go in the N_MACHTYPE field */ 16/* these go in the N_MACHTYPE field */
13enum machine_type { 17enum machine_type {
14#if defined (M_OLDSUN2) 18#if defined (M_OLDSUN2)
@@ -272,5 +276,11 @@ struct relocation_info
272}; 276};
273#endif /* no N_RELOCATION_INFO_DECLARED. */ 277#endif /* no N_RELOCATION_INFO_DECLARED. */
274 278
275 279#endif /*__ASSEMBLY__ */
280#else /* CONFIG_ARCH_SUPPORTS_AOUT */
281#ifndef __ASSEMBLY__
282struct exec {
283};
284#endif
285#endif /* CONFIG_ARCH_SUPPORTS_AOUT */
276#endif /* __A_OUT_GNU_H__ */ 286#endif /* __A_OUT_GNU_H__ */
diff --git a/include/linux/atmel_pwm.h b/include/linux/atmel_pwm.h
new file mode 100644
index 000000000000..ea04abb3db8e
--- /dev/null
+++ b/include/linux/atmel_pwm.h
@@ -0,0 +1,70 @@
1#ifndef __LINUX_ATMEL_PWM_H
2#define __LINUX_ATMEL_PWM_H
3
4/**
5 * struct pwm_channel - driver handle to a PWM channel
6 * @regs: base of this channel's registers
7 * @index: number of this channel (0..31)
8 * @mck: base clock rate, which can be prescaled and maybe subdivided
9 *
10 * Drivers initialize a pwm_channel structure using pwm_channel_alloc().
11 * Then they configure its clock rate (derived from MCK), alignment,
12 * polarity, and duty cycle by writing directly to the channel registers,
13 * before enabling the channel by calling pwm_channel_enable().
14 *
15 * After emitting a PWM signal for the desired length of time, drivers
16 * may then pwm_channel_disable() or pwm_channel_free(). Both of these
17 * disable the channel, but when it's freed the IRQ is deconfigured and
18 * the channel must later be re-allocated and reconfigured.
19 *
20 * Note that if the period or duty cycle need to be changed while the
21 * PWM channel is operating, drivers must use the PWM_CUPD double buffer
22 * mechanism, either polling until they change or getting implicitly
23 * notified through a once-per-period interrupt handler.
24 */
25struct pwm_channel {
26 void __iomem *regs;
27 unsigned index;
28 unsigned long mck;
29};
30
31extern int pwm_channel_alloc(int index, struct pwm_channel *ch);
32extern int pwm_channel_free(struct pwm_channel *ch);
33
34extern int pwm_clk_alloc(unsigned prescale, unsigned div);
35extern void pwm_clk_free(unsigned clk);
36
37extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled);
38
39#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1)
40#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0)
41
42/* periodic interrupts, mostly for CUPD changes to period or cycle */
43extern int pwm_channel_handler(struct pwm_channel *ch,
44 void (*handler)(struct pwm_channel *ch));
45
46/* per-channel registers (banked at pwm_channel->regs) */
47#define PWM_CMR 0x00 /* mode register */
48#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */
49#define PWM_CPR_CPOL (1 << 9) /* set: idle high */
50#define PWM_CPR_CALG (1 << 8) /* set: center align */
51#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */
52#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */
53#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */
54#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */
55#define PWM_CPRD 0x08 /* period (count up from zero) */
56#define PWM_CCNT 0x0c /* counter (20 bits?) */
57#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */
58
59static inline void
60pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val)
61{
62 __raw_writel(val, pwmc->regs + offset);
63}
64
65static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset)
66{
67 return __raw_readl(pwmc->regs + offset);
68}
69
70#endif /* __LINUX_ATMEL_PWM_H */
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 3dc715b02500..d3771551fdd9 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -146,6 +146,36 @@
146#define htons(x) ___htons(x) 146#define htons(x) ___htons(x)
147#define ntohs(x) ___ntohs(x) 147#define ntohs(x) ___ntohs(x)
148 148
149static inline void le16_add_cpu(__le16 *var, u16 val)
150{
151 *var = cpu_to_le16(le16_to_cpu(*var) + val);
152}
153
154static inline void le32_add_cpu(__le32 *var, u32 val)
155{
156 *var = cpu_to_le32(le32_to_cpu(*var) + val);
157}
158
159static inline void le64_add_cpu(__le64 *var, u64 val)
160{
161 *var = cpu_to_le64(le64_to_cpu(*var) + val);
162}
163
164static inline void be16_add_cpu(__be16 *var, u16 val)
165{
166 *var = cpu_to_be16(be16_to_cpu(*var) + val);
167}
168
169static inline void be32_add_cpu(__be32 *var, u32 val)
170{
171 *var = cpu_to_be32(be32_to_cpu(*var) + val);
172}
173
174static inline void be64_add_cpu(__be64 *var, u64 val)
175{
176 *var = cpu_to_be64(be64_to_cpu(*var) + val);
177}
178
149#endif /* KERNEL */ 179#endif /* KERNEL */
150 180
151#endif /* _LINUX_BYTEORDER_GENERIC_H */ 181#endif /* _LINUX_BYTEORDER_GENERIC_H */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index ecae585ec3da..f8c9a2752f06 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -57,7 +57,9 @@ extern int cpuset_memory_pressure_enabled;
57extern void __cpuset_memory_pressure_bump(void); 57extern void __cpuset_memory_pressure_bump(void);
58 58
59extern const struct file_operations proc_cpuset_operations; 59extern const struct file_operations proc_cpuset_operations;
60extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 60struct seq_file;
61extern void cpuset_task_status_allowed(struct seq_file *m,
62 struct task_struct *task);
61 63
62extern void cpuset_lock(void); 64extern void cpuset_lock(void);
63extern void cpuset_unlock(void); 65extern void cpuset_unlock(void);
@@ -126,10 +128,9 @@ static inline int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
126 128
127static inline void cpuset_memory_pressure_bump(void) {} 129static inline void cpuset_memory_pressure_bump(void) {}
128 130
129static inline char *cpuset_task_status_allowed(struct task_struct *task, 131static inline void cpuset_task_status_allowed(struct seq_file *m,
130 char *buffer) 132 struct task_struct *task)
131{ 133{
132 return buffer;
133} 134}
134 135
135static inline void cpuset_lock(void) {} 136static inline void cpuset_lock(void) {}
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index ffb6439cb5e6..56c73b847551 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -28,7 +28,7 @@
28#ifdef CONFIG_DMAR 28#ifdef CONFIG_DMAR
29struct intel_iommu; 29struct intel_iommu;
30 30
31extern char *dmar_get_fault_reason(u8 fault_reason); 31extern const char *dmar_get_fault_reason(u8 fault_reason);
32 32
33/* Can't use the common MSI interrupt functions 33/* Can't use the common MSI interrupt functions
34 * since DMAR is not a pci device 34 * since DMAR is not a pci device
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index bbc9992ec374..325acdf5c462 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -35,8 +35,11 @@ enum dmi_device_type {
35 DMI_DEV_TYPE_ETHERNET, 35 DMI_DEV_TYPE_ETHERNET,
36 DMI_DEV_TYPE_TOKENRING, 36 DMI_DEV_TYPE_TOKENRING,
37 DMI_DEV_TYPE_SOUND, 37 DMI_DEV_TYPE_SOUND,
38 DMI_DEV_TYPE_PATA,
39 DMI_DEV_TYPE_SATA,
40 DMI_DEV_TYPE_SAS,
38 DMI_DEV_TYPE_IPMI = -1, 41 DMI_DEV_TYPE_IPMI = -1,
39 DMI_DEV_TYPE_OEM_STRING = -2 42 DMI_DEV_TYPE_OEM_STRING = -2,
40}; 43};
41 44
42struct dmi_header { 45struct dmi_header {
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 5834e843a946..18bea78fe47b 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -31,6 +31,7 @@
31#define EM_V850 87 /* NEC v850 */ 31#define EM_V850 87 /* NEC v850 */
32#define EM_M32R 88 /* Renesas M32R */ 32#define EM_M32R 88 /* Renesas M32R */
33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ 33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
34#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
35#define EM_FRV 0x5441 /* Fujitsu FR-V */ 36#define EM_FRV 0x5441 /* Fujitsu FR-V */
36#define EM_AVR32 0x18ad /* Atmel AVR32 */ 37#define EM_AVR32 0x18ad /* Atmel AVR32 */
@@ -47,6 +48,8 @@
47#define EM_CYGNUS_M32R 0x9041 48#define EM_CYGNUS_M32R 0x9041
48/* This is the old interim value for S/390 architecture */ 49/* This is the old interim value for S/390 architecture */
49#define EM_S390_OLD 0xA390 50#define EM_S390_OLD 0xA390
51/* Also Panasonic/MEI MN10300, AM33 */
52#define EM_CYGNUS_MN10300 0xbeef
50 53
51 54
52#endif /* _LINUX_ELF_EM_H */ 55#endif /* _LINUX_ELF_EM_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 36b7abefacbe..18cfbf76ec5b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1038,6 +1038,12 @@ struct super_block {
1038 * in /proc/mounts will be "type.subtype" 1038 * in /proc/mounts will be "type.subtype"
1039 */ 1039 */
1040 char *s_subtype; 1040 char *s_subtype;
1041
1042 /*
1043 * Saved mount options for lazy filesystems using
1044 * generic_show_options()
1045 */
1046 char *s_options;
1041}; 1047};
1042 1048
1043extern struct timespec current_fs_time(struct super_block *sb); 1049extern struct timespec current_fs_time(struct super_block *sb);
@@ -1618,7 +1624,6 @@ extern int register_chrdev(unsigned int, const char *,
1618 const struct file_operations *); 1624 const struct file_operations *);
1619extern void unregister_chrdev(unsigned int, const char *); 1625extern void unregister_chrdev(unsigned int, const char *);
1620extern void unregister_chrdev_region(dev_t, unsigned); 1626extern void unregister_chrdev_region(dev_t, unsigned);
1621extern int chrdev_open(struct inode *, struct file *);
1622extern void chrdev_show(struct seq_file *,off_t); 1627extern void chrdev_show(struct seq_file *,off_t);
1623 1628
1624/* fs/block_dev.c */ 1629/* fs/block_dev.c */
@@ -1807,9 +1812,6 @@ extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
1807 unsigned long, loff_t, loff_t *, size_t, ssize_t); 1812 unsigned long, loff_t, loff_t *, size_t, ssize_t);
1808extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); 1813extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
1809extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 1814extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
1810extern void do_generic_mapping_read(struct address_space *mapping,
1811 struct file_ra_state *, struct file *,
1812 loff_t *, read_descriptor_t *, read_actor_t);
1813extern int generic_segment_checks(const struct iovec *iov, 1815extern int generic_segment_checks(const struct iovec *iov,
1814 unsigned long *nr_segs, size_t *count, int access_flags); 1816 unsigned long *nr_segs, size_t *count, int access_flags);
1815 1817
@@ -1847,18 +1849,6 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
1847} 1849}
1848#endif 1850#endif
1849 1851
1850static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1851 read_descriptor_t * desc,
1852 read_actor_t actor)
1853{
1854 do_generic_mapping_read(filp->f_mapping,
1855 &filp->f_ra,
1856 filp,
1857 ppos,
1858 desc,
1859 actor);
1860}
1861
1862#ifdef CONFIG_BLOCK 1852#ifdef CONFIG_BLOCK
1863ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 1853ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1864 struct block_device *bdev, const struct iovec *iov, loff_t offset, 1854 struct block_device *bdev, const struct iovec *iov, loff_t offset,
@@ -1985,6 +1975,9 @@ extern int __must_check inode_setattr(struct inode *, struct iattr *);
1985 1975
1986extern void file_update_time(struct file *file); 1976extern void file_update_time(struct file *file);
1987 1977
1978extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt);
1979extern void save_mount_options(struct super_block *sb, char *options);
1980
1988static inline ino_t parent_ino(struct dentry *dentry) 1981static inline ino_t parent_ino(struct dentry *dentry)
1989{ 1982{
1990 ino_t res; 1983 ino_t res;
@@ -2056,7 +2049,7 @@ static int __fops ## _open(struct inode *inode, struct file *file) \
2056static struct file_operations __fops = { \ 2049static struct file_operations __fops = { \
2057 .owner = THIS_MODULE, \ 2050 .owner = THIS_MODULE, \
2058 .open = __fops ## _open, \ 2051 .open = __fops ## _open, \
2059 .release = simple_attr_close, \ 2052 .release = simple_attr_release, \
2060 .read = simple_attr_read, \ 2053 .read = simple_attr_read, \
2061 .write = simple_attr_write, \ 2054 .write = simple_attr_write, \
2062}; 2055};
@@ -2068,9 +2061,9 @@ __simple_attr_check_format(const char *fmt, ...)
2068} 2061}
2069 2062
2070int simple_attr_open(struct inode *inode, struct file *file, 2063int simple_attr_open(struct inode *inode, struct file *file,
2071 u64 (*get)(void *), void (*set)(void *, u64), 2064 int (*get)(void *, u64 *), int (*set)(void *, u64),
2072 const char *fmt); 2065 const char *fmt);
2073int simple_attr_close(struct inode *inode, struct file *file); 2066int simple_attr_release(struct inode *inode, struct file *file);
2074ssize_t simple_attr_read(struct file *file, char __user *buf, 2067ssize_t simple_attr_read(struct file *file, char __user *buf,
2075 size_t len, loff_t *ppos); 2068 size_t len, loff_t *ppos);
2076ssize_t simple_attr_write(struct file *file, const char __user *buf, 2069ssize_t simple_attr_write(struct file *file, const char __user *buf,
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 203591e23210..600fc3bcf63e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -78,7 +78,7 @@ enum hrtimer_cb_mode {
78 * as otherwise the timer could be removed before the softirq code finishes the 78 * as otherwise the timer could be removed before the softirq code finishes the
79 * the handling of the timer. 79 * the handling of the timer.
80 * 80 *
81 * The HRTIMER_STATE_ENQUEUE bit is always or'ed to the current state to 81 * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state to
82 * preserve the HRTIMER_STATE_CALLBACK bit in the above scenario. 82 * preserve the HRTIMER_STATE_CALLBACK bit in the above scenario.
83 * 83 *
84 * All state transitions are protected by cpu_base->lock. 84 * All state transitions are protected by cpu_base->lock.
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 30d606afcafe..7ca198b379af 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -17,6 +17,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
17} 17}
18 18
19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
20int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
20int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 21int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
21int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 22int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
22int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); 23int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int);
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 408696ea5189..b8826107b518 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -100,58 +100,6 @@ struct kern_ipc_perm
100 void *security; 100 void *security;
101}; 101};
102 102
103struct ipc_ids;
104struct ipc_namespace {
105 struct kref kref;
106 struct ipc_ids *ids[3];
107
108 int sem_ctls[4];
109 int used_sems;
110
111 int msg_ctlmax;
112 int msg_ctlmnb;
113 int msg_ctlmni;
114 atomic_t msg_bytes;
115 atomic_t msg_hdrs;
116
117 size_t shm_ctlmax;
118 size_t shm_ctlall;
119 int shm_ctlmni;
120 int shm_tot;
121};
122
123extern struct ipc_namespace init_ipc_ns;
124
125#ifdef CONFIG_SYSVIPC
126#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
127extern void free_ipc_ns(struct kref *kref);
128extern struct ipc_namespace *copy_ipcs(unsigned long flags,
129 struct ipc_namespace *ns);
130#else
131#define INIT_IPC_NS(ns)
132static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
133 struct ipc_namespace *ns)
134{
135 return ns;
136}
137#endif
138
139static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
140{
141#ifdef CONFIG_SYSVIPC
142 if (ns)
143 kref_get(&ns->kref);
144#endif
145 return ns;
146}
147
148static inline void put_ipc_ns(struct ipc_namespace *ns)
149{
150#ifdef CONFIG_SYSVIPC
151 kref_put(&ns->kref, free_ipc_ns);
152#endif
153}
154
155#endif /* __KERNEL__ */ 103#endif /* __KERNEL__ */
156 104
157#endif /* _LINUX_IPC_H */ 105#endif /* _LINUX_IPC_H */
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
new file mode 100644
index 000000000000..e4451d1da753
--- /dev/null
+++ b/include/linux/ipc_namespace.h
@@ -0,0 +1,81 @@
1#ifndef __IPC_NAMESPACE_H__
2#define __IPC_NAMESPACE_H__
3
4#include <linux/err.h>
5#include <linux/idr.h>
6#include <linux/rwsem.h>
7
8struct ipc_ids {
9 int in_use;
10 unsigned short seq;
11 unsigned short seq_max;
12 struct rw_semaphore rw_mutex;
13 struct idr ipcs_idr;
14};
15
16struct ipc_namespace {
17 struct kref kref;
18 struct ipc_ids ids[3];
19
20 int sem_ctls[4];
21 int used_sems;
22
23 int msg_ctlmax;
24 int msg_ctlmnb;
25 int msg_ctlmni;
26 atomic_t msg_bytes;
27 atomic_t msg_hdrs;
28
29 size_t shm_ctlmax;
30 size_t shm_ctlall;
31 int shm_ctlmni;
32 int shm_tot;
33};
34
35extern struct ipc_namespace init_ipc_ns;
36
37#ifdef CONFIG_SYSVIPC
38#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
39#else
40#define INIT_IPC_NS(ns)
41#endif
42
43#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS)
44extern void free_ipc_ns(struct kref *kref);
45extern struct ipc_namespace *copy_ipcs(unsigned long flags,
46 struct ipc_namespace *ns);
47extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
48 void (*free)(struct ipc_namespace *,
49 struct kern_ipc_perm *));
50
51static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
52{
53 if (ns)
54 kref_get(&ns->kref);
55 return ns;
56}
57
58static inline void put_ipc_ns(struct ipc_namespace *ns)
59{
60 kref_put(&ns->kref, free_ipc_ns);
61}
62#else
63static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
64 struct ipc_namespace *ns)
65{
66 if (flags & CLONE_NEWIPC)
67 return ERR_PTR(-EINVAL);
68
69 return ns;
70}
71
72static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
73{
74 return ns;
75}
76
77static inline void put_ipc_ns(struct ipc_namespace *ns)
78{
79}
80#endif
81#endif
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 4669be080617..bfd9efb5cb49 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -25,7 +25,7 @@
25#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
26 26
27struct irq_desc; 27struct irq_desc;
28typedef void fastcall (*irq_flow_handler_t)(unsigned int irq, 28typedef void (*irq_flow_handler_t)(unsigned int irq,
29 struct irq_desc *desc); 29 struct irq_desc *desc);
30 30
31 31
@@ -276,19 +276,19 @@ extern int handle_IRQ_event(unsigned int irq, struct irqaction *action);
276 * Built-in IRQ handlers for various IRQ types, 276 * Built-in IRQ handlers for various IRQ types,
277 * callable via desc->chip->handle_irq() 277 * callable via desc->chip->handle_irq()
278 */ 278 */
279extern void fastcall handle_level_irq(unsigned int irq, struct irq_desc *desc); 279extern void handle_level_irq(unsigned int irq, struct irq_desc *desc);
280extern void fastcall handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); 280extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc);
281extern void fastcall handle_edge_irq(unsigned int irq, struct irq_desc *desc); 281extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc);
282extern void fastcall handle_simple_irq(unsigned int irq, struct irq_desc *desc); 282extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc);
283extern void fastcall handle_percpu_irq(unsigned int irq, struct irq_desc *desc); 283extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
284extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc); 284extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
285 285
286/* 286/*
287 * Monolithic do_IRQ implementation. 287 * Monolithic do_IRQ implementation.
288 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) 288 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
289 */ 289 */
290#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ 290#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
291extern fastcall unsigned int __do_IRQ(unsigned int irq); 291extern unsigned int __do_IRQ(unsigned int irq);
292#endif 292#endif
293 293
294/* 294/*
@@ -367,6 +367,9 @@ set_irq_chained_handler(unsigned int irq,
367 __set_irq_handler(irq, handle, 1, NULL); 367 __set_irq_handler(irq, handle, 1, NULL);
368} 368}
369 369
370extern void set_irq_noprobe(unsigned int irq);
371extern void set_irq_probe(unsigned int irq);
372
370/* Handle dynamic irq creation and destruction */ 373/* Handle dynamic irq creation and destruction */
371extern int create_irq(void); 374extern int create_irq(void);
372extern void destroy_irq(unsigned int irq); 375extern void destroy_irq(unsigned int irq);
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 7ba9e47bf061..e0b5b684d83f 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -42,7 +42,7 @@
42/* LATCH is used in the interval timer and ftape setup. */ 42/* LATCH is used in the interval timer and ftape setup. */
43#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ 43#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
44 44
45/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can 45/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, then we can
46 * improve accuracy by shifting LSH bits, hence calculating: 46 * improve accuracy by shifting LSH bits, hence calculating:
47 * (NOM << LSH) / DEN 47 * (NOM << LSH) / DEN
48 * This however means trouble for large NOM, because (NOM << LSH) may no 48 * This however means trouble for large NOM, because (NOM << LSH) may no
@@ -160,7 +160,7 @@ extern unsigned long preset_lpj;
160 * We want to do realistic conversions of time so we need to use the same 160 * We want to do realistic conversions of time so we need to use the same
161 * values the update wall clock code uses as the jiffies size. This value 161 * values the update wall clock code uses as the jiffies size. This value
162 * is: TICK_NSEC (which is defined in timex.h). This 162 * is: TICK_NSEC (which is defined in timex.h). This
163 * is a constant and is in nanoseconds. We will used scaled math 163 * is a constant and is in nanoseconds. We will use scaled math
164 * with a set of scales defined here as SEC_JIFFIE_SC, USEC_JIFFIE_SC and 164 * with a set of scales defined here as SEC_JIFFIE_SC, USEC_JIFFIE_SC and
165 * NSEC_JIFFIE_SC. Note that these defines contain nothing but 165 * NSEC_JIFFIE_SC. Note that these defines contain nothing but
166 * constants and so are computed at compile time. SHIFT_HZ (computed in 166 * constants and so are computed at compile time. SHIFT_HZ (computed in
@@ -204,7 +204,7 @@ extern unsigned long preset_lpj;
204 * operator if the result is a long long AND at least one of the 204 * operator if the result is a long long AND at least one of the
205 * operands is cast to long long (usually just prior to the "*" so as 205 * operands is cast to long long (usually just prior to the "*" so as
206 * not to confuse it into thinking it really has a 64-bit operand, 206 * not to confuse it into thinking it really has a 64-bit operand,
207 * which, buy the way, it can do, but it take more code and at least 2 207 * which, buy the way, it can do, but it takes more code and at least 2
208 * mpys). 208 * mpys).
209 209
210 * We also need to be aware that one second in nanoseconds is only a 210 * We also need to be aware that one second in nanoseconds is only a
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9e01f376840a..2df44e773270 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -133,7 +133,7 @@ NORET_TYPE void panic(const char * fmt, ...)
133extern void oops_enter(void); 133extern void oops_enter(void);
134extern void oops_exit(void); 134extern void oops_exit(void);
135extern int oops_may_print(void); 135extern int oops_may_print(void);
136fastcall NORET_TYPE void do_exit(long error_code) 136NORET_TYPE void do_exit(long error_code)
137 ATTRIB_NORET; 137 ATTRIB_NORET;
138NORET_TYPE void complete_and_exit(struct completion *, long) 138NORET_TYPE void complete_and_exit(struct completion *, long)
139 ATTRIB_NORET; 139 ATTRIB_NORET;
@@ -141,6 +141,10 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int);
141extern long simple_strtol(const char *,char **,unsigned int); 141extern long simple_strtol(const char *,char **,unsigned int);
142extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 142extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
143extern long long simple_strtoll(const char *,char **,unsigned int); 143extern long long simple_strtoll(const char *,char **,unsigned int);
144extern int strict_strtoul(const char *, unsigned int, unsigned long *);
145extern int strict_strtol(const char *, unsigned int, long *);
146extern int strict_strtoull(const char *, unsigned int, unsigned long long *);
147extern int strict_strtoll(const char *, unsigned int, long long *);
144extern int sprintf(char * buf, const char * fmt, ...) 148extern int sprintf(char * buf, const char * fmt, ...)
145 __attribute__ ((format (printf, 2, 3))); 149 __attribute__ ((format (printf, 2, 3)));
146extern int vsprintf(char *buf, const char *, va_list) 150extern int vsprintf(char *buf, const char *, va_list)
@@ -172,8 +176,6 @@ extern int kernel_text_address(unsigned long addr);
172struct pid; 176struct pid;
173extern struct pid *session_of_pgrp(struct pid *pgrp); 177extern struct pid *session_of_pgrp(struct pid *pgrp);
174 178
175extern void dump_thread(struct pt_regs *regs, struct user *dump);
176
177#ifdef CONFIG_PRINTK 179#ifdef CONFIG_PRINTK
178asmlinkage int vprintk(const char *fmt, va_list args) 180asmlinkage int vprintk(const char *fmt, va_list args)
179 __attribute__ ((format (printf, 1, 0))); 181 __attribute__ ((format (printf, 1, 0)));
@@ -182,6 +184,13 @@ asmlinkage int printk(const char * fmt, ...)
182extern int log_buf_get_len(void); 184extern int log_buf_get_len(void);
183extern int log_buf_read(int idx); 185extern int log_buf_read(int idx);
184extern int log_buf_copy(char *dest, int idx, int len); 186extern int log_buf_copy(char *dest, int idx, int len);
187
188extern int printk_ratelimit_jiffies;
189extern int printk_ratelimit_burst;
190extern int printk_ratelimit(void);
191extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
192extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
193 unsigned int interval_msec);
185#else 194#else
186static inline int vprintk(const char *s, va_list args) 195static inline int vprintk(const char *s, va_list args)
187 __attribute__ ((format (printf, 1, 0))); 196 __attribute__ ((format (printf, 1, 0)));
@@ -192,6 +201,12 @@ static inline int __cold printk(const char *s, ...) { return 0; }
192static inline int log_buf_get_len(void) { return 0; } 201static inline int log_buf_get_len(void) { return 0; }
193static inline int log_buf_read(int idx) { return 0; } 202static inline int log_buf_read(int idx) { return 0; }
194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } 203static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
204static inline int printk_ratelimit(void) { return 0; }
205static inline int __printk_ratelimit(int ratelimit_jiffies, \
206 int ratelimit_burst) { return 0; }
207static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
208 unsigned int interval_msec) \
209 { return false; }
195#endif 210#endif
196 211
197extern void __attribute__((format(printf, 1, 2))) 212extern void __attribute__((format(printf, 1, 2)))
@@ -199,11 +214,6 @@ extern void __attribute__((format(printf, 1, 2)))
199 214
200unsigned long int_sqrt(unsigned long); 215unsigned long int_sqrt(unsigned long);
201 216
202extern int printk_ratelimit(void);
203extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
204extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
205 unsigned int interval_msec);
206
207static inline void console_silent(void) 217static inline void console_silent(void)
208{ 218{
209 console_loglevel = 0; 219 console_loglevel = 0;
@@ -224,6 +234,7 @@ extern int panic_on_unrecovered_nmi;
224extern int tainted; 234extern int tainted;
225extern const char *print_tainted(void); 235extern const char *print_tainted(void);
226extern void add_taint(unsigned); 236extern void add_taint(unsigned);
237extern int root_mountflags;
227 238
228/* Values used for system_state */ 239/* Values used for system_state */
229extern enum system_states { 240extern enum system_states {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 89d7c691b93a..e8abb3814209 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -894,6 +894,18 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
894#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) 894#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;})
895#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 895#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
896 896
897static inline void pgtable_page_ctor(struct page *page)
898{
899 pte_lock_init(page);
900 inc_zone_page_state(page, NR_PAGETABLE);
901}
902
903static inline void pgtable_page_dtor(struct page *page)
904{
905 pte_lock_deinit(page);
906 dec_zone_page_state(page, NR_PAGETABLE);
907}
908
897#define pte_offset_map_lock(mm, pmd, address, ptlp) \ 909#define pte_offset_map_lock(mm, pmd, address, ptlp) \
898({ \ 910({ \
899 spinlock_t *__ptl = pte_lockptr(mm, pmd); \ 911 spinlock_t *__ptl = pte_lockptr(mm, pmd); \
@@ -1136,7 +1148,7 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1136#define FOLL_GET 0x04 /* do get_page on page */ 1148#define FOLL_GET 0x04 /* do get_page on page */
1137#define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ 1149#define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */
1138 1150
1139typedef int (*pte_fn_t)(pte_t *pte, struct page *pmd_page, unsigned long addr, 1151typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1140 void *data); 1152 void *data);
1141extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, 1153extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
1142 unsigned long size, pte_fn_t fn, void *data); 1154 unsigned long size, pte_fn_t fn, void *data);
diff --git a/include/linux/module.h b/include/linux/module.h
index ac481e2094fd..ac28e8761e84 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -449,7 +449,7 @@ static inline void __module_get(struct module *module)
449/* For kallsyms to ask for address resolution. namebuf should be at 449/* For kallsyms to ask for address resolution. namebuf should be at
450 * least KSYM_NAME_LEN long: a pointer to namebuf is returned if 450 * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
451 * found, otherwise NULL. */ 451 * found, otherwise NULL. */
452char *module_address_lookup(unsigned long addr, 452const char *module_address_lookup(unsigned long addr,
453 unsigned long *symbolsize, 453 unsigned long *symbolsize,
454 unsigned long *offset, 454 unsigned long *offset,
455 char **modname, 455 char **modname,
@@ -519,7 +519,7 @@ static inline void module_put(struct module *module)
519#define module_name(mod) "kernel" 519#define module_name(mod) "kernel"
520 520
521/* For kallsyms to ask for address resolution. NULL means not found. */ 521/* For kallsyms to ask for address resolution. NULL means not found. */
522static inline char *module_address_lookup(unsigned long addr, 522static inline const char *module_address_lookup(unsigned long addr,
523 unsigned long *symbolsize, 523 unsigned long *symbolsize,
524 unsigned long *offset, 524 unsigned long *offset,
525 char **modname, 525 char **modname,
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 05c590352dd7..bc6da10ceee0 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -112,7 +112,7 @@ extern void __mutex_init(struct mutex *lock, const char *name,
112 * 112 *
113 * Returns 1 if the mutex is locked, 0 if unlocked. 113 * Returns 1 if the mutex is locked, 0 if unlocked.
114 */ 114 */
115static inline int fastcall mutex_is_locked(struct mutex *lock) 115static inline int mutex_is_locked(struct mutex *lock)
116{ 116{
117 return atomic_read(&lock->count) != 1; 117 return atomic_read(&lock->count) != 1;
118} 118}
@@ -132,9 +132,9 @@ extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
132#define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) 132#define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0)
133#define mutex_lock_killable(lock) mutex_lock_killable_nested(lock, 0) 133#define mutex_lock_killable(lock) mutex_lock_killable_nested(lock, 0)
134#else 134#else
135extern void fastcall mutex_lock(struct mutex *lock); 135extern void mutex_lock(struct mutex *lock);
136extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock); 136extern int __must_check mutex_lock_interruptible(struct mutex *lock);
137extern int __must_check fastcall mutex_lock_killable(struct mutex *lock); 137extern int __must_check mutex_lock_killable(struct mutex *lock);
138 138
139# define mutex_lock_nested(lock, subclass) mutex_lock(lock) 139# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
140# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) 140# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock)
@@ -145,7 +145,7 @@ extern int __must_check fastcall mutex_lock_killable(struct mutex *lock);
145 * NOTE: mutex_trylock() follows the spin_trylock() convention, 145 * NOTE: mutex_trylock() follows the spin_trylock() convention,
146 * not the down_trylock() convention! 146 * not the down_trylock() convention!
147 */ 147 */
148extern int fastcall mutex_trylock(struct mutex *lock); 148extern int mutex_trylock(struct mutex *lock);
149extern void fastcall mutex_unlock(struct mutex *lock); 149extern void mutex_unlock(struct mutex *lock);
150 150
151#endif 151#endif
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index cc2b47240a8f..986572081e19 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -35,7 +35,6 @@ enum {
35}; 35};
36 36
37#define nbd_cmd(req) ((req)->cmd[0]) 37#define nbd_cmd(req) ((req)->cmd[0])
38#define MAX_NBD 128
39 38
40/* userspace doesn't need the nbd_device structure */ 39/* userspace doesn't need the nbd_device structure */
41#ifdef __KERNEL__ 40#ifdef __KERNEL__
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 6db69ff5d83e..700725ddcaae 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -298,6 +298,7 @@ struct sadb_x_sec_ctx {
298#define SADB_X_EALG_BLOWFISHCBC 7 298#define SADB_X_EALG_BLOWFISHCBC 7
299#define SADB_EALG_NULL 11 299#define SADB_EALG_NULL 11
300#define SADB_X_EALG_AESCBC 12 300#define SADB_X_EALG_AESCBC 12
301#define SADB_X_EALG_AESCTR 13
301#define SADB_X_EALG_AES_CCM_ICV8 14 302#define SADB_X_EALG_AES_CCM_ICV8 14
302#define SADB_X_EALG_AES_CCM_ICV12 15 303#define SADB_X_EALG_AES_CCM_ICV12 15
303#define SADB_X_EALG_AES_CCM_ICV16 16 304#define SADB_X_EALG_AES_CCM_ICV16 16
diff --git a/include/linux/pid.h b/include/linux/pid.h
index e29a900a8499..f84d532b5d23 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -118,18 +118,17 @@ extern struct pid *find_pid(int nr);
118 */ 118 */
119extern struct pid *find_get_pid(int nr); 119extern struct pid *find_get_pid(int nr);
120extern struct pid *find_ge_pid(int nr, struct pid_namespace *); 120extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
121int next_pidmap(struct pid_namespace *pid_ns, int last);
121 122
122extern struct pid *alloc_pid(struct pid_namespace *ns); 123extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void FASTCALL(free_pid(struct pid *pid)); 124extern void FASTCALL(free_pid(struct pid *pid));
124extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
125 125
126/* 126/*
127 * the helpers to get the pid's id seen from different namespaces 127 * the helpers to get the pid's id seen from different namespaces
128 * 128 *
129 * pid_nr() : global id, i.e. the id seen from the init namespace; 129 * pid_nr() : global id, i.e. the id seen from the init namespace;
130 * pid_vnr() : virtual id, i.e. the id seen from the namespace this pid 130 * pid_vnr() : virtual id, i.e. the id seen from the pid namespace of
131 * belongs to. this only makes sence when called in the 131 * current.
132 * context of the task that belongs to the same namespace;
133 * pid_nr_ns() : id seen from the ns specified. 132 * pid_nr_ns() : id seen from the ns specified.
134 * 133 *
135 * see also task_xid_nr() etc in include/linux/sched.h 134 * see also task_xid_nr() etc in include/linux/sched.h
@@ -144,14 +143,7 @@ static inline pid_t pid_nr(struct pid *pid)
144} 143}
145 144
146pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns); 145pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
147 146pid_t pid_vnr(struct pid *pid);
148static inline pid_t pid_vnr(struct pid *pid)
149{
150 pid_t nr = 0;
151 if (pid)
152 nr = pid->numbers[pid->level].nr;
153 return nr;
154}
155 147
156#define do_each_pid_task(pid, type, task) \ 148#define do_each_pid_task(pid, type, task) \
157 do { \ 149 do { \
@@ -160,7 +152,13 @@ static inline pid_t pid_vnr(struct pid *pid)
160 hlist_for_each_entry_rcu((task), pos___, \ 152 hlist_for_each_entry_rcu((task), pos___, \
161 &pid->tasks[type], pids[type].node) { 153 &pid->tasks[type], pids[type].node) {
162 154
155 /*
156 * Both old and new leaders may be attached to
157 * the same pid in the middle of de_thread().
158 */
163#define while_each_pid_task(pid, type, task) \ 159#define while_each_pid_task(pid, type, task) \
160 if (type == PIDTYPE_PID) \
161 break; \
164 } \ 162 } \
165 } while (0) 163 } while (0)
166 164
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 1689e28483e4..fcd61fa2c833 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -39,6 +39,7 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
39 39
40extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); 40extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
41extern void free_pid_ns(struct kref *kref); 41extern void free_pid_ns(struct kref *kref);
42extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
42 43
43static inline void put_pid_ns(struct pid_namespace *ns) 44static inline void put_pid_ns(struct pid_namespace *ns)
44{ 45{
@@ -66,6 +67,11 @@ static inline void put_pid_ns(struct pid_namespace *ns)
66{ 67{
67} 68}
68 69
70
71static inline void zap_pid_ns_processes(struct pid_namespace *ns)
72{
73 BUG();
74}
69#endif /* CONFIG_PID_NS */ 75#endif /* CONFIG_PID_NS */
70 76
71static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) 77static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 484988ed301e..23f0c54175cd 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -11,8 +11,8 @@
11#include <linux/list.h> 11#include <linux/list.h>
12 12
13#ifdef CONFIG_DEBUG_PREEMPT 13#ifdef CONFIG_DEBUG_PREEMPT
14 extern void fastcall add_preempt_count(int val); 14 extern void add_preempt_count(int val);
15 extern void fastcall sub_preempt_count(int val); 15 extern void sub_preempt_count(int val);
16#else 16#else
17# define add_preempt_count(val) do { preempt_count() += (val); } while (0) 17# define add_preempt_count(val) do { preempt_count() += (val); } while (0)
18# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0) 18# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e43551516831..d6a4f69bdc92 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -118,13 +118,17 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct
118int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); 118int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
119unsigned long task_vsize(struct mm_struct *); 119unsigned long task_vsize(struct mm_struct *);
120int task_statm(struct mm_struct *, int *, int *, int *, int *); 120int task_statm(struct mm_struct *, int *, int *, int *, int *);
121char *task_mem(struct mm_struct *, char *); 121void task_mem(struct seq_file *, struct mm_struct *);
122void clear_refs_smap(struct mm_struct *mm);
122 123
123struct proc_dir_entry *de_get(struct proc_dir_entry *de); 124struct proc_dir_entry *de_get(struct proc_dir_entry *de);
124void de_put(struct proc_dir_entry *de); 125void de_put(struct proc_dir_entry *de);
125 126
126extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 127extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
127 struct proc_dir_entry *parent); 128 struct proc_dir_entry *parent);
129struct proc_dir_entry *proc_create(const char *name, mode_t mode,
130 struct proc_dir_entry *parent,
131 const struct file_operations *proc_fops);
128extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); 132extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
129 133
130extern struct vfsmount *proc_mnt; 134extern struct vfsmount *proc_mnt;
@@ -219,7 +223,12 @@ static inline void proc_flush_task(struct task_struct *task)
219 223
220static inline struct proc_dir_entry *create_proc_entry(const char *name, 224static inline struct proc_dir_entry *create_proc_entry(const char *name,
221 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 225 mode_t mode, struct proc_dir_entry *parent) { return NULL; }
222 226static inline struct proc_dir_entry *proc_create(const char *name,
227 mode_t mode, struct proc_dir_entry *parent,
228 const struct file_operations *proc_fops)
229{
230 return NULL;
231}
223#define remove_proc_entry(name, parent) do {} while (0) 232#define remove_proc_entry(name, parent) do {} while (0)
224 233
225static inline struct proc_dir_entry *proc_symlink(const char *name, 234static inline struct proc_dir_entry *proc_symlink(const char *name,
@@ -262,6 +271,9 @@ extern void kclist_add(struct kcore_list *, void *, size_t);
262union proc_op { 271union proc_op {
263 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); 272 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **);
264 int (*proc_read)(struct task_struct *task, char *page); 273 int (*proc_read)(struct task_struct *task, char *page);
274 int (*proc_show)(struct seq_file *m,
275 struct pid_namespace *ns, struct pid *pid,
276 struct task_struct *task);
265}; 277};
266 278
267struct proc_inode { 279struct proc_inode {
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 6ab80714a916..ebe0c17039cf 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -67,7 +67,6 @@
67#define PT_TRACE_EXEC 0x00000080 67#define PT_TRACE_EXEC 0x00000080
68#define PT_TRACE_VFORK_DONE 0x00000100 68#define PT_TRACE_VFORK_DONE 0x00000100
69#define PT_TRACE_EXIT 0x00000200 69#define PT_TRACE_EXIT 0x00000200
70#define PT_ATTACHED 0x00000400 /* parent != real_parent */
71 70
72#define PT_TRACE_MASK 0x000003f4 71#define PT_TRACE_MASK 0x000003f4
73 72
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index ece8eb3e4151..60c2a033b19e 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -46,8 +46,8 @@
46#define rcu_bh_qsctr_inc(cpu) 46#define rcu_bh_qsctr_inc(cpu)
47#define call_rcu_bh(head, rcu) call_rcu(head, rcu) 47#define call_rcu_bh(head, rcu) call_rcu(head, rcu)
48 48
49extern void __rcu_read_lock(void); 49extern void __rcu_read_lock(void) __acquires(RCU);
50extern void __rcu_read_unlock(void); 50extern void __rcu_read_unlock(void) __releases(RCU);
51extern int rcu_pending(int cpu); 51extern int rcu_pending(int cpu);
52extern int rcu_needs_cpu(int cpu); 52extern int rcu_needs_cpu(int cpu);
53 53
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 422eab4958a6..8e7eff2cd0ab 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -287,7 +287,7 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
287 287
288/* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16 288/* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16
289 * which overflows on large file systems. */ 289 * which overflows on large file systems. */
290static inline u32 reiserfs_bmap_count(struct super_block *sb) 290static inline __u32 reiserfs_bmap_count(struct super_block *sb)
291{ 291{
292 return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1; 292 return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1;
293} 293}
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8a4812c1c038..00e144117326 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -460,7 +460,7 @@ struct signal_struct {
460 460
461 /* ITIMER_REAL timer for the process */ 461 /* ITIMER_REAL timer for the process */
462 struct hrtimer real_timer; 462 struct hrtimer real_timer;
463 struct task_struct *tsk; 463 struct pid *leader_pid;
464 ktime_t it_real_incr; 464 ktime_t it_real_incr;
465 465
466 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 466 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
@@ -1332,9 +1332,8 @@ struct pid_namespace;
1332 * from various namespaces 1332 * from various namespaces
1333 * 1333 *
1334 * task_xid_nr() : global id, i.e. the id seen from the init namespace; 1334 * task_xid_nr() : global id, i.e. the id seen from the init namespace;
1335 * task_xid_vnr() : virtual id, i.e. the id seen from the namespace the task 1335 * task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of
1336 * belongs to. this only makes sence when called in the 1336 * current.
1337 * context of the task that belongs to the same namespace;
1338 * task_xid_nr_ns() : id seen from the ns specified; 1337 * task_xid_nr_ns() : id seen from the ns specified;
1339 * 1338 *
1340 * set_task_vxid() : assigns a virtual id to a task; 1339 * set_task_vxid() : assigns a virtual id to a task;
@@ -1632,7 +1631,7 @@ extern struct task_struct *find_task_by_vpid(pid_t nr);
1632extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1631extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1633 struct pid_namespace *ns); 1632 struct pid_namespace *ns);
1634 1633
1635extern void __set_special_pids(pid_t session, pid_t pgrp); 1634extern void __set_special_pids(struct pid *pid);
1636 1635
1637/* per-UID process charging. */ 1636/* per-UID process charging. */
1638extern struct user_struct * alloc_uid(struct user_namespace *, uid_t); 1637extern struct user_struct * alloc_uid(struct user_namespace *, uid_t);
@@ -1687,11 +1686,9 @@ extern void block_all_signals(int (*notifier)(void *priv), void *priv,
1687extern void unblock_all_signals(void); 1686extern void unblock_all_signals(void);
1688extern void release_task(struct task_struct * p); 1687extern void release_task(struct task_struct * p);
1689extern int send_sig_info(int, struct siginfo *, struct task_struct *); 1688extern int send_sig_info(int, struct siginfo *, struct task_struct *);
1690extern int send_group_sig_info(int, struct siginfo *, struct task_struct *);
1691extern int force_sigsegv(int, struct task_struct *); 1689extern int force_sigsegv(int, struct task_struct *);
1692extern int force_sig_info(int, struct siginfo *, struct task_struct *); 1690extern int force_sig_info(int, struct siginfo *, struct task_struct *);
1693extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); 1691extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
1694extern int kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
1695extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); 1692extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
1696extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32); 1693extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32);
1697extern int kill_pgrp(struct pid *pid, int sig, int priv); 1694extern int kill_pgrp(struct pid *pid, int sig, int priv);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 9963f81fea9a..1a0b6cf83ff1 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -150,6 +150,10 @@
150#define PORT_MCF 78 150#define PORT_MCF 78
151 151
152 152
153/* MN10300 on-chip UART numbers */
154#define PORT_MN10300 80
155#define PORT_MN10300_CTS 81
156
153#ifdef __KERNEL__ 157#ifdef __KERNEL__
154 158
155#include <linux/compiler.h> 159#include <linux/compiler.h>
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index f3c51899117f..8d5fb36ea047 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -30,9 +30,12 @@ struct shmem_sb_info {
30 unsigned long free_blocks; /* How many are left for allocation */ 30 unsigned long free_blocks; /* How many are left for allocation */
31 unsigned long max_inodes; /* How many inodes are allowed */ 31 unsigned long max_inodes; /* How many inodes are allowed */
32 unsigned long free_inodes; /* How many are left for allocation */ 32 unsigned long free_inodes; /* How many are left for allocation */
33 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
34 uid_t uid; /* Mount uid for root directory */
35 gid_t gid; /* Mount gid for root directory */
36 mode_t mode; /* Mount mode for root directory */
33 int policy; /* Default NUMA memory alloc policy */ 37 int policy; /* Default NUMA memory alloc policy */
34 nodemask_t policy_nodes; /* nodemask for preferred and bind */ 38 nodemask_t policy_nodes; /* nodemask for preferred and bind */
35 spinlock_t stat_lock;
36}; 39};
37 40
38static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) 41static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 7e095147656c..42d2e0a948f4 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -241,6 +241,7 @@ extern int show_unhandled_signals;
241 241
242struct pt_regs; 242struct pt_regs;
243extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 243extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
244extern void exit_signals(struct task_struct *tsk);
244 245
245extern struct kmem_cache *sighand_cachep; 246extern struct kmem_cache *sighand_cachep;
246 247
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 124449733c55..576a5f77d3bd 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -71,7 +71,7 @@
71#define LOCK_SECTION_END \ 71#define LOCK_SECTION_END \
72 ".previous\n\t" 72 ".previous\n\t"
73 73
74#define __lockfunc fastcall __attribute__((section(".spinlock.text"))) 74#define __lockfunc __attribute__((section(".spinlock.text")))
75 75
76/* 76/*
77 * Pull the raw_spinlock_t and raw_rwlock_t definitions: 77 * Pull the raw_spinlock_t and raw_rwlock_t definitions:
diff --git a/include/linux/time.h b/include/linux/time.h
index ceaab9fff155..2091a19f1655 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -120,7 +120,7 @@ extern void getboottime(struct timespec *ts);
120extern void monotonic_to_bootbased(struct timespec *ts); 120extern void monotonic_to_bootbased(struct timespec *ts);
121 121
122extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 122extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
123extern int timekeeping_is_continuous(void); 123extern int timekeeping_valid_for_hres(void);
124extern void update_wall_time(void); 124extern void update_wall_time(void);
125extern void update_xtime_cache(u64 nsec); 125extern void update_xtime_cache(u64 nsec);
126 126
diff --git a/include/linux/timer.h b/include/linux/timer.h
index de0e71359ede..979fefdeb862 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -35,8 +35,8 @@ extern struct tvec_base boot_tvec_bases;
35 struct timer_list _name = \ 35 struct timer_list _name = \
36 TIMER_INITIALIZER(_function, _expires, _data) 36 TIMER_INITIALIZER(_function, _expires, _data)
37 37
38void fastcall init_timer(struct timer_list * timer); 38void init_timer(struct timer_list *timer);
39void fastcall init_timer_deferrable(struct timer_list *timer); 39void init_timer_deferrable(struct timer_list *timer);
40 40
41static inline void setup_timer(struct timer_list * timer, 41static inline void setup_timer(struct timer_list * timer,
42 void (*function)(unsigned long), 42 void (*function)(unsigned long),
@@ -124,8 +124,6 @@ static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
124} 124}
125#endif 125#endif
126 126
127extern void delayed_work_timer_fn(unsigned long __data);
128
129/** 127/**
130 * add_timer - start a timer 128 * add_timer - start a timer
131 * @timer: the timer to be added 129 * @timer: the timer to be added
diff --git a/include/linux/types.h b/include/linux/types.h
index b94c0e4efe24..9dc2346627b4 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -53,7 +53,7 @@ typedef __kernel_uid_t uid_t;
53typedef __kernel_gid_t gid_t; 53typedef __kernel_gid_t gid_t;
54#endif /* __KERNEL__ */ 54#endif /* __KERNEL__ */
55 55
56#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 56#if defined(__GNUC__)
57typedef __kernel_loff_t loff_t; 57typedef __kernel_loff_t loff_t;
58#endif 58#endif
59 59
@@ -119,7 +119,7 @@ typedef __u8 uint8_t;
119typedef __u16 uint16_t; 119typedef __u16 uint16_t;
120typedef __u32 uint32_t; 120typedef __u32 uint32_t;
121 121
122#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 122#if defined(__GNUC__)
123typedef __u64 uint64_t; 123typedef __u64 uint64_t;
124typedef __u64 u_int64_t; 124typedef __u64 u_int64_t;
125typedef __s64 int64_t; 125typedef __s64 int64_t;
@@ -181,7 +181,7 @@ typedef __u16 __bitwise __le16;
181typedef __u16 __bitwise __be16; 181typedef __u16 __bitwise __be16;
182typedef __u32 __bitwise __le32; 182typedef __u32 __bitwise __le32;
183typedef __u32 __bitwise __be32; 183typedef __u32 __bitwise __be32;
184#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 184#if defined(__GNUC__)
185typedef __u64 __bitwise __le64; 185typedef __u64 __bitwise __le64;
186typedef __u64 __bitwise __be64; 186typedef __u64 __bitwise __be64;
187#endif 187#endif
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
index 36c684e1b110..aa88654eb76b 100644
--- a/include/linux/udf_fs.h
+++ b/include/linux/udf_fs.h
@@ -32,18 +32,15 @@
32#define UDF_PREALLOCATE 32#define UDF_PREALLOCATE
33#define UDF_DEFAULT_PREALLOC_BLOCKS 8 33#define UDF_DEFAULT_PREALLOC_BLOCKS 8
34 34
35#define UDFFS_DATE "2004/29/09"
36#define UDFFS_VERSION "0.9.8.1"
37
38#undef UDFFS_DEBUG 35#undef UDFFS_DEBUG
39 36
40#ifdef UDFFS_DEBUG 37#ifdef UDFFS_DEBUG
41#define udf_debug(f, a...) \ 38#define udf_debug(f, a...) \
42 { \ 39 do { \
43 printk (KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \ 40 printk (KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \
44 __FILE__, __LINE__, __FUNCTION__); \ 41 __FILE__, __LINE__, __FUNCTION__); \
45 printk (f, ##a); \ 42 printk (f, ##a); \
46 } 43 } while (0)
47#else 44#else
48#define udf_debug(f, a...) /**/ 45#define udf_debug(f, a...) /**/
49#endif 46#endif
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index 80ae9ef940dc..9bc47352b6b4 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -75,7 +75,7 @@ struct udf_part_map
75struct udf_sb_info 75struct udf_sb_info
76{ 76{
77 struct udf_part_map *s_partmaps; 77 struct udf_part_map *s_partmaps;
78 __u8 s_volident[32]; 78 __u8 s_volume_ident[32];
79 79
80 /* Overall info */ 80 /* Overall info */
81 __u16 s_partitions; 81 __u16 s_partitions;
@@ -84,9 +84,9 @@ struct udf_sb_info
84 /* Sector headers */ 84 /* Sector headers */
85 __s32 s_session; 85 __s32 s_session;
86 __u32 s_anchor[4]; 86 __u32 s_anchor[4];
87 __u32 s_lastblock; 87 __u32 s_last_block;
88 88
89 struct buffer_head *s_lvidbh; 89 struct buffer_head *s_lvid_bh;
90 90
91 /* Default permissions */ 91 /* Default permissions */
92 mode_t s_umask; 92 mode_t s_umask;
@@ -94,10 +94,10 @@ struct udf_sb_info
94 uid_t s_uid; 94 uid_t s_uid;
95 95
96 /* Root Info */ 96 /* Root Info */
97 struct timespec s_recordtime; 97 struct timespec s_record_time;
98 98
99 /* Fileset Info */ 99 /* Fileset Info */
100 __u16 s_serialnum; 100 __u16 s_serial_number;
101 101
102 /* highest UDF revision we have recorded to this media */ 102 /* highest UDF revision we have recorded to this media */
103 __u16 s_udfrev; 103 __u16 s_udfrev;
@@ -109,7 +109,7 @@ struct udf_sb_info
109 struct nls_table *s_nls_map; 109 struct nls_table *s_nls_map;
110 110
111 /* VAT inode */ 111 /* VAT inode */
112 struct inode *s_vat; 112 struct inode *s_vat_inode;
113 113
114 struct mutex s_alloc_mutex; 114 struct mutex s_alloc_mutex;
115}; 115};
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
deleted file mode 100644
index 10b854d3561f..000000000000
--- a/include/linux/ufs_fs.h
+++ /dev/null
@@ -1,953 +0,0 @@
1/*
2 * linux/include/linux/ufs_fs.h
3 *
4 * Copyright (C) 1996
5 * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
6 * Laboratory for Computer Science Research Computing Facility
7 * Rutgers, The State University of New Jersey
8 *
9 * Clean swab support by Fare <fare@tunes.org>
10 * just hope no one is using NNUUXXI on __?64 structure elements
11 * 64-bit clean thanks to Maciej W. Rozycki <macro@ds2.pg.gda.pl>
12 *
13 * 4.4BSD (FreeBSD) support added on February 1st 1998 by
14 * Niels Kristian Bech Jensen <nkbj@image.dk> partially based
15 * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
16 *
17 * NeXTstep support added on February 5th 1998 by
18 * Niels Kristian Bech Jensen <nkbj@image.dk>.
19 *
20 * Write support by Daniel Pirkl <daniel.pirkl@email.cz>
21 *
22 * HP/UX hfs filesystem support added by
23 * Martin K. Petersen <mkp@mkp.net>, August 1999
24 *
25 * UFS2 (of FreeBSD 5.x) support added by
26 * Niraj Kumar <niraj17@iitbombay.org> , Jan 2004
27 *
28 */
29
30#ifndef __LINUX_UFS_FS_H
31#define __LINUX_UFS_FS_H
32
33#include <linux/types.h>
34#include <linux/kernel.h>
35#include <linux/stat.h>
36#include <linux/fs.h>
37
38#ifndef __KERNEL__
39typedef __u64 __fs64;
40typedef __u32 __fs32;
41typedef __u16 __fs16;
42#else
43#include <asm/div64.h>
44typedef __u64 __bitwise __fs64;
45typedef __u32 __bitwise __fs32;
46typedef __u16 __bitwise __fs16;
47#endif
48
49#define UFS_BBLOCK 0
50#define UFS_BBSIZE 8192
51#define UFS_SBLOCK 8192
52#define UFS_SBSIZE 8192
53
54#define UFS_SECTOR_SIZE 512
55#define UFS_SECTOR_BITS 9
56#define UFS_MAGIC 0x00011954
57#define UFS2_MAGIC 0x19540119
58#define UFS_CIGAM 0x54190100 /* byteswapped MAGIC */
59
60/* Copied from FreeBSD */
61/*
62 * Each disk drive contains some number of filesystems.
63 * A filesystem consists of a number of cylinder groups.
64 * Each cylinder group has inodes and data.
65 *
66 * A filesystem is described by its super-block, which in turn
67 * describes the cylinder groups. The super-block is critical
68 * data and is replicated in each cylinder group to protect against
69 * catastrophic loss. This is done at `newfs' time and the critical
70 * super-block data does not change, so the copies need not be
71 * referenced further unless disaster strikes.
72 *
73 * For filesystem fs, the offsets of the various blocks of interest
74 * are given in the super block as:
75 * [fs->fs_sblkno] Super-block
76 * [fs->fs_cblkno] Cylinder group block
77 * [fs->fs_iblkno] Inode blocks
78 * [fs->fs_dblkno] Data blocks
79 * The beginning of cylinder group cg in fs, is given by
80 * the ``cgbase(fs, cg)'' macro.
81 *
82 * Depending on the architecture and the media, the superblock may
83 * reside in any one of four places. For tiny media where every block
84 * counts, it is placed at the very front of the partition. Historically,
85 * UFS1 placed it 8K from the front to leave room for the disk label and
86 * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
87 * room for the disk label and a bigger bootstrap, and for really piggy
88 * systems we check at 256K from the front if the first three fail. In
89 * all cases the size of the superblock will be SBLOCKSIZE. All values are
90 * given in byte-offset form, so they do not imply a sector size. The
91 * SBLOCKSEARCH specifies the order in which the locations should be searched.
92 */
93#define SBLOCK_FLOPPY 0
94#define SBLOCK_UFS1 8192
95#define SBLOCK_UFS2 65536
96#define SBLOCK_PIGGY 262144
97#define SBLOCKSIZE 8192
98#define SBLOCKSEARCH \
99 { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
100
101
102/* HP specific MAGIC values */
103
104#define UFS_MAGIC_LFN 0x00095014 /* fs supports filenames > 14 chars */
105#define UFS_CIGAM_LFN 0x14500900 /* srahc 41 < semanelif stroppus sf */
106
107#define UFS_MAGIC_SEC 0x00612195 /* B1 security fs */
108#define UFS_CIGAM_SEC 0x95216100
109
110#define UFS_MAGIC_FEA 0x00195612 /* fs_featurebits supported */
111#define UFS_CIGAM_FEA 0x12561900
112
113#define UFS_MAGIC_4GB 0x05231994 /* fs > 4 GB && fs_featurebits */
114#define UFS_CIGAM_4GB 0x94192305
115
116/* Seems somebody at HP goofed here. B1 and lfs are both 0x2 !?! */
117#define UFS_FSF_LFN 0x00000001 /* long file names */
118#define UFS_FSF_B1 0x00000002 /* B1 security */
119#define UFS_FSF_LFS 0x00000002 /* large files */
120#define UFS_FSF_LUID 0x00000004 /* large UIDs */
121
122/* End of HP stuff */
123
124
125#define UFS_BSIZE 8192
126#define UFS_MINBSIZE 4096
127#define UFS_FSIZE 1024
128#define UFS_MAXFRAG (UFS_BSIZE / UFS_FSIZE)
129
130#define UFS_NDADDR 12
131#define UFS_NINDIR 3
132
133#define UFS_IND_BLOCK (UFS_NDADDR + 0)
134#define UFS_DIND_BLOCK (UFS_NDADDR + 1)
135#define UFS_TIND_BLOCK (UFS_NDADDR + 2)
136
137#define UFS_NDIR_FRAGMENT (UFS_NDADDR << uspi->s_fpbshift)
138#define UFS_IND_FRAGMENT (UFS_IND_BLOCK << uspi->s_fpbshift)
139#define UFS_DIND_FRAGMENT (UFS_DIND_BLOCK << uspi->s_fpbshift)
140#define UFS_TIND_FRAGMENT (UFS_TIND_BLOCK << uspi->s_fpbshift)
141
142#define UFS_ROOTINO 2
143#define UFS_FIRST_INO (UFS_ROOTINO + 1)
144
145#define UFS_USEEFT ((__u16)65535)
146
147#define UFS_FSOK 0x7c269d38
148#define UFS_FSACTIVE ((__s8)0x00)
149#define UFS_FSCLEAN ((__s8)0x01)
150#define UFS_FSSTABLE ((__s8)0x02)
151#define UFS_FSOSF1 ((__s8)0x03) /* is this correct for DEC OSF/1? */
152#define UFS_FSBAD ((__s8)0xff)
153
154/* From here to next blank line, s_flags for ufs_sb_info */
155/* directory entry encoding */
156#define UFS_DE_MASK 0x00000010 /* mask for the following */
157#define UFS_DE_OLD 0x00000000
158#define UFS_DE_44BSD 0x00000010
159/* uid encoding */
160#define UFS_UID_MASK 0x00000060 /* mask for the following */
161#define UFS_UID_OLD 0x00000000
162#define UFS_UID_44BSD 0x00000020
163#define UFS_UID_EFT 0x00000040
164/* superblock state encoding */
165#define UFS_ST_MASK 0x00000700 /* mask for the following */
166#define UFS_ST_OLD 0x00000000
167#define UFS_ST_44BSD 0x00000100
168#define UFS_ST_SUN 0x00000200 /* Solaris */
169#define UFS_ST_SUNOS 0x00000300
170#define UFS_ST_SUNx86 0x00000400 /* Solaris x86 */
171/*cylinder group encoding */
172#define UFS_CG_MASK 0x00003000 /* mask for the following */
173#define UFS_CG_OLD 0x00000000
174#define UFS_CG_44BSD 0x00002000
175#define UFS_CG_SUN 0x00001000
176/* filesystem type encoding */
177#define UFS_TYPE_MASK 0x00010000 /* mask for the following */
178#define UFS_TYPE_UFS1 0x00000000
179#define UFS_TYPE_UFS2 0x00010000
180
181
182/* fs_inodefmt options */
183#define UFS_42INODEFMT -1
184#define UFS_44INODEFMT 2
185
186/*
187 * MINFREE gives the minimum acceptable percentage of file system
188 * blocks which may be free. If the freelist drops below this level
189 * only the superuser may continue to allocate blocks. This may
190 * be set to 0 if no reserve of free blocks is deemed necessary,
191 * however throughput drops by fifty percent if the file system
192 * is run at between 95% and 100% full; thus the minimum default
193 * value of fs_minfree is 5%. However, to get good clustering
194 * performance, 10% is a better choice. hence we use 10% as our
195 * default value. With 10% free space, fragmentation is not a
196 * problem, so we choose to optimize for time.
197 */
198#define UFS_MINFREE 5
199#define UFS_DEFAULTOPT UFS_OPTTIME
200
201/*
202 * Turn file system block numbers into disk block addresses.
203 * This maps file system blocks to device size blocks.
204 */
205#define ufs_fsbtodb(uspi, b) ((b) << (uspi)->s_fsbtodb)
206#define ufs_dbtofsb(uspi, b) ((b) >> (uspi)->s_fsbtodb)
207
208/*
209 * Cylinder group macros to locate things in cylinder groups.
210 * They calc file system addresses of cylinder group data structures.
211 */
212#define ufs_cgbase(c) (uspi->s_fpg * (c))
213#define ufs_cgstart(c) ((uspi)->fs_magic == UFS2_MAGIC ? ufs_cgbase(c) : \
214 (ufs_cgbase(c) + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask)))
215#define ufs_cgsblock(c) (ufs_cgstart(c) + uspi->s_sblkno) /* super blk */
216#define ufs_cgcmin(c) (ufs_cgstart(c) + uspi->s_cblkno) /* cg block */
217#define ufs_cgimin(c) (ufs_cgstart(c) + uspi->s_iblkno) /* inode blk */
218#define ufs_cgdmin(c) (ufs_cgstart(c) + uspi->s_dblkno) /* 1st data */
219
220/*
221 * Macros for handling inode numbers:
222 * inode number to file system block offset.
223 * inode number to cylinder group number.
224 * inode number to file system block address.
225 */
226#define ufs_inotocg(x) ((x) / uspi->s_ipg)
227#define ufs_inotocgoff(x) ((x) % uspi->s_ipg)
228#define ufs_inotofsba(x) (((u64)ufs_cgimin(ufs_inotocg(x))) + ufs_inotocgoff(x) / uspi->s_inopf)
229#define ufs_inotofsbo(x) ((x) % uspi->s_inopf)
230
231/*
232 * Compute the cylinder and rotational position of a cyl block addr.
233 */
234#define ufs_cbtocylno(bno) \
235 ((bno) * uspi->s_nspf / uspi->s_spc)
236#define ufs_cbtorpos(bno) \
237 ((((bno) * uspi->s_nspf % uspi->s_spc / uspi->s_nsect \
238 * uspi->s_trackskew + (bno) * uspi->s_nspf % uspi->s_spc \
239 % uspi->s_nsect * uspi->s_interleave) % uspi->s_nsect \
240 * uspi->s_nrpos) / uspi->s_npsect)
241
242/*
243 * The following macros optimize certain frequently calculated
244 * quantities by using shifts and masks in place of divisions
245 * modulos and multiplications.
246 */
247#define ufs_blkoff(loc) ((loc) & uspi->s_qbmask)
248#define ufs_fragoff(loc) ((loc) & uspi->s_qfmask)
249#define ufs_lblktosize(blk) ((blk) << uspi->s_bshift)
250#define ufs_lblkno(loc) ((loc) >> uspi->s_bshift)
251#define ufs_numfrags(loc) ((loc) >> uspi->s_fshift)
252#define ufs_blkroundup(size) (((size) + uspi->s_qbmask) & uspi->s_bmask)
253#define ufs_fragroundup(size) (((size) + uspi->s_qfmask) & uspi->s_fmask)
254#define ufs_fragstoblks(frags) ((frags) >> uspi->s_fpbshift)
255#define ufs_blkstofrags(blks) ((blks) << uspi->s_fpbshift)
256#define ufs_fragnum(fsb) ((fsb) & uspi->s_fpbmask)
257#define ufs_blknum(fsb) ((fsb) & ~uspi->s_fpbmask)
258
259#define UFS_MAXNAMLEN 255
260#define UFS_MAXMNTLEN 512
261#define UFS2_MAXMNTLEN 468
262#define UFS2_MAXVOLLEN 32
263#define UFS_MAXCSBUFS 31
264#define UFS_LINK_MAX 32000
265/*
266#define UFS2_NOCSPTRS ((128 / sizeof(void *)) - 4)
267*/
268#define UFS2_NOCSPTRS 28
269
270/*
271 * UFS_DIR_PAD defines the directory entries boundaries
272 * (must be a multiple of 4)
273 */
274#define UFS_DIR_PAD 4
275#define UFS_DIR_ROUND (UFS_DIR_PAD - 1)
276#define UFS_DIR_REC_LEN(name_len) (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND)
277
278struct ufs_timeval {
279 __fs32 tv_sec;
280 __fs32 tv_usec;
281};
282
283struct ufs_dir_entry {
284 __fs32 d_ino; /* inode number of this entry */
285 __fs16 d_reclen; /* length of this entry */
286 union {
287 __fs16 d_namlen; /* actual length of d_name */
288 struct {
289 __u8 d_type; /* file type */
290 __u8 d_namlen; /* length of string in d_name */
291 } d_44;
292 } d_u;
293 __u8 d_name[UFS_MAXNAMLEN + 1]; /* file name */
294};
295
296struct ufs_csum {
297 __fs32 cs_ndir; /* number of directories */
298 __fs32 cs_nbfree; /* number of free blocks */
299 __fs32 cs_nifree; /* number of free inodes */
300 __fs32 cs_nffree; /* number of free frags */
301};
302struct ufs2_csum_total {
303 __fs64 cs_ndir; /* number of directories */
304 __fs64 cs_nbfree; /* number of free blocks */
305 __fs64 cs_nifree; /* number of free inodes */
306 __fs64 cs_nffree; /* number of free frags */
307 __fs64 cs_numclusters; /* number of free clusters */
308 __fs64 cs_spare[3]; /* future expansion */
309};
310
311struct ufs_csum_core {
312 __u64 cs_ndir; /* number of directories */
313 __u64 cs_nbfree; /* number of free blocks */
314 __u64 cs_nifree; /* number of free inodes */
315 __u64 cs_nffree; /* number of free frags */
316 __u64 cs_numclusters; /* number of free clusters */
317};
318
319/*
320 * File system flags
321 */
322#define UFS_UNCLEAN 0x01 /* file system not clean at mount (unused) */
323#define UFS_DOSOFTDEP 0x02 /* file system using soft dependencies */
324#define UFS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */
325#define UFS_INDEXDIRS 0x08 /* kernel supports indexed directories */
326#define UFS_ACLS 0x10 /* file system has ACLs enabled */
327#define UFS_MULTILABEL 0x20 /* file system is MAC multi-label */
328#define UFS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */
329
330#if 0
331/*
332 * This is the actual superblock, as it is laid out on the disk.
333 * Do NOT use this structure, because of sizeof(ufs_super_block) > 512 and
334 * it may occupy several blocks, use
335 * struct ufs_super_block_(first,second,third) instead.
336 */
337struct ufs_super_block {
338 union {
339 struct {
340 __fs32 fs_link; /* UNUSED */
341 } fs_42;
342 struct {
343 __fs32 fs_state; /* file system state flag */
344 } fs_sun;
345 } fs_u0;
346 __fs32 fs_rlink; /* UNUSED */
347 __fs32 fs_sblkno; /* addr of super-block in filesys */
348 __fs32 fs_cblkno; /* offset of cyl-block in filesys */
349 __fs32 fs_iblkno; /* offset of inode-blocks in filesys */
350 __fs32 fs_dblkno; /* offset of first data after cg */
351 __fs32 fs_cgoffset; /* cylinder group offset in cylinder */
352 __fs32 fs_cgmask; /* used to calc mod fs_ntrak */
353 __fs32 fs_time; /* last time written -- time_t */
354 __fs32 fs_size; /* number of blocks in fs */
355 __fs32 fs_dsize; /* number of data blocks in fs */
356 __fs32 fs_ncg; /* number of cylinder groups */
357 __fs32 fs_bsize; /* size of basic blocks in fs */
358 __fs32 fs_fsize; /* size of frag blocks in fs */
359 __fs32 fs_frag; /* number of frags in a block in fs */
360/* these are configuration parameters */
361 __fs32 fs_minfree; /* minimum percentage of free blocks */
362 __fs32 fs_rotdelay; /* num of ms for optimal next block */
363 __fs32 fs_rps; /* disk revolutions per second */
364/* these fields can be computed from the others */
365 __fs32 fs_bmask; /* ``blkoff'' calc of blk offsets */
366 __fs32 fs_fmask; /* ``fragoff'' calc of frag offsets */
367 __fs32 fs_bshift; /* ``lblkno'' calc of logical blkno */
368 __fs32 fs_fshift; /* ``numfrags'' calc number of frags */
369/* these are configuration parameters */
370 __fs32 fs_maxcontig; /* max number of contiguous blks */
371 __fs32 fs_maxbpg; /* max number of blks per cyl group */
372/* these fields can be computed from the others */
373 __fs32 fs_fragshift; /* block to frag shift */
374 __fs32 fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
375 __fs32 fs_sbsize; /* actual size of super block */
376 __fs32 fs_csmask; /* csum block offset */
377 __fs32 fs_csshift; /* csum block number */
378 __fs32 fs_nindir; /* value of NINDIR */
379 __fs32 fs_inopb; /* value of INOPB */
380 __fs32 fs_nspf; /* value of NSPF */
381/* yet another configuration parameter */
382 __fs32 fs_optim; /* optimization preference, see below */
383/* these fields are derived from the hardware */
384 union {
385 struct {
386 __fs32 fs_npsect; /* # sectors/track including spares */
387 } fs_sun;
388 struct {
389 __fs32 fs_state; /* file system state time stamp */
390 } fs_sunx86;
391 } fs_u1;
392 __fs32 fs_interleave; /* hardware sector interleave */
393 __fs32 fs_trackskew; /* sector 0 skew, per track */
394/* a unique id for this filesystem (currently unused and unmaintained) */
395/* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */
396/* Neither of those fields is used in the Tahoe code right now but */
397/* there could be problems if they are. */
398 __fs32 fs_id[2]; /* file system id */
399/* sizes determined by number of cylinder groups and their sizes */
400 __fs32 fs_csaddr; /* blk addr of cyl grp summary area */
401 __fs32 fs_cssize; /* size of cyl grp summary area */
402 __fs32 fs_cgsize; /* cylinder group size */
403/* these fields are derived from the hardware */
404 __fs32 fs_ntrak; /* tracks per cylinder */
405 __fs32 fs_nsect; /* sectors per track */
406 __fs32 fs_spc; /* sectors per cylinder */
407/* this comes from the disk driver partitioning */
408 __fs32 fs_ncyl; /* cylinders in file system */
409/* these fields can be computed from the others */
410 __fs32 fs_cpg; /* cylinders per group */
411 __fs32 fs_ipg; /* inodes per cylinder group */
412 __fs32 fs_fpg; /* blocks per group * fs_frag */
413/* this data must be re-computed after crashes */
414 struct ufs_csum fs_cstotal; /* cylinder summary information */
415/* these fields are cleared at mount time */
416 __s8 fs_fmod; /* super block modified flag */
417 __s8 fs_clean; /* file system is clean flag */
418 __s8 fs_ronly; /* mounted read-only flag */
419 __s8 fs_flags;
420 union {
421 struct {
422 __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */
423 __fs32 fs_cgrotor; /* last cg searched */
424 __fs32 fs_csp[UFS_MAXCSBUFS];/*list of fs_cs info buffers */
425 __fs32 fs_maxcluster;
426 __fs32 fs_cpc; /* cyl per cycle in postbl */
427 __fs16 fs_opostbl[16][8]; /* old rotation block list head */
428 } fs_u1;
429 struct {
430 __s8 fs_fsmnt[UFS2_MAXMNTLEN]; /* name mounted on */
431 __u8 fs_volname[UFS2_MAXVOLLEN]; /* volume name */
432 __fs64 fs_swuid; /* system-wide uid */
433 __fs32 fs_pad; /* due to alignment of fs_swuid */
434 __fs32 fs_cgrotor; /* last cg searched */
435 __fs32 fs_ocsp[UFS2_NOCSPTRS]; /*list of fs_cs info buffers */
436 __fs32 fs_contigdirs;/*# of contiguously allocated dirs */
437 __fs32 fs_csp; /* cg summary info buffer for fs_cs */
438 __fs32 fs_maxcluster;
439 __fs32 fs_active;/* used by snapshots to track fs */
440 __fs32 fs_old_cpc; /* cyl per cycle in postbl */
441 __fs32 fs_maxbsize;/*maximum blocking factor permitted */
442 __fs64 fs_sparecon64[17];/*old rotation block list head */
443 __fs64 fs_sblockloc; /* byte offset of standard superblock */
444 struct ufs2_csum_total fs_cstotal;/*cylinder summary information*/
445 struct ufs_timeval fs_time; /* last time written */
446 __fs64 fs_size; /* number of blocks in fs */
447 __fs64 fs_dsize; /* number of data blocks in fs */
448 __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
449 __fs64 fs_pendingblocks;/* blocks in process of being freed */
450 __fs32 fs_pendinginodes;/*inodes in process of being freed */
451 } fs_u2;
452 } fs_u11;
453 union {
454 struct {
455 __fs32 fs_sparecon[53];/* reserved for future constants */
456 __fs32 fs_reclaim;
457 __fs32 fs_sparecon2[1];
458 __fs32 fs_state; /* file system state time stamp */
459 __fs32 fs_qbmask[2]; /* ~usb_bmask */
460 __fs32 fs_qfmask[2]; /* ~usb_fmask */
461 } fs_sun;
462 struct {
463 __fs32 fs_sparecon[53];/* reserved for future constants */
464 __fs32 fs_reclaim;
465 __fs32 fs_sparecon2[1];
466 __fs32 fs_npsect; /* # sectors/track including spares */
467 __fs32 fs_qbmask[2]; /* ~usb_bmask */
468 __fs32 fs_qfmask[2]; /* ~usb_fmask */
469 } fs_sunx86;
470 struct {
471 __fs32 fs_sparecon[50];/* reserved for future constants */
472 __fs32 fs_contigsumsize;/* size of cluster summary array */
473 __fs32 fs_maxsymlinklen;/* max length of an internal symlink */
474 __fs32 fs_inodefmt; /* format of on-disk inodes */
475 __fs32 fs_maxfilesize[2]; /* max representable file size */
476 __fs32 fs_qbmask[2]; /* ~usb_bmask */
477 __fs32 fs_qfmask[2]; /* ~usb_fmask */
478 __fs32 fs_state; /* file system state time stamp */
479 } fs_44;
480 } fs_u2;
481 __fs32 fs_postblformat; /* format of positional layout tables */
482 __fs32 fs_nrpos; /* number of rotational positions */
483 __fs32 fs_postbloff; /* (__s16) rotation block list head */
484 __fs32 fs_rotbloff; /* (__u8) blocks for each rotation */
485 __fs32 fs_magic; /* magic number */
486 __u8 fs_space[1]; /* list of blocks for each rotation */
487};
488#endif/*struct ufs_super_block*/
489
490/*
491 * Preference for optimization.
492 */
493#define UFS_OPTTIME 0 /* minimize allocation time */
494#define UFS_OPTSPACE 1 /* minimize disk fragmentation */
495
496/*
497 * Rotational layout table format types
498 */
499#define UFS_42POSTBLFMT -1 /* 4.2BSD rotational table format */
500#define UFS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */
501
502/*
503 * Convert cylinder group to base address of its global summary info.
504 */
505#define fs_cs(indx) s_csp[(indx)]
506
507/*
508 * Cylinder group block for a file system.
509 *
510 * Writable fields in the cylinder group are protected by the associated
511 * super block lock fs->fs_lock.
512 */
513#define CG_MAGIC 0x090255
514#define ufs_cg_chkmagic(sb, ucg) \
515 (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
516/*
517 * Macros for access to old cylinder group array structures
518 */
519#define ufs_ocg_blktot(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_btot)
520#define ufs_ocg_blks(sb, ucg, cylno) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_b[cylno])
521#define ufs_ocg_inosused(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_iused)
522#define ufs_ocg_blksfree(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_free)
523#define ufs_ocg_chkmagic(sb, ucg) \
524 (fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_magic) == CG_MAGIC)
525
526/*
527 * size of this structure is 172 B
528 */
529struct ufs_cylinder_group {
530 __fs32 cg_link; /* linked list of cyl groups */
531 __fs32 cg_magic; /* magic number */
532 __fs32 cg_time; /* time last written */
533 __fs32 cg_cgx; /* we are the cgx'th cylinder group */
534 __fs16 cg_ncyl; /* number of cyl's this cg */
535 __fs16 cg_niblk; /* number of inode blocks this cg */
536 __fs32 cg_ndblk; /* number of data blocks this cg */
537 struct ufs_csum cg_cs; /* cylinder summary information */
538 __fs32 cg_rotor; /* position of last used block */
539 __fs32 cg_frotor; /* position of last used frag */
540 __fs32 cg_irotor; /* position of last used inode */
541 __fs32 cg_frsum[UFS_MAXFRAG]; /* counts of available frags */
542 __fs32 cg_btotoff; /* (__u32) block totals per cylinder */
543 __fs32 cg_boff; /* (short) free block positions */
544 __fs32 cg_iusedoff; /* (char) used inode map */
545 __fs32 cg_freeoff; /* (u_char) free block map */
546 __fs32 cg_nextfreeoff; /* (u_char) next available space */
547 union {
548 struct {
549 __fs32 cg_clustersumoff; /* (u_int32) counts of avail clusters */
550 __fs32 cg_clusteroff; /* (u_int8) free cluster map */
551 __fs32 cg_nclusterblks; /* number of clusters this cg */
552 __fs32 cg_sparecon[13]; /* reserved for future use */
553 } cg_44;
554 struct {
555 __fs32 cg_clustersumoff;/* (u_int32) counts of avail clusters */
556 __fs32 cg_clusteroff; /* (u_int8) free cluster map */
557 __fs32 cg_nclusterblks;/* number of clusters this cg */
558 __fs32 cg_niblk; /* number of inode blocks this cg */
559 __fs32 cg_initediblk; /* last initialized inode */
560 __fs32 cg_sparecon32[3];/* reserved for future use */
561 __fs64 cg_time; /* time last written */
562 __fs64 cg_sparecon[3]; /* reserved for future use */
563 } cg_u2;
564 __fs32 cg_sparecon[16]; /* reserved for future use */
565 } cg_u;
566 __u8 cg_space[1]; /* space for cylinder group maps */
567/* actually longer */
568};
569
570/* Historic Cylinder group info */
571struct ufs_old_cylinder_group {
572 __fs32 cg_link; /* linked list of cyl groups */
573 __fs32 cg_rlink; /* for incore cyl groups */
574 __fs32 cg_time; /* time last written */
575 __fs32 cg_cgx; /* we are the cgx'th cylinder group */
576 __fs16 cg_ncyl; /* number of cyl's this cg */
577 __fs16 cg_niblk; /* number of inode blocks this cg */
578 __fs32 cg_ndblk; /* number of data blocks this cg */
579 struct ufs_csum cg_cs; /* cylinder summary information */
580 __fs32 cg_rotor; /* position of last used block */
581 __fs32 cg_frotor; /* position of last used frag */
582 __fs32 cg_irotor; /* position of last used inode */
583 __fs32 cg_frsum[8]; /* counts of available frags */
584 __fs32 cg_btot[32]; /* block totals per cylinder */
585 __fs16 cg_b[32][8]; /* positions of free blocks */
586 __u8 cg_iused[256]; /* used inode map */
587 __fs32 cg_magic; /* magic number */
588 __u8 cg_free[1]; /* free block map */
589/* actually longer */
590};
591
592/*
593 * structure of an on-disk inode
594 */
595struct ufs_inode {
596 __fs16 ui_mode; /* 0x0 */
597 __fs16 ui_nlink; /* 0x2 */
598 union {
599 struct {
600 __fs16 ui_suid; /* 0x4 */
601 __fs16 ui_sgid; /* 0x6 */
602 } oldids;
603 __fs32 ui_inumber; /* 0x4 lsf: inode number */
604 __fs32 ui_author; /* 0x4 GNU HURD: author */
605 } ui_u1;
606 __fs64 ui_size; /* 0x8 */
607 struct ufs_timeval ui_atime; /* 0x10 access */
608 struct ufs_timeval ui_mtime; /* 0x18 modification */
609 struct ufs_timeval ui_ctime; /* 0x20 creation */
610 union {
611 struct {
612 __fs32 ui_db[UFS_NDADDR];/* 0x28 data blocks */
613 __fs32 ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */
614 } ui_addr;
615 __u8 ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
616 } ui_u2;
617 __fs32 ui_flags; /* 0x64 immutable, append-only... */
618 __fs32 ui_blocks; /* 0x68 blocks in use */
619 __fs32 ui_gen; /* 0x6c like ext2 i_version, for NFS support */
620 union {
621 struct {
622 __fs32 ui_shadow; /* 0x70 shadow inode with security data */
623 __fs32 ui_uid; /* 0x74 long EFT version of uid */
624 __fs32 ui_gid; /* 0x78 long EFT version of gid */
625 __fs32 ui_oeftflag; /* 0x7c reserved */
626 } ui_sun;
627 struct {
628 __fs32 ui_uid; /* 0x70 File owner */
629 __fs32 ui_gid; /* 0x74 File group */
630 __fs32 ui_spare[2]; /* 0x78 reserved */
631 } ui_44;
632 struct {
633 __fs32 ui_uid; /* 0x70 */
634 __fs32 ui_gid; /* 0x74 */
635 __fs16 ui_modeh; /* 0x78 mode high bits */
636 __fs16 ui_spare; /* 0x7A unused */
637 __fs32 ui_trans; /* 0x7c filesystem translator */
638 } ui_hurd;
639 } ui_u3;
640};
641
642#define UFS_NXADDR 2 /* External addresses in inode. */
643struct ufs2_inode {
644 __fs16 ui_mode; /* 0: IFMT, permissions; see below. */
645 __fs16 ui_nlink; /* 2: File link count. */
646 __fs32 ui_uid; /* 4: File owner. */
647 __fs32 ui_gid; /* 8: File group. */
648 __fs32 ui_blksize; /* 12: Inode blocksize. */
649 __fs64 ui_size; /* 16: File byte count. */
650 __fs64 ui_blocks; /* 24: Bytes actually held. */
651 __fs64 ui_atime; /* 32: Last access time. */
652 __fs64 ui_mtime; /* 40: Last modified time. */
653 __fs64 ui_ctime; /* 48: Last inode change time. */
654 __fs64 ui_birthtime; /* 56: Inode creation time. */
655 __fs32 ui_mtimensec; /* 64: Last modified time. */
656 __fs32 ui_atimensec; /* 68: Last access time. */
657 __fs32 ui_ctimensec; /* 72: Last inode change time. */
658 __fs32 ui_birthnsec; /* 76: Inode creation time. */
659 __fs32 ui_gen; /* 80: Generation number. */
660 __fs32 ui_kernflags; /* 84: Kernel flags. */
661 __fs32 ui_flags; /* 88: Status flags (chflags). */
662 __fs32 ui_extsize; /* 92: External attributes block. */
663 __fs64 ui_extb[UFS_NXADDR];/* 96: External attributes block. */
664 union {
665 struct {
666 __fs64 ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
667 __fs64 ui_ib[UFS_NINDIR];/* 208: Indirect disk blocks.*/
668 } ui_addr;
669 __u8 ui_symlink[2*4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
670 } ui_u2;
671 __fs64 ui_spare[3]; /* 232: Reserved; currently unused */
672};
673
674
675/* FreeBSD has these in sys/stat.h */
676/* ui_flags that can be set by a file owner */
677#define UFS_UF_SETTABLE 0x0000ffff
678#define UFS_UF_NODUMP 0x00000001 /* do not dump */
679#define UFS_UF_IMMUTABLE 0x00000002 /* immutable (can't "change") */
680#define UFS_UF_APPEND 0x00000004 /* append-only */
681#define UFS_UF_OPAQUE 0x00000008 /* directory is opaque (unionfs) */
682#define UFS_UF_NOUNLINK 0x00000010 /* can't be removed or renamed */
683/* ui_flags that only root can set */
684#define UFS_SF_SETTABLE 0xffff0000
685#define UFS_SF_ARCHIVED 0x00010000 /* archived */
686#define UFS_SF_IMMUTABLE 0x00020000 /* immutable (can't "change") */
687#define UFS_SF_APPEND 0x00040000 /* append-only */
688#define UFS_SF_NOUNLINK 0x00100000 /* can't be removed or renamed */
689
690/*
691 * This structure is used for reading disk structures larger
692 * than the size of fragment.
693 */
694struct ufs_buffer_head {
695 __u64 fragment; /* first fragment */
696 __u64 count; /* number of fragments */
697 struct buffer_head * bh[UFS_MAXFRAG]; /* buffers */
698};
699
700struct ufs_cg_private_info {
701 struct ufs_buffer_head c_ubh;
702 __u32 c_cgx; /* number of cylidner group */
703 __u16 c_ncyl; /* number of cyl's this cg */
704 __u16 c_niblk; /* number of inode blocks this cg */
705 __u32 c_ndblk; /* number of data blocks this cg */
706 __u32 c_rotor; /* position of last used block */
707 __u32 c_frotor; /* position of last used frag */
708 __u32 c_irotor; /* position of last used inode */
709 __u32 c_btotoff; /* (__u32) block totals per cylinder */
710 __u32 c_boff; /* (short) free block positions */
711 __u32 c_iusedoff; /* (char) used inode map */
712 __u32 c_freeoff; /* (u_char) free block map */
713 __u32 c_nextfreeoff; /* (u_char) next available space */
714 __u32 c_clustersumoff;/* (u_int32) counts of avail clusters */
715 __u32 c_clusteroff; /* (u_int8) free cluster map */
716 __u32 c_nclusterblks; /* number of clusters this cg */
717};
718
719
720struct ufs_sb_private_info {
721 struct ufs_buffer_head s_ubh; /* buffer containing super block */
722 struct ufs_csum_core cs_total;
723 __u32 s_sblkno; /* offset of super-blocks in filesys */
724 __u32 s_cblkno; /* offset of cg-block in filesys */
725 __u32 s_iblkno; /* offset of inode-blocks in filesys */
726 __u32 s_dblkno; /* offset of first data after cg */
727 __u32 s_cgoffset; /* cylinder group offset in cylinder */
728 __u32 s_cgmask; /* used to calc mod fs_ntrak */
729 __u32 s_size; /* number of blocks (fragments) in fs */
730 __u32 s_dsize; /* number of data blocks in fs */
731 __u64 s_u2_size; /* ufs2: number of blocks (fragments) in fs */
732 __u64 s_u2_dsize; /*ufs2: number of data blocks in fs */
733 __u32 s_ncg; /* number of cylinder groups */
734 __u32 s_bsize; /* size of basic blocks */
735 __u32 s_fsize; /* size of fragments */
736 __u32 s_fpb; /* fragments per block */
737 __u32 s_minfree; /* minimum percentage of free blocks */
738 __u32 s_bmask; /* `blkoff'' calc of blk offsets */
739 __u32 s_fmask; /* s_fsize mask */
740 __u32 s_bshift; /* `lblkno'' calc of logical blkno */
741 __u32 s_fshift; /* s_fsize shift */
742 __u32 s_fpbshift; /* fragments per block shift */
743 __u32 s_fsbtodb; /* fsbtodb and dbtofsb shift constant */
744 __u32 s_sbsize; /* actual size of super block */
745 __u32 s_csmask; /* csum block offset */
746 __u32 s_csshift; /* csum block number */
747 __u32 s_nindir; /* value of NINDIR */
748 __u32 s_inopb; /* value of INOPB */
749 __u32 s_nspf; /* value of NSPF */
750 __u32 s_npsect; /* # sectors/track including spares */
751 __u32 s_interleave; /* hardware sector interleave */
752 __u32 s_trackskew; /* sector 0 skew, per track */
753 __u64 s_csaddr; /* blk addr of cyl grp summary area */
754 __u32 s_cssize; /* size of cyl grp summary area */
755 __u32 s_cgsize; /* cylinder group size */
756 __u32 s_ntrak; /* tracks per cylinder */
757 __u32 s_nsect; /* sectors per track */
758 __u32 s_spc; /* sectors per cylinder */
759 __u32 s_ipg; /* inodes per cylinder group */
760 __u32 s_fpg; /* fragments per group */
761 __u32 s_cpc; /* cyl per cycle in postbl */
762 __s32 s_contigsumsize;/* size of cluster summary array, 44bsd */
763 __s64 s_qbmask; /* ~usb_bmask */
764 __s64 s_qfmask; /* ~usb_fmask */
765 __s32 s_postblformat; /* format of positional layout tables */
766 __s32 s_nrpos; /* number of rotational positions */
767 __s32 s_postbloff; /* (__s16) rotation block list head */
768 __s32 s_rotbloff; /* (__u8) blocks for each rotation */
769
770 __u32 s_fpbmask; /* fragments per block mask */
771 __u32 s_apb; /* address per block */
772 __u32 s_2apb; /* address per block^2 */
773 __u32 s_3apb; /* address per block^3 */
774 __u32 s_apbmask; /* address per block mask */
775 __u32 s_apbshift; /* address per block shift */
776 __u32 s_2apbshift; /* address per block shift * 2 */
777 __u32 s_3apbshift; /* address per block shift * 3 */
778 __u32 s_nspfshift; /* number of sector per fragment shift */
779 __u32 s_nspb; /* number of sector per block */
780 __u32 s_inopf; /* inodes per fragment */
781 __u32 s_sbbase; /* offset of NeXTstep superblock */
782 __u32 s_bpf; /* bits per fragment */
783 __u32 s_bpfshift; /* bits per fragment shift*/
784 __u32 s_bpfmask; /* bits per fragment mask */
785
786 __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */
787 __s32 fs_magic; /* filesystem magic */
788 unsigned int s_dirblksize;
789};
790
791/*
792 * Sizes of this structures are:
793 * ufs_super_block_first 512
794 * ufs_super_block_second 512
795 * ufs_super_block_third 356
796 */
797struct ufs_super_block_first {
798 union {
799 struct {
800 __fs32 fs_link; /* UNUSED */
801 } fs_42;
802 struct {
803 __fs32 fs_state; /* file system state flag */
804 } fs_sun;
805 } fs_u0;
806 __fs32 fs_rlink;
807 __fs32 fs_sblkno;
808 __fs32 fs_cblkno;
809 __fs32 fs_iblkno;
810 __fs32 fs_dblkno;
811 __fs32 fs_cgoffset;
812 __fs32 fs_cgmask;
813 __fs32 fs_time;
814 __fs32 fs_size;
815 __fs32 fs_dsize;
816 __fs32 fs_ncg;
817 __fs32 fs_bsize;
818 __fs32 fs_fsize;
819 __fs32 fs_frag;
820 __fs32 fs_minfree;
821 __fs32 fs_rotdelay;
822 __fs32 fs_rps;
823 __fs32 fs_bmask;
824 __fs32 fs_fmask;
825 __fs32 fs_bshift;
826 __fs32 fs_fshift;
827 __fs32 fs_maxcontig;
828 __fs32 fs_maxbpg;
829 __fs32 fs_fragshift;
830 __fs32 fs_fsbtodb;
831 __fs32 fs_sbsize;
832 __fs32 fs_csmask;
833 __fs32 fs_csshift;
834 __fs32 fs_nindir;
835 __fs32 fs_inopb;
836 __fs32 fs_nspf;
837 __fs32 fs_optim;
838 union {
839 struct {
840 __fs32 fs_npsect;
841 } fs_sun;
842 struct {
843 __fs32 fs_state;
844 } fs_sunx86;
845 } fs_u1;
846 __fs32 fs_interleave;
847 __fs32 fs_trackskew;
848 __fs32 fs_id[2];
849 __fs32 fs_csaddr;
850 __fs32 fs_cssize;
851 __fs32 fs_cgsize;
852 __fs32 fs_ntrak;
853 __fs32 fs_nsect;
854 __fs32 fs_spc;
855 __fs32 fs_ncyl;
856 __fs32 fs_cpg;
857 __fs32 fs_ipg;
858 __fs32 fs_fpg;
859 struct ufs_csum fs_cstotal;
860 __s8 fs_fmod;
861 __s8 fs_clean;
862 __s8 fs_ronly;
863 __s8 fs_flags;
864 __s8 fs_fsmnt[UFS_MAXMNTLEN - 212];
865
866};
867
868struct ufs_super_block_second {
869 union {
870 struct {
871 __s8 fs_fsmnt[212];
872 __fs32 fs_cgrotor;
873 __fs32 fs_csp[UFS_MAXCSBUFS];
874 __fs32 fs_maxcluster;
875 __fs32 fs_cpc;
876 __fs16 fs_opostbl[82];
877 } fs_u1;
878 struct {
879 __s8 fs_fsmnt[UFS2_MAXMNTLEN - UFS_MAXMNTLEN + 212];
880 __u8 fs_volname[UFS2_MAXVOLLEN];
881 __fs64 fs_swuid;
882 __fs32 fs_pad;
883 __fs32 fs_cgrotor;
884 __fs32 fs_ocsp[UFS2_NOCSPTRS];
885 __fs32 fs_contigdirs;
886 __fs32 fs_csp;
887 __fs32 fs_maxcluster;
888 __fs32 fs_active;
889 __fs32 fs_old_cpc;
890 __fs32 fs_maxbsize;
891 __fs64 fs_sparecon64[17];
892 __fs64 fs_sblockloc;
893 __fs64 cs_ndir;
894 __fs64 cs_nbfree;
895 } fs_u2;
896 } fs_un;
897};
898
899struct ufs_super_block_third {
900 union {
901 struct {
902 __fs16 fs_opostbl[46];
903 } fs_u1;
904 struct {
905 __fs64 cs_nifree; /* number of free inodes */
906 __fs64 cs_nffree; /* number of free frags */
907 __fs64 cs_numclusters; /* number of free clusters */
908 __fs64 cs_spare[3]; /* future expansion */
909 struct ufs_timeval fs_time; /* last time written */
910 __fs64 fs_size; /* number of blocks in fs */
911 __fs64 fs_dsize; /* number of data blocks in fs */
912 __fs64 fs_csaddr; /* blk addr of cyl grp summary area */
913 __fs64 fs_pendingblocks;/* blocks in process of being freed */
914 __fs32 fs_pendinginodes;/*inodes in process of being freed */
915 } __attribute__ ((packed)) fs_u2;
916 } fs_un1;
917 union {
918 struct {
919 __fs32 fs_sparecon[53];/* reserved for future constants */
920 __fs32 fs_reclaim;
921 __fs32 fs_sparecon2[1];
922 __fs32 fs_state; /* file system state time stamp */
923 __fs32 fs_qbmask[2]; /* ~usb_bmask */
924 __fs32 fs_qfmask[2]; /* ~usb_fmask */
925 } fs_sun;
926 struct {
927 __fs32 fs_sparecon[53];/* reserved for future constants */
928 __fs32 fs_reclaim;
929 __fs32 fs_sparecon2[1];
930 __fs32 fs_npsect; /* # sectors/track including spares */
931 __fs32 fs_qbmask[2]; /* ~usb_bmask */
932 __fs32 fs_qfmask[2]; /* ~usb_fmask */
933 } fs_sunx86;
934 struct {
935 __fs32 fs_sparecon[50];/* reserved for future constants */
936 __fs32 fs_contigsumsize;/* size of cluster summary array */
937 __fs32 fs_maxsymlinklen;/* max length of an internal symlink */
938 __fs32 fs_inodefmt; /* format of on-disk inodes */
939 __fs32 fs_maxfilesize[2]; /* max representable file size */
940 __fs32 fs_qbmask[2]; /* ~usb_bmask */
941 __fs32 fs_qfmask[2]; /* ~usb_fmask */
942 __fs32 fs_state; /* file system state time stamp */
943 } fs_44;
944 } fs_un2;
945 __fs32 fs_postblformat;
946 __fs32 fs_nrpos;
947 __fs32 fs_postbloff;
948 __fs32 fs_rotbloff;
949 __fs32 fs_magic;
950 __u8 fs_space[1];
951};
952
953#endif /* __LINUX_UFS_FS_H */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 923db99175f2..11232676bfff 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -35,6 +35,7 @@ struct new_utsname {
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/kref.h> 36#include <linux/kref.h>
37#include <linux/nsproxy.h> 37#include <linux/nsproxy.h>
38#include <linux/err.h>
38#include <asm/atomic.h> 39#include <asm/atomic.h>
39 40
40struct uts_namespace { 41struct uts_namespace {
@@ -43,6 +44,7 @@ struct uts_namespace {
43}; 44};
44extern struct uts_namespace init_uts_ns; 45extern struct uts_namespace init_uts_ns;
45 46
47#ifdef CONFIG_UTS_NS
46static inline void get_uts_ns(struct uts_namespace *ns) 48static inline void get_uts_ns(struct uts_namespace *ns)
47{ 49{
48 kref_get(&ns->kref); 50 kref_get(&ns->kref);
@@ -56,6 +58,25 @@ static inline void put_uts_ns(struct uts_namespace *ns)
56{ 58{
57 kref_put(&ns->kref, free_uts_ns); 59 kref_put(&ns->kref, free_uts_ns);
58} 60}
61#else
62static inline void get_uts_ns(struct uts_namespace *ns)
63{
64}
65
66static inline void put_uts_ns(struct uts_namespace *ns)
67{
68}
69
70static inline struct uts_namespace *copy_utsname(unsigned long flags,
71 struct uts_namespace *ns)
72{
73 if (flags & CLONE_NEWUTS)
74 return ERR_PTR(-EINVAL);
75
76 return ns;
77}
78#endif
79
59static inline struct new_utsname *utsname(void) 80static inline struct new_utsname *utsname(void)
60{ 81{
61 return &current->nsproxy->uts_ns->name; 82 return &current->nsproxy->uts_ns->name;