diff options
Diffstat (limited to 'include/linux')
40 files changed, 358 insertions, 1110 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 2ebf068ba50..5cae9b5960e 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -338,7 +338,6 @@ unifdef-y += tty.h unifdef-y += types.h unifdef-y += udf_fs_i.h unifdef-y += udp.h -unifdef-y += ufs_fs.h unifdef-y += uinput.h unifdef-y += uio.h unifdef-y += unistd.h diff --git a/include/linux/a.out.h b/include/linux/a.out.h index 82cd918f2ab..208f4e8ed30 100644 --- a/include/linux/a.out.h +++ b/include/linux/a.out.h @@ -1,6 +1,8 @@ #ifndef __A_OUT_GNU_H__ #define __A_OUT_GNU_H__ +#ifdef CONFIG_ARCH_SUPPORTS_AOUT + #define __GNU_EXEC_MACROS__ #ifndef __STRUCT_EXEC_OVERRIDE__ @@ -9,6 +11,8 @@ #endif /* __STRUCT_EXEC_OVERRIDE__ */ +#ifndef __ASSEMBLY__ + /* these go in the N_MACHTYPE field */ enum machine_type { #if defined (M_OLDSUN2) @@ -272,5 +276,11 @@ struct relocation_info }; #endif /* no N_RELOCATION_INFO_DECLARED. */ - +#endif /*__ASSEMBLY__ */ +#else /* CONFIG_ARCH_SUPPORTS_AOUT */ +#ifndef __ASSEMBLY__ +struct exec { +}; +#endif +#endif /* CONFIG_ARCH_SUPPORTS_AOUT */ #endif /* __A_OUT_GNU_H__ */ diff --git a/include/linux/atmel_pwm.h b/include/linux/atmel_pwm.h new file mode 100644 index 00000000000..ea04abb3db8 --- /dev/null +++ b/include/linux/atmel_pwm.h @@ -0,0 +1,70 @@ +#ifndef __LINUX_ATMEL_PWM_H +#define __LINUX_ATMEL_PWM_H + +/** + * struct pwm_channel - driver handle to a PWM channel + * @regs: base of this channel's registers + * @index: number of this channel (0..31) + * @mck: base clock rate, which can be prescaled and maybe subdivided + * + * Drivers initialize a pwm_channel structure using pwm_channel_alloc(). + * Then they configure its clock rate (derived from MCK), alignment, + * polarity, and duty cycle by writing directly to the channel registers, + * before enabling the channel by calling pwm_channel_enable(). + * + * After emitting a PWM signal for the desired length of time, drivers + * may then pwm_channel_disable() or pwm_channel_free(). Both of these + * disable the channel, but when it's freed the IRQ is deconfigured and + * the channel must later be re-allocated and reconfigured. + * + * Note that if the period or duty cycle need to be changed while the + * PWM channel is operating, drivers must use the PWM_CUPD double buffer + * mechanism, either polling until they change or getting implicitly + * notified through a once-per-period interrupt handler. + */ +struct pwm_channel { + void __iomem *regs; + unsigned index; + unsigned long mck; +}; + +extern int pwm_channel_alloc(int index, struct pwm_channel *ch); +extern int pwm_channel_free(struct pwm_channel *ch); + +extern int pwm_clk_alloc(unsigned prescale, unsigned div); +extern void pwm_clk_free(unsigned clk); + +extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled); + +#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1) +#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0) + +/* periodic interrupts, mostly for CUPD changes to period or cycle */ +extern int pwm_channel_handler(struct pwm_channel *ch, + void (*handler)(struct pwm_channel *ch)); + +/* per-channel registers (banked at pwm_channel->regs) */ +#define PWM_CMR 0x00 /* mode register */ +#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */ +#define PWM_CPR_CPOL (1 << 9) /* set: idle high */ +#define PWM_CPR_CALG (1 << 8) /* set: center align */ +#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */ +#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */ +#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */ +#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */ +#define PWM_CPRD 0x08 /* period (count up from zero) */ +#define PWM_CCNT 0x0c /* counter (20 bits?) */ +#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */ + +static inline void +pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val) +{ + __raw_writel(val, pwmc->regs + offset); +} + +static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset) +{ + return __raw_readl(pwmc->regs + offset); +} + +#endif /* __LINUX_ATMEL_PWM_H */ diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h index 3dc715b0250..d3771551fdd 100644 --- a/include/linux/byteorder/generic.h +++ b/include/linux/byteorder/generic.h @@ -146,6 +146,36 @@ #define htons(x) ___htons(x) #define ntohs(x) ___ntohs(x) +static inline void le16_add_cpu(__le16 *var, u16 val) +{ + *var = cpu_to_le16(le16_to_cpu(*var) + val); +} + +static inline void le32_add_cpu(__le32 *var, u32 val) +{ + *var = cpu_to_le32(le32_to_cpu(*var) + val); +} + +static inline void le64_add_cpu(__le64 *var, u64 val) +{ + *var = cpu_to_le64(le64_to_cpu(*var) + val); +} + +static inline void be16_add_cpu(__be16 *var, u16 val) +{ + *var = cpu_to_be16(be16_to_cpu(*var) + val); +} + +static inline void be32_add_cpu(__be32 *var, u32 val) +{ + *var = cpu_to_be32(be32_to_cpu(*var) + val); +} + +static inline void be64_add_cpu(__be64 *var, u64 val) +{ + *var = cpu_to_be64(be64_to_cpu(*var) + val); +} + #endif /* KERNEL */ #endif /* _LINUX_BYTEORDER_GENERIC_H */ diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index ecae585ec3d..f8c9a2752f0 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -57,7 +57,9 @@ extern int cpuset_memory_pressure_enabled; extern void __cpuset_memory_pressure_bump(void); extern const struct file_operations proc_cpuset_operations; -extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); +struct seq_file; +extern void cpuset_task_status_allowed(struct seq_file *m, + struct task_struct *task); extern void cpuset_lock(void); extern void cpuset_unlock(void); @@ -126,10 +128,9 @@ static inline int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, static inline void cpuset_memory_pressure_bump(void) {} -static inline char *cpuset_task_status_allowed(struct task_struct *task, - char *buffer) +static inline void cpuset_task_status_allowed(struct seq_file *m, + struct task_struct *task) { - return buffer; } static inline void cpuset_lock(void) {} diff --git a/include/linux/dmar.h b/include/linux/dmar.h index ffb6439cb5e..56c73b84755 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h @@ -28,7 +28,7 @@ #ifdef CONFIG_DMAR struct intel_iommu; -extern char *dmar_get_fault_reason(u8 fault_reason); +extern const char *dmar_get_fault_reason(u8 fault_reason); /* Can't use the common MSI interrupt functions * since DMAR is not a pci device diff --git a/include/linux/dmi.h b/include/linux/dmi.h index bbc9992ec37..325acdf5c46 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h @@ -35,8 +35,11 @@ enum dmi_device_type { DMI_DEV_TYPE_ETHERNET, DMI_DEV_TYPE_TOKENRING, DMI_DEV_TYPE_SOUND, + DMI_DEV_TYPE_PATA, + DMI_DEV_TYPE_SATA, + DMI_DEV_TYPE_SAS, DMI_DEV_TYPE_IPMI = -1, - DMI_DEV_TYPE_OEM_STRING = -2 + DMI_DEV_TYPE_OEM_STRING = -2, }; struct dmi_header { diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h index 5834e843a94..18bea78fe47 100644 --- a/include/linux/elf-em.h +++ b/include/linux/elf-em.h @@ -31,6 +31,7 @@ #define EM_V850 87 /* NEC v850 */ #define EM_M32R 88 /* Renesas M32R */ #define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ +#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ #define EM_BLACKFIN 106 /* ADI Blackfin Processor */ #define EM_FRV 0x5441 /* Fujitsu FR-V */ #define EM_AVR32 0x18ad /* Atmel AVR32 */ @@ -47,6 +48,8 @@ #define EM_CYGNUS_M32R 0x9041 /* This is the old interim value for S/390 architecture */ #define EM_S390_OLD 0xA390 +/* Also Panasonic/MEI MN10300, AM33 */ +#define EM_CYGNUS_MN10300 0xbeef #endif /* _LINUX_ELF_EM_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 36b7abefacb..18cfbf76ec5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1038,6 +1038,12 @@ struct super_block { * in /proc/mounts will be "type.subtype" */ char *s_subtype; + + /* + * Saved mount options for lazy filesystems using + * generic_show_options() + */ + char *s_options; }; extern struct timespec current_fs_time(struct super_block *sb); @@ -1618,7 +1624,6 @@ extern int register_chrdev(unsigned int, const char *, const struct file_operations *); extern void unregister_chrdev(unsigned int, const char *); extern void unregister_chrdev_region(dev_t, unsigned); -extern int chrdev_open(struct inode *, struct file *); extern void chrdev_show(struct seq_file *,off_t); /* fs/block_dev.c */ @@ -1807,9 +1812,6 @@ extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, unsigned long, loff_t, loff_t *, size_t, ssize_t); extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); -extern void do_generic_mapping_read(struct address_space *mapping, - struct file_ra_state *, struct file *, - loff_t *, read_descriptor_t *, read_actor_t); extern int generic_segment_checks(const struct iovec *iov, unsigned long *nr_segs, size_t *count, int access_flags); @@ -1847,18 +1849,6 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from) } #endif -static inline void do_generic_file_read(struct file * filp, loff_t *ppos, - read_descriptor_t * desc, - read_actor_t actor) -{ - do_generic_mapping_read(filp->f_mapping, - &filp->f_ra, - filp, - ppos, - desc, - actor); -} - #ifdef CONFIG_BLOCK ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 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 *); extern void file_update_time(struct file *file); +extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); +extern void save_mount_options(struct super_block *sb, char *options); + static inline ino_t parent_ino(struct dentry *dentry) { ino_t res; @@ -2056,7 +2049,7 @@ static int __fops ## _open(struct inode *inode, struct file *file) \ static struct file_operations __fops = { \ .owner = THIS_MODULE, \ .open = __fops ## _open, \ - .release = simple_attr_close, \ + .release = simple_attr_release, \ .read = simple_attr_read, \ .write = simple_attr_write, \ }; @@ -2068,9 +2061,9 @@ __simple_attr_check_format(const char *fmt, ...) } int simple_attr_open(struct inode *inode, struct file *file, - u64 (*get)(void *), void (*set)(void *, u64), + int (*get)(void *, u64 *), int (*set)(void *, u64), const char *fmt); -int simple_attr_close(struct inode *inode, struct file *file); +int simple_attr_release(struct inode *inode, struct file *file); ssize_t simple_attr_read(struct file *file, char __user *buf, size_t len, loff_t *ppos); ssize_t simple_attr_write(struct file *file, const char __user *buf, diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 203591e2321..600fc3bcf63 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -78,7 +78,7 @@ enum hrtimer_cb_mode { * as otherwise the timer could be removed before the softirq code finishes the * the handling of the timer. * - * The HRTIMER_STATE_ENQUEUE bit is always or'ed to the current state to + * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state to * preserve the HRTIMER_STATE_CALLBACK bit in the above scenario. * * All state transitions are protected by cpu_base->lock. diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 30d606afcaf..7ca198b379a 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) } int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); +int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); int 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 408696ea518..b8826107b51 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h @@ -100,58 +100,6 @@ struct kern_ipc_perm void *security; }; -struct ipc_ids; -struct ipc_namespace { - struct kref kref; - struct ipc_ids *ids[3]; - - int sem_ctls[4]; - int used_sems; - - int msg_ctlmax; - int msg_ctlmnb; - int msg_ctlmni; - atomic_t msg_bytes; - atomic_t msg_hdrs; - - size_t shm_ctlmax; - size_t shm_ctlall; - int shm_ctlmni; - int shm_tot; -}; - -extern struct ipc_namespace init_ipc_ns; - -#ifdef CONFIG_SYSVIPC -#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, -extern void free_ipc_ns(struct kref *kref); -extern struct ipc_namespace *copy_ipcs(unsigned long flags, - struct ipc_namespace *ns); -#else -#define INIT_IPC_NS(ns) -static inline struct ipc_namespace *copy_ipcs(unsigned long flags, - struct ipc_namespace *ns) -{ - return ns; -} -#endif - -static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) -{ -#ifdef CONFIG_SYSVIPC - if (ns) - kref_get(&ns->kref); -#endif - return ns; -} - -static inline void put_ipc_ns(struct ipc_namespace *ns) -{ -#ifdef CONFIG_SYSVIPC - kref_put(&ns->kref, free_ipc_ns); -#endif -} - #endif /* __KERNEL__ */ #endif /* _LINUX_IPC_H */ diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h new file mode 100644 index 00000000000..e4451d1da75 --- /dev/null +++ b/include/linux/ipc_namespace.h @@ -0,0 +1,81 @@ +#ifndef __IPC_NAMESPACE_H__ +#define __IPC_NAMESPACE_H__ + +#include <linux/err.h> +#include <linux/idr.h> +#include <linux/rwsem.h> + +struct ipc_ids { + int in_use; + unsigned short seq; + unsigned short seq_max; + struct rw_semaphore rw_mutex; + struct idr ipcs_idr; +}; + +struct ipc_namespace { + struct kref kref; + struct ipc_ids ids[3]; + + int sem_ctls[4]; + int used_sems; + + int msg_ctlmax; + int msg_ctlmnb; + int msg_ctlmni; + atomic_t msg_bytes; + atomic_t msg_hdrs; + + size_t shm_ctlmax; + size_t shm_ctlall; + int shm_ctlmni; + int shm_tot; +}; + +extern struct ipc_namespace init_ipc_ns; + +#ifdef CONFIG_SYSVIPC +#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, +#else +#define INIT_IPC_NS(ns) +#endif + +#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) +extern void free_ipc_ns(struct kref *kref); +extern struct ipc_namespace *copy_ipcs(unsigned long flags, + struct ipc_namespace *ns); +extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, + void (*free)(struct ipc_namespace *, + struct kern_ipc_perm *)); + +static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) +{ + if (ns) + kref_get(&ns->kref); + return ns; +} + +static inline void put_ipc_ns(struct ipc_namespace *ns) +{ + kref_put(&ns->kref, free_ipc_ns); +} +#else +static inline struct ipc_namespace *copy_ipcs(unsigned long flags, + struct ipc_namespace *ns) +{ + if (flags & CLONE_NEWIPC) + return ERR_PTR(-EINVAL); + + return ns; +} + +static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) +{ + return ns; +} + +static inline void put_ipc_ns(struct ipc_namespace *ns) +{ +} +#endif +#endif diff --git a/include/linux/irq.h b/include/linux/irq.h index 4669be08061..bfd9efb5cb4 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -25,7 +25,7 @@ #include <asm/irq_regs.h> struct irq_desc; -typedef void fastcall (*irq_flow_handler_t)(unsigned int irq, +typedef void (*irq_flow_handler_t)(unsigned int irq, struct irq_desc *desc); @@ -276,19 +276,19 @@ extern int handle_IRQ_event(unsigned int irq, struct irqaction *action); * Built-in IRQ handlers for various IRQ types, * callable via desc->chip->handle_irq() */ -extern void fastcall handle_level_irq(unsigned int irq, struct irq_desc *desc); -extern void fastcall handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); -extern void fastcall handle_edge_irq(unsigned int irq, struct irq_desc *desc); -extern void fastcall handle_simple_irq(unsigned int irq, struct irq_desc *desc); -extern void fastcall handle_percpu_irq(unsigned int irq, struct irq_desc *desc); -extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc); +extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); +extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); +extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc); +extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc); +extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc); +extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); /* * Monolithic do_IRQ implementation. * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) */ #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ -extern fastcall unsigned int __do_IRQ(unsigned int irq); +extern unsigned int __do_IRQ(unsigned int irq); #endif /* @@ -367,6 +367,9 @@ set_irq_chained_handler(unsigned int irq, __set_irq_handler(irq, handle, 1, NULL); } +extern void set_irq_noprobe(unsigned int irq); +extern void set_irq_probe(unsigned int irq); + /* Handle dynamic irq creation and destruction */ extern int create_irq(void); extern void destroy_irq(unsigned int irq); diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 7ba9e47bf06..e0b5b684d83 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -42,7 +42,7 @@ /* LATCH is used in the interval timer and ftape setup. */ #define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ -/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can +/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, then we can * improve accuracy by shifting LSH bits, hence calculating: * (NOM << LSH) / DEN * This however means trouble for large NOM, because (NOM << LSH) may no @@ -160,7 +160,7 @@ extern unsigned long preset_lpj; * We want to do realistic conversions of time so we need to use the same * values the update wall clock code uses as the jiffies size. This value * is: TICK_NSEC (which is defined in timex.h). This - * is a constant and is in nanoseconds. We will used scaled math + * is a constant and is in nanoseconds. We will use scaled math * with a set of scales defined here as SEC_JIFFIE_SC, USEC_JIFFIE_SC and * NSEC_JIFFIE_SC. Note that these defines contain nothing but * constants and so are computed at compile time. SHIFT_HZ (computed in @@ -204,7 +204,7 @@ extern unsigned long preset_lpj; * operator if the result is a long long AND at least one of the * operands is cast to long long (usually just prior to the "*" so as * not to confuse it into thinking it really has a 64-bit operand, - * which, buy the way, it can do, but it take more code and at least 2 + * which, buy the way, it can do, but it takes more code and at least 2 * mpys). * 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 9e01f376840..2df44e77327 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -133,7 +133,7 @@ NORET_TYPE void panic(const char * fmt, ...) extern void oops_enter(void); extern void oops_exit(void); extern int oops_may_print(void); -fastcall NORET_TYPE void do_exit(long error_code) +NORET_TYPE void do_exit(long error_code) ATTRIB_NORET; NORET_TYPE void complete_and_exit(struct completion *, long) ATTRIB_NORET; @@ -141,6 +141,10 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int); extern long simple_strtol(const char *,char **,unsigned int); extern unsigned long long simple_strtoull(const char *,char **,unsigned int); extern long long simple_strtoll(const char *,char **,unsigned int); +extern int strict_strtoul(const char *, unsigned int, unsigned long *); +extern int strict_strtol(const char *, unsigned int, long *); +extern int strict_strtoull(const char *, unsigned int, unsigned long long *); +extern int strict_strtoll(const char *, unsigned int, long long *); extern int sprintf(char * buf, const char * fmt, ...) __attribute__ ((format (printf, 2, 3))); extern int vsprintf(char *buf, const char *, va_list) @@ -172,8 +176,6 @@ extern int kernel_text_address(unsigned long addr); struct pid; extern struct pid *session_of_pgrp(struct pid *pgrp); -extern void dump_thread(struct pt_regs *regs, struct user *dump); - #ifdef CONFIG_PRINTK asmlinkage int vprintk(const char *fmt, va_list args) __attribute__ ((format (printf, 1, 0))); @@ -182,6 +184,13 @@ asmlinkage int printk(const char * fmt, ...) extern int log_buf_get_len(void); extern int log_buf_read(int idx); extern int log_buf_copy(char *dest, int idx, int len); + +extern int printk_ratelimit_jiffies; +extern int printk_ratelimit_burst; +extern int printk_ratelimit(void); +extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); +extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, + unsigned int interval_msec); #else static inline int vprintk(const char *s, va_list args) __attribute__ ((format (printf, 1, 0))); @@ -192,6 +201,12 @@ static inline int __cold printk(const char *s, ...) { return 0; } static inline int log_buf_get_len(void) { return 0; } static inline int log_buf_read(int idx) { return 0; } static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } +static inline int printk_ratelimit(void) { return 0; } +static inline int __printk_ratelimit(int ratelimit_jiffies, \ + int ratelimit_burst) { return 0; } +static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ + unsigned int interval_msec) \ + { return false; } #endif extern void __attribute__((format(printf, 1, 2))) @@ -199,11 +214,6 @@ extern void __attribute__((format(printf, 1, 2))) unsigned long int_sqrt(unsigned long); -extern int printk_ratelimit(void); -extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); -extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, - unsigned int interval_msec); - static inline void console_silent(void) { console_loglevel = 0; @@ -224,6 +234,7 @@ extern int panic_on_unrecovered_nmi; extern int tainted; extern const char *print_tainted(void); extern void add_taint(unsigned); +extern int root_mountflags; /* Values used for system_state */ extern enum system_states { diff --git a/include/linux/mm.h b/include/linux/mm.h index 89d7c691b93..e8abb381420 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 #define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ +static inline void pgtable_page_ctor(struct page *page) +{ + pte_lock_init(page); + inc_zone_page_state(page, NR_PAGETABLE); +} + +static inline void pgtable_page_dtor(struct page *page) +{ + pte_lock_deinit(page); + dec_zone_page_state(page, NR_PAGETABLE); +} + #define pte_offset_map_lock(mm, pmd, address, ptlp) \ ({ \ spinlock_t *__ptl = pte_lockptr(mm, pmd); \ @@ -1136,7 +1148,7 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address, #define FOLL_GET 0x04 /* do get_page on page */ #define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ -typedef int (*pte_fn_t)(pte_t *pte, struct page *pmd_page, unsigned long addr, +typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, void *data); extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, unsigned long size, pte_fn_t fn, void *data); diff --git a/include/linux/module.h b/include/linux/module.h index ac481e2094f..ac28e8761e8 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -449,7 +449,7 @@ static inline void __module_get(struct module *module) /* For kallsyms to ask for address resolution. namebuf should be at * least KSYM_NAME_LEN long: a pointer to namebuf is returned if * found, otherwise NULL. */ -char *module_address_lookup(unsigned long addr, +const char *module_address_lookup(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char **modname, @@ -519,7 +519,7 @@ static inline void module_put(struct module *module) #define module_name(mod) "kernel" /* For kallsyms to ask for address resolution. NULL means not found. */ -static inline char *module_address_lookup(unsigned long addr, +static inline const char *module_address_lookup(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char **modname, diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 05c590352dd..bc6da10ceee 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, * * Returns 1 if the mutex is locked, 0 if unlocked. */ -static inline int fastcall mutex_is_locked(struct mutex *lock) +static inline int mutex_is_locked(struct mutex *lock) { return atomic_read(&lock->count) != 1; } @@ -132,9 +132,9 @@ extern int __must_check mutex_lock_killable_nested(struct mutex *lock, #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) #define mutex_lock_killable(lock) mutex_lock_killable_nested(lock, 0) #else -extern void fastcall mutex_lock(struct mutex *lock); -extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock); -extern int __must_check fastcall mutex_lock_killable(struct mutex *lock); +extern void mutex_lock(struct mutex *lock); +extern int __must_check mutex_lock_interruptible(struct mutex *lock); +extern int __must_check mutex_lock_killable(struct mutex *lock); # define mutex_lock_nested(lock, subclass) mutex_lock(lock) # 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); * NOTE: mutex_trylock() follows the spin_trylock() convention, * not the down_trylock() convention! */ -extern int fastcall mutex_trylock(struct mutex *lock); -extern void fastcall mutex_unlock(struct mutex *lock); +extern int mutex_trylock(struct mutex *lock); +extern void mutex_unlock(struct mutex *lock); #endif diff --git a/include/linux/nbd.h b/include/linux/nbd.h index cc2b47240a8..986572081e1 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h @@ -35,7 +35,6 @@ enum { }; #define nbd_cmd(req) ((req)->cmd[0]) -#define MAX_NBD 128 /* userspace doesn't need the nbd_device structure */ #ifdef __KERNEL__ diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index 6db69ff5d83..700725ddcaa 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h @@ -298,6 +298,7 @@ struct sadb_x_sec_ctx { #define SADB_X_EALG_BLOWFISHCBC 7 #define SADB_EALG_NULL 11 #define SADB_X_EALG_AESCBC 12 +#define SADB_X_EALG_AESCTR 13 #define SADB_X_EALG_AES_CCM_ICV8 14 #define SADB_X_EALG_AES_CCM_ICV12 15 #define SADB_X_EALG_AES_CCM_ICV16 16 diff --git a/include/linux/pid.h b/include/linux/pid.h index e29a900a849..f84d532b5d2 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -118,18 +118,17 @@ extern struct pid *find_pid(int nr); */ extern struct pid *find_get_pid(int nr); extern struct pid *find_ge_pid(int nr, struct pid_namespace *); +int next_pidmap(struct pid_namespace *pid_ns, int last); extern struct pid *alloc_pid(struct pid_namespace *ns); extern void FASTCALL(free_pid(struct pid *pid)); -extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); /* * the helpers to get the pid's id seen from different namespaces * * pid_nr() : global id, i.e. the id seen from the init namespace; - * pid_vnr() : virtual id, i.e. the id seen from the namespace this pid - * belongs to. this only makes sence when called in the - * context of the task that belongs to the same namespace; + * pid_vnr() : virtual id, i.e. the id seen from the pid namespace of + * current. * pid_nr_ns() : id seen from the ns specified. * * see also task_xid_nr() etc in include/linux/sched.h @@ -144,14 +143,7 @@ static inline pid_t pid_nr(struct pid *pid) } pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns); - -static inline pid_t pid_vnr(struct pid *pid) -{ - pid_t nr = 0; - if (pid) - nr = pid->numbers[pid->level].nr; - return nr; -} +pid_t pid_vnr(struct pid *pid); #define do_each_pid_task(pid, type, task) \ do { \ @@ -160,7 +152,13 @@ static inline pid_t pid_vnr(struct pid *pid) hlist_for_each_entry_rcu((task), pos___, \ &pid->tasks[type], pids[type].node) { + /* + * Both old and new leaders may be attached to + * the same pid in the middle of de_thread(). + */ #define while_each_pid_task(pid, type, task) \ + if (type == PIDTYPE_PID) \ + break; \ } \ } while (0) diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 1689e28483e..fcd61fa2c83 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) extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); extern void free_pid_ns(struct kref *kref); +extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); static inline void put_pid_ns(struct pid_namespace *ns) { @@ -66,6 +67,11 @@ static inline void put_pid_ns(struct pid_namespace *ns) { } + +static inline void zap_pid_ns_processes(struct pid_namespace *ns) +{ + BUG(); +} #endif /* CONFIG_PID_NS */ static 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 484988ed301..23f0c54175c 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -11,8 +11,8 @@ #include <linux/list.h> #ifdef CONFIG_DEBUG_PREEMPT - extern void fastcall add_preempt_count(int val); - extern void fastcall sub_preempt_count(int val); + extern void add_preempt_count(int val); + extern void sub_preempt_count(int val); #else # define add_preempt_count(val) do { preempt_count() += (val); } while (0) # 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 e4355151683..d6a4f69bdc9 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 int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); unsigned long task_vsize(struct mm_struct *); int task_statm(struct mm_struct *, int *, int *, int *, int *); -char *task_mem(struct mm_struct *, char *); +void task_mem(struct seq_file *, struct mm_struct *); +void clear_refs_smap(struct mm_struct *mm); struct proc_dir_entry *de_get(struct proc_dir_entry *de); void de_put(struct proc_dir_entry *de); extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent); +struct proc_dir_entry *proc_create(const char *name, mode_t mode, + struct proc_dir_entry *parent, + const struct file_operations *proc_fops); extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); extern struct vfsmount *proc_mnt; @@ -219,7 +223,12 @@ static inline void proc_flush_task(struct task_struct *task) static inline struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent) { return NULL; } - +static inline struct proc_dir_entry *proc_create(const char *name, + mode_t mode, struct proc_dir_entry *parent, + const struct file_operations *proc_fops) +{ + return NULL; +} #define remove_proc_entry(name, parent) do {} while (0) static inline struct proc_dir_entry *proc_symlink(const char *name, @@ -262,6 +271,9 @@ extern void kclist_add(struct kcore_list *, void *, size_t); union proc_op { int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); int (*proc_read)(struct task_struct *task, char *page); + int (*proc_show)(struct seq_file *m, + struct pid_namespace *ns, struct pid *pid, + struct task_struct *task); }; struct proc_inode { diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 6ab80714a91..ebe0c17039c 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -67,7 +67,6 @@ #define PT_TRACE_EXEC 0x00000080 #define PT_TRACE_VFORK_DONE 0x00000100 #define PT_TRACE_EXIT 0x00000200 -#define PT_ATTACHED 0x00000400 /* parent != real_parent */ #define PT_TRACE_MASK 0x000003f4 diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index ece8eb3e415..60c2a033b19 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h @@ -46,8 +46,8 @@ #define rcu_bh_qsctr_inc(cpu) #define call_rcu_bh(head, rcu) call_rcu(head, rcu) -extern void __rcu_read_lock(void); -extern void __rcu_read_unlock(void); +extern void __rcu_read_lock(void) __acquires(RCU); +extern void __rcu_read_unlock(void) __releases(RCU); extern int rcu_pending(int cpu); extern int rcu_needs_cpu(int cpu); diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 422eab4958a..8e7eff2cd0a 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) /* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16 * which overflows on large file systems. */ -static inline u32 reiserfs_bmap_count(struct super_block *sb) +static inline __u32 reiserfs_bmap_count(struct super_block *sb) { return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1; } diff --git a/include/linux/sched.h b/include/linux/sched.h index 8a4812c1c03..00e14411732 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -460,7 +460,7 @@ struct signal_struct { /* ITIMER_REAL timer for the process */ struct hrtimer real_timer; - struct task_struct *tsk; + struct pid *leader_pid; ktime_t it_real_incr; /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ @@ -1332,9 +1332,8 @@ struct pid_namespace; * from various namespaces * * task_xid_nr() : global id, i.e. the id seen from the init namespace; - * task_xid_vnr() : virtual id, i.e. the id seen from the namespace the task - * belongs to. this only makes sence when called in the - * context of the task that belongs to the same namespace; + * task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of + * current. * task_xid_nr_ns() : id seen from the ns specified; * * 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); extern struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns); -extern void __set_special_pids(pid_t session, pid_t pgrp); +extern void __set_special_pids(struct pid *pid); /* per-UID process charging. */ extern 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, extern void unblock_all_signals(void); extern void release_task(struct task_struct * p); extern int send_sig_info(int, struct siginfo *, struct task_struct *); -extern int send_group_sig_info(int, struct siginfo *, struct task_struct *); extern int force_sigsegv(int, struct task_struct *); extern int force_sig_info(int, struct siginfo *, struct task_struct *); extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); -extern int kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32); extern 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 9963f81fea9..1a0b6cf83ff 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -150,6 +150,10 @@ #define PORT_MCF 78 +/* MN10300 on-chip UART numbers */ +#define PORT_MN10300 80 +#define PORT_MN10300_CTS 81 + #ifdef __KERNEL__ #include <linux/compiler.h> diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index f3c51899117..8d5fb36ea04 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -30,9 +30,12 @@ struct shmem_sb_info { unsigned long free_blocks; /* How many are left for allocation */ unsigned long max_inodes; /* How many inodes are allowed */ unsigned long free_inodes; /* How many are left for allocation */ + spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ + uid_t uid; /* Mount uid for root directory */ + gid_t gid; /* Mount gid for root directory */ + mode_t mode; /* Mount mode for root directory */ int policy; /* Default NUMA memory alloc policy */ nodemask_t policy_nodes; /* nodemask for preferred and bind */ - spinlock_t stat_lock; }; static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) diff --git a/include/linux/signal.h b/include/linux/signal.h index 7e095147656..42d2e0a948f 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -241,6 +241,7 @@ extern int show_unhandled_signals; struct pt_regs; extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); +extern void exit_signals(struct task_struct *tsk); extern struct kmem_cache *sighand_cachep; diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 124449733c5..576a5f77d3b 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -71,7 +71,7 @@ #define LOCK_SECTION_END \ ".previous\n\t" -#define __lockfunc fastcall __attribute__((section(".spinlock.text"))) +#define __lockfunc __attribute__((section(".spinlock.text"))) /* * Pull the raw_spinlock_t and raw_rwlock_t definitions: diff --git a/include/linux/time.h b/include/linux/time.h index ceaab9fff15..2091a19f165 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -120,7 +120,7 @@ extern void getboottime(struct timespec *ts); extern void monotonic_to_bootbased(struct timespec *ts); extern struct timespec timespec_trunc(struct timespec t, unsigned gran); -extern int timekeeping_is_continuous(void); +extern int timekeeping_valid_for_hres(void); extern void update_wall_time(void); extern void update_xtime_cache(u64 nsec); diff --git a/include/linux/timer.h b/include/linux/timer.h index de0e71359ed..979fefdeb86 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -35,8 +35,8 @@ extern struct tvec_base boot_tvec_bases; struct timer_list _name = \ TIMER_INITIALIZER(_function, _expires, _data) -void fastcall init_timer(struct timer_list * timer); -void fastcall init_timer_deferrable(struct timer_list *timer); +void init_timer(struct timer_list *timer); +void init_timer_deferrable(struct timer_list *timer); static inline void setup_timer(struct timer_list * timer, void (*function)(unsigned long), @@ -124,8 +124,6 @@ static inline void timer_stats_timer_clear_start_info(struct timer_list *timer) } #endif -extern void delayed_work_timer_fn(unsigned long __data); - /** * add_timer - start a timer * @timer: the timer to be added diff --git a/include/linux/types.h b/include/linux/types.h index b94c0e4efe2..9dc2346627b 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -53,7 +53,7 @@ typedef __kernel_uid_t uid_t; typedef __kernel_gid_t gid_t; #endif /* __KERNEL__ */ -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#if defined(__GNUC__) typedef __kernel_loff_t loff_t; #endif @@ -119,7 +119,7 @@ typedef __u8 uint8_t; typedef __u16 uint16_t; typedef __u32 uint32_t; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#if defined(__GNUC__) typedef __u64 uint64_t; typedef __u64 u_int64_t; typedef __s64 int64_t; @@ -181,7 +181,7 @@ typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; typedef __u32 __bitwise __be32; -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#if defined(__GNUC__) typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; #endif diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h index 36c684e1b11..aa88654eb76 100644 --- a/include/linux/udf_fs.h +++ b/include/linux/udf_fs.h @@ -32,18 +32,15 @@ #define UDF_PREALLOCATE #define UDF_DEFAULT_PREALLOC_BLOCKS 8 -#define UDFFS_DATE "2004/29/09" -#define UDFFS_VERSION "0.9.8.1" - #undef UDFFS_DEBUG #ifdef UDFFS_DEBUG #define udf_debug(f, a...) \ - { \ + do { \ printk (KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \ __FILE__, __LINE__, __FUNCTION__); \ printk (f, ##a); \ - } + } while (0) #else #define udf_debug(f, a...) /**/ #endif diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h index 80ae9ef940d..9bc47352b6b 100644 --- a/include/linux/udf_fs_sb.h +++ b/include/linux/udf_fs_sb.h @@ -75,7 +75,7 @@ struct udf_part_map struct udf_sb_info { struct udf_part_map *s_partmaps; - __u8 s_volident[32]; + __u8 s_volume_ident[32]; /* Overall info */ __u16 s_partitions; @@ -84,9 +84,9 @@ struct udf_sb_info /* Sector headers */ __s32 s_session; __u32 s_anchor[4]; - __u32 s_lastblock; + __u32 s_last_block; - struct buffer_head *s_lvidbh; + struct buffer_head *s_lvid_bh; /* Default permissions */ mode_t s_umask; @@ -94,10 +94,10 @@ struct udf_sb_info uid_t s_uid; /* Root Info */ - struct timespec s_recordtime; + struct timespec s_record_time; /* Fileset Info */ - __u16 s_serialnum; + __u16 s_serial_number; /* highest UDF revision we have recorded to this media */ __u16 s_udfrev; @@ -109,7 +109,7 @@ struct udf_sb_info struct nls_table *s_nls_map; /* VAT inode */ - struct inode *s_vat; + struct inode *s_vat_inode; struct mutex s_alloc_mutex; }; diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h deleted file mode 100644 index 10b854d3561..00000000000 --- a/include/linux/ufs_fs.h +++ /dev/null @@ -1,953 +0,0 @@ -/* - * linux/include/linux/ufs_fs.h - * - * Copyright (C) 1996 - * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu) - * Laboratory for Computer Science Research Computing Facility - * Rutgers, The State University of New Jersey - * - * Clean swab support by Fare <fare@tunes.org> - * just hope no one is using NNUUXXI on __?64 structure elements - * 64-bit clean thanks to Maciej W. Rozycki <macro@ds2.pg.gda.pl> - * - * 4.4BSD (FreeBSD) support added on February 1st 1998 by - * Niels Kristian Bech Jensen <nkbj@image.dk> partially based - * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>. - * - * NeXTstep support added on February 5th 1998 by - * Niels Kristian Bech Jensen <nkbj@image.dk>. - * - * Write support by Daniel Pirkl <daniel.pirkl@email.cz> - * - * HP/UX hfs filesystem support added by - * Martin K. Petersen <mkp@mkp.net>, August 1999 - * - * UFS2 (of FreeBSD 5.x) support added by - * Niraj Kumar <niraj17@iitbombay.org> , Jan 2004 - * - */ - -#ifndef __LINUX_UFS_FS_H -#define __LINUX_UFS_FS_H - -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/stat.h> -#include <linux/fs.h> - -#ifndef __KERNEL__ -typedef __u64 __fs64; -typedef __u32 __fs32; -typedef __u16 __fs16; -#else -#include <asm/div64.h> -typedef __u64 __bitwise __fs64; -typedef __u32 __bitwise __fs32; -typedef __u16 __bitwise __fs16; -#endif - -#define UFS_BBLOCK 0 -#define UFS_BBSIZE 8192 -#define UFS_SBLOCK 8192 -#define UFS_SBSIZE 8192 - -#define UFS_SECTOR_SIZE 512 -#define UFS_SECTOR_BITS 9 -#define UFS_MAGIC 0x00011954 -#define UFS2_MAGIC 0x19540119 -#define UFS_CIGAM 0x54190100 /* byteswapped MAGIC */ - -/* Copied from FreeBSD */ -/* - * Each disk drive contains some number of filesystems. - * A filesystem consists of a number of cylinder groups. - * Each cylinder group has inodes and data. - * - * A filesystem is described by its super-block, which in turn - * describes the cylinder groups. The super-block is critical - * data and is replicated in each cylinder group to protect against - * catastrophic loss. This is done at `newfs' time and the critical - * super-block data does not change, so the copies need not be - * referenced further unless disaster strikes. - * - * For filesystem fs, the offsets of the various blocks of interest - * are given in the super block as: - * [fs->fs_sblkno] Super-block - * [fs->fs_cblkno] Cylinder group block - * [fs->fs_iblkno] Inode blocks - * [fs->fs_dblkno] Data blocks - * The beginning of cylinder group cg in fs, is given by - * the ``cgbase(fs, cg)'' macro. - * - * Depending on the architecture and the media, the superblock may - * reside in any one of four places. For tiny media where every block - * counts, it is placed at the very front of the partition. Historically, - * UFS1 placed it 8K from the front to leave room for the disk label and - * a small bootstrap. For UFS2 it got moved to 64K from the front to leave - * room for the disk label and a bigger bootstrap, and for really piggy - * systems we check at 256K from the front if the first three fail. In - * all cases the size of the superblock will be SBLOCKSIZE. All values are - * given in byte-offset form, so they do not imply a sector size. The - * SBLOCKSEARCH specifies the order in which the locations should be searched. - */ -#define SBLOCK_FLOPPY 0 -#define SBLOCK_UFS1 8192 -#define SBLOCK_UFS2 65536 -#define SBLOCK_PIGGY 262144 -#define SBLOCKSIZE 8192 -#define SBLOCKSEARCH \ - { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 } - - -/* HP specific MAGIC values */ - -#define UFS_MAGIC_LFN 0x00095014 /* fs supports filenames > 14 chars */ -#define UFS_CIGAM_LFN 0x14500900 /* srahc 41 < semanelif stroppus sf */ - -#define UFS_MAGIC_SEC 0x00612195 /* B1 security fs */ -#define UFS_CIGAM_SEC 0x95216100 - -#define UFS_MAGIC_FEA 0x00195612 /* fs_featurebits supported */ -#define UFS_CIGAM_FEA 0x12561900 - -#define UFS_MAGIC_4GB 0x05231994 /* fs > 4 GB && fs_featurebits */ -#define UFS_CIGAM_4GB 0x94192305 - -/* Seems somebody at HP goofed here. B1 and lfs are both 0x2 !?! */ -#define UFS_FSF_LFN 0x00000001 /* long file names */ -#define UFS_FSF_B1 0x00000002 /* B1 security */ -#define UFS_FSF_LFS 0x00000002 /* large files */ -#define UFS_FSF_LUID 0x00000004 /* large UIDs */ - -/* End of HP stuff */ - - -#define UFS_BSIZE 8192 -#define UFS_MINBSIZE 4096 -#define UFS_FSIZE 1024 -#define UFS_MAXFRAG (UFS_BSIZE / UFS_FSIZE) - -#define UFS_NDADDR 12 -#define UFS_NINDIR 3 - -#define UFS_IND_BLOCK (UFS_NDADDR + 0) -#define UFS_DIND_BLOCK (UFS_NDADDR + 1) -#define UFS_TIND_BLOCK (UFS_NDADDR + 2) - -#define UFS_NDIR_FRAGMENT (UFS_NDADDR << uspi->s_fpbshift) -#define UFS_IND_FRAGMENT (UFS_IND_BLOCK << uspi->s_fpbshift) -#define UFS_DIND_FRAGMENT (UFS_DIND_BLOCK << uspi->s_fpbshift) -#define UFS_TIND_FRAGMENT (UFS_TIND_BLOCK << uspi->s_fpbshift) - -#define UFS_ROOTINO 2 -#define UFS_FIRST_INO (UFS_ROOTINO + 1) - -#define UFS_USEEFT ((__u16)65535) - -#define UFS_FSOK 0x7c269d38 -#define UFS_FSACTIVE ((__s8)0x00) -#define UFS_FSCLEAN ((__s8)0x01) -#define UFS_FSSTABLE ((__s8)0x02) -#define UFS_FSOSF1 ((__s8)0x03) /* is this correct for DEC OSF/1? */ -#define UFS_FSBAD ((__s8)0xff) - -/* From here to next blank line, s_flags for ufs_sb_info */ -/* directory entry encoding */ -#define UFS_DE_MASK 0x00000010 /* mask for the following */ -#define UFS_DE_OLD 0x00000000 -#define UFS_DE_44BSD 0x00000010 -/* uid encoding */ -#define UFS_UID_MASK 0x00000060 /* mask for the following */ -#define UFS_UID_OLD 0x00000000 -#define UFS_UID_44BSD 0x00000020 -#define UFS_UID_EFT 0x00000040 -/* superblock state encoding */ -#define UFS_ST_MASK 0x00000700 /* mask for the following */ -#define UFS_ST_OLD 0x00000000 -#define UFS_ST_44BSD 0x00000100 -#define UFS_ST_SUN 0x00000200 /* Solaris */ -#define UFS_ST_SUNOS 0x00000300 -#define UFS_ST_SUNx86 0x00000400 /* Solaris x86 */ -/*cylinder group encoding */ -#define UFS_CG_MASK 0x00003000 /* mask for the following */ -#define UFS_CG_OLD 0x00000000 -#define UFS_CG_44BSD 0x00002000 -#define UFS_CG_SUN 0x00001000 -/* filesystem type encoding */ -#define UFS_TYPE_MASK 0x00010000 /* mask for the following */ -#define UFS_TYPE_UFS1 0x00000000 -#define UFS_TYPE_UFS2 0x00010000 - - -/* fs_inodefmt options */ -#define UFS_42INODEFMT -1 -#define UFS_44INODEFMT 2 - -/* - * MINFREE gives the minimum acceptable percentage of file system - * blocks which may be free. If the freelist drops below this level - * only the superuser may continue to allocate blocks. This may - * be set to 0 if no reserve of free blocks is deemed necessary, - * however throughput drops by fifty percent if the file system - * is run at between 95% and 100% full; thus the minimum default - * value of fs_minfree is 5%. However, to get good clustering - * performance, 10% is a better choice. hence we use 10% as our - * default value. With 10% free space, fragmentation is not a - * problem, so we choose to optimize for time. - */ -#define UFS_MINFREE 5 -#define UFS_DEFAULTOPT UFS_OPTTIME - -/* - * Turn file system block numbers into disk block addresses. - * This maps file system blocks to device size blocks. - */ -#define ufs_fsbtodb(uspi, b) ((b) << (uspi)->s_fsbtodb) -#define ufs_dbtofsb(uspi, b) ((b) >> (uspi)->s_fsbtodb) - -/* - * Cylinder group macros to locate things in cylinder groups. - * They calc file system addresses of cylinder group data structures. - */ -#define ufs_cgbase(c) (uspi->s_fpg * (c)) -#define ufs_cgstart(c) ((uspi)->fs_magic == UFS2_MAGIC ? ufs_cgbase(c) : \ - (ufs_cgbase(c) + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask))) -#define ufs_cgsblock(c) (ufs_cgstart(c) + uspi->s_sblkno) /* super blk */ -#define ufs_cgcmin(c) (ufs_cgstart(c) + uspi->s_cblkno) /* cg block */ -#define ufs_cgimin(c) (ufs_cgstart(c) + uspi->s_iblkno) /* inode blk */ -#define ufs_cgdmin(c) (ufs_cgstart(c) + uspi->s_dblkno) /* 1st data */ - -/* - * Macros for handling inode numbers: - * inode number to file system block offset. - * inode number to cylinder group number. - * inode number to file system block address. - */ -#define ufs_inotocg(x) ((x) / uspi->s_ipg) -#define ufs_inotocgoff(x) ((x) % uspi->s_ipg) -#define ufs_inotofsba(x) (((u64)ufs_cgimin(ufs_inotocg(x))) + ufs_inotocgoff(x) / uspi->s_inopf) -#define ufs_inotofsbo(x) ((x) % uspi->s_inopf) - -/* - * Compute the cylinder and rotational position of a cyl block addr. - */ -#define ufs_cbtocylno(bno) \ - ((bno) * uspi->s_nspf / uspi->s_spc) -#define ufs_cbtorpos(bno) \ - ((((bno) * uspi->s_nspf % uspi->s_spc / uspi->s_nsect \ - * uspi->s_trackskew + (bno) * uspi->s_nspf % uspi->s_spc \ - % uspi->s_nsect * uspi->s_interleave) % uspi->s_nsect \ - * uspi->s_nrpos) / uspi->s_npsect) - -/* - * The following macros optimize certain frequently calculated - * quantities by using shifts and masks in place of divisions - * modulos and multiplications. - */ -#define ufs_blkoff(loc) ((loc) & uspi->s_qbmask) -#define ufs_fragoff(loc) ((loc) & uspi->s_qfmask) -#define ufs_lblktosize(blk) ((blk) << uspi->s_bshift) -#define ufs_lblkno(loc) ((loc) >> uspi->s_bshift) -#define ufs_numfrags(loc) ((loc) >> uspi->s_fshift) -#define ufs_blkroundup(size) (((size) + uspi->s_qbmask) & uspi->s_bmask) -#define ufs_fragroundup(size) (((size) + uspi->s_qfmask) & uspi->s_fmask) -#define ufs_fragstoblks(frags) ((frags) >> uspi->s_fpbshift) -#define ufs_blkstofrags(blks) ((blks) << uspi->s_fpbshift) -#define ufs_fragnum(fsb) ((fsb) & uspi->s_fpbmask) -#define ufs_blknum(fsb) ((fsb) & ~uspi->s_fpbmask) - -#define UFS_MAXNAMLEN 255 -#define UFS_MAXMNTLEN 512 -#define UFS2_MAXMNTLEN 468 -#define UFS2_MAXVOLLEN 32 -#define UFS_MAXCSBUFS 31 -#define UFS_LINK_MAX 32000 -/* -#define UFS2_NOCSPTRS ((128 / sizeof(void *)) - 4) -*/ -#define UFS2_NOCSPTRS 28 - -/* - * UFS_DIR_PAD defines the directory entries boundaries - * (must be a multiple of 4) - */ -#define UFS_DIR_PAD 4 -#define UFS_DIR_ROUND (UFS_DIR_PAD - 1) -#define UFS_DIR_REC_LEN(name_len) (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND) - -struct ufs_timeval { - __fs32 tv_sec; - __fs32 tv_usec; -}; - -struct ufs_dir_entry { - __fs32 d_ino; /* inode number of this entry */ - __fs16 d_reclen; /* length of this entry */ - union { - __fs16 d_namlen; /* actual length of d_name */ - struct { - __u8 d_type; /* file type */ - __u8 d_namlen; /* length of string in d_name */ - } d_44; - } d_u; - __u8 d_name[UFS_MAXNAMLEN + 1]; /* file name */ -}; - -struct ufs_csum { - __fs32 cs_ndir; /* number of directories */ - __fs32 cs_nbfree; /* number of free blocks */ - __fs32 cs_nifree; /* number of free inodes */ - __fs32 cs_nffree; /* number of free frags */ -}; -struct ufs2_csum_total { - __fs64 cs_ndir; /* number of directories */ - __fs64 cs_nbfree; /* number of free blocks */ - __fs64 cs_nifree; /* number of free inodes */ - __fs64 cs_nffree; /* number of free frags */ - __fs64 cs_numclusters; /* number of free clusters */ - __fs64 cs_spare[3]; /* future expansion */ -}; - -struct ufs_csum_core { - __u64 cs_ndir; /* number of directories */ - __u64 cs_nbfree; /* number of free blocks */ - __u64 cs_nifree; /* number of free inodes */ - __u64 cs_nffree; /* number of free frags */ - __u64 cs_numclusters; /* number of free clusters */ -}; - -/* - * File system flags - */ -#define UFS_UNCLEAN 0x01 /* file system not clean at mount (unused) */ -#define UFS_DOSOFTDEP 0x02 /* file system using soft dependencies */ -#define UFS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */ -#define UFS_INDEXDIRS 0x08 /* kernel supports indexed directories */ -#define UFS_ACLS 0x10 /* file system has ACLs enabled */ -#define UFS_MULTILABEL 0x20 /* file system is MAC multi-label */ -#define UFS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */ - -#if 0 -/* - * This is the actual superblock, as it is laid out on the disk. - * Do NOT use this structure, because of sizeof(ufs_super_block) > 512 and - * it may occupy several blocks, use - * struct ufs_super_block_(first,second,third) instead. - */ -struct ufs_super_block { - union { - struct { - __fs32 fs_link; /* UNUSED */ - } fs_42; - struct { - __fs32 fs_state; /* file system state flag */ - } fs_sun; - } fs_u0; - __fs32 fs_rlink; /* UNUSED */ - __fs32 fs_sblkno; /* addr of super-block in filesys */ - __fs32 fs_cblkno; /* offset of cyl-block in filesys */ - __fs32 fs_iblkno; /* offset of inode-blocks in filesys */ - __fs32 fs_dblkno; /* offset of first data after cg */ - __fs32 fs_cgoffset; /* cylinder group offset in cylinder */ - __fs32 fs_cgmask; /* used to calc mod fs_ntrak */ - __fs32 fs_time; /* last time written -- time_t */ - __fs32 fs_size; /* number of blocks in fs */ - __fs32 fs_dsize; /* number of data blocks in fs */ - __fs32 fs_ncg; /* number of cylinder groups */ - __fs32 fs_bsize; /* size of basic blocks in fs */ - __fs32 fs_fsize; /* size of frag blocks in fs */ - __fs32 fs_frag; /* number of frags in a block in fs */ -/* these are configuration parameters */ - __fs32 fs_minfree; /* minimum percentage of free blocks */ - __fs32 fs_rotdelay; /* num of ms for optimal next block */ - __fs32 fs_rps; /* disk revolutions per second */ -/* these fields can be computed from the others */ - __fs32 fs_bmask; /* ``blkoff'' calc of blk offsets */ - __fs32 fs_fmask; /* ``fragoff'' calc of frag offsets */ - __fs32 fs_bshift; /* ``lblkno'' calc of logical blkno */ - __fs32 fs_fshift; /* ``numfrags'' calc number of frags */ -/* these are configuration parameters */ - __fs32 fs_maxcontig; /* max number of contiguous blks */ - __fs32 fs_maxbpg; /* max number of blks per cyl group */ -/* these fields can be computed from the others */ - __fs32 fs_fragshift; /* block to frag shift */ - __fs32 fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ - __fs32 fs_sbsize; /* actual size of super block */ - __fs32 fs_csmask; /* csum block offset */ - __fs32 fs_csshift; /* csum block number */ - __fs32 fs_nindir; /* value of NINDIR */ - __fs32 fs_inopb; /* value of INOPB */ - __fs32 fs_nspf; /* value of NSPF */ -/* yet another configuration parameter */ - __fs32 fs_optim; /* optimization preference, see below */ -/* these fields are derived from the hardware */ - union { - struct { - __fs32 fs_npsect; /* # sectors/track including spares */ - } fs_sun; - struct { - __fs32 fs_state; /* file system state time stamp */ - } fs_sunx86; - } fs_u1; - __fs32 fs_interleave; /* hardware sector interleave */ - __fs32 fs_trackskew; /* sector 0 skew, per track */ -/* a unique id for this filesystem (currently unused and unmaintained) */ -/* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */ -/* Neither of those fields is used in the Tahoe code right now but */ -/* there could be problems if they are. */ - __fs32 fs_id[2]; /* file system id */ -/* sizes determined by number of cylinder groups and their sizes */ - __fs32 fs_csaddr; /* blk addr of cyl grp summary area */ - __fs32 fs_cssize; /* size of cyl grp summary area */ - __fs32 fs_cgsize; /* cylinder group size */ -/* these fields are derived from the hardware */ - __fs32 fs_ntrak; /* tracks per cylinder */ - __fs32 fs_nsect; /* sectors per track */ - __fs32 fs_spc; /* sectors per cylinder */ -/* this comes from the disk driver partitioning */ - __fs32 fs_ncyl; /* cylinders in file system */ -/* these fields can be computed from the others */ - __fs32 fs_cpg; /* cylinders per group */ - __fs32 fs_ipg; /* inodes per cylinder group */ - __fs32 fs_fpg; /* blocks per group * fs_frag */ -/* this data must be re-computed after crashes */ - struct ufs_csum fs_cstotal; /* cylinder summary information */ -/* these fields are cleared at mount time */ - __s8 fs_fmod; /* super block modified flag */ - __s8 fs_clean; /* file system is clean flag */ - __s8 fs_ronly; /* mounted read-only flag */ - __s8 fs_flags; - union { - struct { - __s8 fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */ - __fs32 fs_cgrotor; /* last cg searched */ - __fs32 fs_csp[UFS_MAXCSBUFS];/*list of fs_cs info buffers */ - __fs32 fs_maxcluster; - __fs32 fs_cpc; /* cyl per cycle in postbl */ - __fs16 fs_opostbl[16][8]; /* old rotation block list head */ - } fs_u1; - struct { - __s8 fs_fsmnt[UFS2_MAXMNTLEN]; /* name mounted on */ - __u8 fs_volname[UFS2_MAXVOLLEN]; /* volume name */ - __fs64 fs_swuid; /* system-wide uid */ - __fs32 fs_pad; /* due to alignment of fs_swuid */ - __fs32 fs_cgrotor; /* last cg searched */ - __fs32 fs_ocsp[UFS2_NOCSPTRS]; /*list of fs_cs info buffers */ - __fs32 fs_contigdirs;/*# of contiguously allocated dirs */ - __fs32 fs_csp; /* cg summary info buffer for fs_cs */ - __fs32 fs_maxcluster; - __fs32 fs_active;/* used by snapshots to track fs */ - __fs32 fs_old_cpc; /* cyl per cycle in postbl */ - __fs32 fs_maxbsize;/*maximum blocking factor permitted */ - __fs64 fs_sparecon64[17];/*old rotation block list head */ - __fs64 fs_sblockloc; /* byte offset of standard superblock */ - struct ufs2_csum_total fs_cstotal;/*cylinder summary information*/ - struct ufs_timeval fs_time; /* last time written */ - __fs64 fs_size; /* number of blocks in fs */ - __fs64 fs_dsize; /* number of data blocks in fs */ - __fs64 fs_csaddr; /* blk addr of cyl grp summary area */ - __fs64 fs_pendingblocks;/* blocks in process of being freed */ - __fs32 fs_pendinginodes;/*inodes in process of being freed */ - } fs_u2; - } fs_u11; - union { - struct { - __fs32 fs_sparecon[53];/* reserved for future constants */ - __fs32 fs_reclaim; - __fs32 fs_sparecon2[1]; - __fs32 fs_state; /* file system state time stamp */ - __fs32 fs_qbmask[2]; /* ~usb_bmask */ - __fs32 fs_qfmask[2]; /* ~usb_fmask */ - } fs_sun; - struct { - __fs32 fs_sparecon[53];/* reserved for future constants */ - __fs32 fs_reclaim; - __fs32 fs_sparecon2[1]; - __fs32 fs_npsect; /* # sectors/track including spares */ - __fs32 fs_qbmask[2]; /* ~usb_bmask */ - __fs32 fs_qfmask[2]; /* ~usb_fmask */ - } fs_sunx86; - struct { - __fs32 fs_sparecon[50];/* reserved for future constants */ - __fs32 fs_contigsumsize;/* size of cluster summary array */ - __fs32 fs_maxsymlinklen;/* max length of an internal symlink */ - __fs32 fs_inodefmt; /* format of on-disk inodes */ - __fs32 fs_maxfilesize[2]; /* max representable file size */ - __fs32 fs_qbmask[2]; /* ~usb_bmask */ - __fs32 fs_qfmask[2]; /* ~usb_fmask */ - __fs32 fs_state; /* file system state time stamp */ - } fs_44; - } fs_u2; - __fs32 fs_postblformat; /* format of positional layout tables */ - __fs32 fs_nrpos; /* number of rotational positions */ - __fs32 fs_postbloff; /* (__s16) rotation block list head */ - __fs32 fs_rotbloff; /* (__u8) blocks for each rotation */ - __fs32 fs_magic; /* magic number */ - __u8 fs_space[1]; /* list of blocks for each rotation */ -}; -#endif/*struct ufs_super_block*/ - -/* - * Preference for optimization. - */ -#define UFS_OPTTIME 0 /* minimize allocation time */ -#define UFS_OPTSPACE 1 /* minimize disk fragmentation */ - -/* - * Rotational layout table format types - */ -#define UFS_42POSTBLFMT -1 /* 4.2BSD rotational table format */ -#define UFS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */ - -/* - * Convert cylinder group to base address of its global summary info. - */ -#define fs_cs(indx) s_csp[(indx)] - -/* - * Cylinder group block for a file system. - * - * Writable fields in the cylinder group are protected by the associated - * super block lock fs->fs_lock. - */ -#define CG_MAGIC 0x090255 -#define ufs_cg_chkmagic(sb, ucg) \ - (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC) -/* - * Macros for access to old cylinder group array structures - */ -#define ufs_ocg_blktot(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_btot) -#define ufs_ocg_blks(sb, ucg, cylno) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_b[cylno]) -#define ufs_ocg_inosused(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_iused) -#define ufs_ocg_blksfree(sb, ucg) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_free) -#define ufs_ocg_chkmagic(sb, ucg) \ - (fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_magic) == CG_MAGIC) - -/* - * size of this structure is 172 B - */ -struct ufs_cylinder_group { - __fs32 cg_link; /* linked list of cyl groups */ - __fs32 cg_magic; /* magic number */ - __fs32 cg_time; /* time last written */ - __fs32 cg_cgx; /* we are the cgx'th cylinder group */ - __fs16 cg_ncyl; /* number of cyl's this cg */ - __fs16 cg_niblk; /* number of inode blocks this cg */ - __fs32 cg_ndblk; /* number of data blocks this cg */ - struct ufs_csum cg_cs; /* cylinder summary information */ - __fs32 cg_rotor; /* position of last used block */ - __fs32 cg_frotor; /* position of last used frag */ - __fs32 cg_irotor; /* position of last used inode */ - __fs32 cg_frsum[UFS_MAXFRAG]; /* counts of available frags */ - __fs32 cg_btotoff; /* (__u32) block totals per cylinder */ - __fs32 cg_boff; /* (short) free block positions */ - __fs32 cg_iusedoff; /* (char) used inode map */ - __fs32 cg_freeoff; /* (u_char) free block map */ - __fs32 cg_nextfreeoff; /* (u_char) next available space */ - union { - struct { - __fs32 cg_clustersumoff; /* (u_int32) counts of avail clusters */ - __fs32 cg_clusteroff; /* (u_int8) free cluster map */ - __fs32 cg_nclusterblks; /* number of clusters this cg */ - __fs32 cg_sparecon[13]; /* reserved for future use */ - } cg_44; - struct { - __fs32 cg_clustersumoff;/* (u_int32) counts of avail clusters */ - __fs32 cg_clusteroff; /* (u_int8) free cluster map */ - __fs32 cg_nclusterblks;/* number of clusters this cg */ - __fs32 cg_niblk; /* number of inode blocks this cg */ - __fs32 cg_initediblk; /* last initialized inode */ - __fs32 cg_sparecon32[3];/* reserved for future use */ - __fs64 cg_time; /* time last written */ - __fs64 cg_sparecon[3]; /* reserved for future use */ - } cg_u2; - __fs32 cg_sparecon[16]; /* reserved for future use */ - } cg_u; - __u8 cg_space[1]; /* space for cylinder group maps */ -/* actually longer */ -}; - -/* Historic Cylinder group info */ -struct ufs_old_cylinder_group { - __fs32 cg_link; /* linked list of cyl groups */ - __fs32 cg_rlink; /* for incore cyl groups */ - __fs32 cg_time; /* time last written */ - __fs32 cg_cgx; /* we are the cgx'th cylinder group */ - __fs16 cg_ncyl; /* number of cyl's this cg */ - __fs16 cg_niblk; /* number of inode blocks this cg */ - __fs32 cg_ndblk; /* number of data blocks this cg */ - struct ufs_csum cg_cs; /* cylinder summary information */ - __fs32 cg_rotor; /* position of last used block */ - __fs32 cg_frotor; /* position of last used frag */ - __fs32 cg_irotor; /* position of last used inode */ - __fs32 cg_frsum[8]; /* counts of available frags */ - __fs32 cg_btot[32]; /* block totals per cylinder */ - __fs16 cg_b[32][8]; /* positions of free blocks */ - __u8 cg_iused[256]; /* used inode map */ - __fs32 cg_magic; /* magic number */ - __u8 cg_free[1]; /* free block map */ -/* actually longer */ -}; - -/* - * structure of an on-disk inode - */ -struct ufs_inode { - __fs16 ui_mode; /* 0x0 */ - __fs16 ui_nlink; /* 0x2 */ - union { - struct { - __fs16 ui_suid; /* 0x4 */ - __fs16 ui_sgid; /* 0x6 */ - } oldids; - __fs32 ui_inumber; /* 0x4 lsf: inode number */ - __fs32 ui_author; /* 0x4 GNU HURD: author */ - } ui_u1; - __fs64 ui_size; /* 0x8 */ - struct ufs_timeval ui_atime; /* 0x10 access */ - struct ufs_timeval ui_mtime; /* 0x18 modification */ - struct ufs_timeval ui_ctime; /* 0x20 creation */ - union { - struct { - __fs32 ui_db[UFS_NDADDR];/* 0x28 data blocks */ - __fs32 ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */ - } ui_addr; - __u8 ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */ - } ui_u2; - __fs32 ui_flags; /* 0x64 immutable, append-only... */ - __fs32 ui_blocks; /* 0x68 blocks in use */ - __fs32 ui_gen; /* 0x6c like ext2 i_version, for NFS support */ - union { - struct { - __fs32 ui_shadow; /* 0x70 shadow inode with security data */ - __fs32 ui_uid; /* 0x74 long EFT version of uid */ - __fs32 ui_gid; /* 0x78 long EFT version of gid */ - __fs32 ui_oeftflag; /* 0x7c reserved */ - } ui_sun; - struct { - __fs32 ui_uid; /* 0x70 File owner */ - __fs32 ui_gid; /* 0x74 File group */ - __fs32 ui_spare[2]; /* 0x78 reserved */ - } ui_44; - struct { - __fs32 ui_uid; /* 0x70 */ - __fs32 ui_gid; /* 0x74 */ - __fs16 ui_modeh; /* 0x78 mode high bits */ - __fs16 ui_spare; /* 0x7A unused */ - __fs32 ui_trans; /* 0x7c filesystem translator */ - } ui_hurd; - } ui_u3; -}; - -#define UFS_NXADDR 2 /* External addresses in inode. */ -struct ufs2_inode { - __fs16 ui_mode; /* 0: IFMT, permissions; see below. */ - __fs16 ui_nlink; /* 2: File link count. */ - __fs32 ui_uid; /* 4: File owner. */ - __fs32 ui_gid; /* 8: File group. */ - __fs32 ui_blksize; /* 12: Inode blocksize. */ - __fs64 ui_size; /* 16: File byte count. */ - __fs64 ui_blocks; /* 24: Bytes actually held. */ - __fs64 ui_atime; /* 32: Last access time. */ - __fs64 ui_mtime; /* 40: Last modified time. */ - __fs64 ui_ctime; /* 48: Last inode change time. */ - __fs64 ui_birthtime; /* 56: Inode creation time. */ - __fs32 ui_mtimensec; /* 64: Last modified time. */ - __fs32 ui_atimensec; /* 68: Last access time. */ - __fs32 ui_ctimensec; /* 72: Last inode change time. */ - __fs32 ui_birthnsec; /* 76: Inode creation time. */ - __fs32 ui_gen; /* 80: Generation number. */ - __fs32 ui_kernflags; /* 84: Kernel flags. */ - __fs32 ui_flags; /* 88: Status flags (chflags). */ - __fs32 ui_extsize; /* 92: External attributes block. */ - __fs64 ui_extb[UFS_NXADDR];/* 96: External attributes block. */ - union { - struct { - __fs64 ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */ - __fs64 ui_ib[UFS_NINDIR];/* 208: Indirect disk blocks.*/ - } ui_addr; - __u8 ui_symlink[2*4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */ - } ui_u2; - __fs64 ui_spare[3]; /* 232: Reserved; currently unused */ -}; - - -/* FreeBSD has these in sys/stat.h */ -/* ui_flags that can be set by a file owner */ -#define UFS_UF_SETTABLE 0x0000ffff -#define UFS_UF_NODUMP 0x00000001 /* do not dump */ -#define UFS_UF_IMMUTABLE 0x00000002 /* immutable (can't "change") */ -#define UFS_UF_APPEND 0x00000004 /* append-only */ -#define UFS_UF_OPAQUE 0x00000008 /* directory is opaque (unionfs) */ -#define UFS_UF_NOUNLINK 0x00000010 /* can't be removed or renamed */ -/* ui_flags that only root can set */ -#define UFS_SF_SETTABLE 0xffff0000 -#define UFS_SF_ARCHIVED 0x00010000 /* archived */ -#define UFS_SF_IMMUTABLE 0x00020000 /* immutable (can't "change") */ -#define UFS_SF_APPEND 0x00040000 /* append-only */ -#define UFS_SF_NOUNLINK 0x00100000 /* can't be removed or renamed */ - -/* - * This structure is used for reading disk structures larger - * than the size of fragment. - */ -struct ufs_buffer_head { - __u64 fragment; /* first fragment */ - __u64 count; /* number of fragments */ - struct buffer_head * bh[UFS_MAXFRAG]; /* buffers */ -}; - -struct ufs_cg_private_info { - struct ufs_buffer_head c_ubh; - __u32 c_cgx; /* number of cylidner group */ - __u16 c_ncyl; /* number of cyl's this cg */ - __u16 c_niblk; /* number of inode blocks this cg */ - __u32 c_ndblk; /* number of data blocks this cg */ - __u32 c_rotor; /* position of last used block */ - __u32 c_frotor; /* position of last used frag */ - __u32 c_irotor; /* position of last used inode */ - __u32 c_btotoff; /* (__u32) block totals per cylinder */ - __u32 c_boff; /* (short) free block positions */ - __u32 c_iusedoff; /* (char) used inode map */ - __u32 c_freeoff; /* (u_char) free block map */ - __u32 c_nextfreeoff; /* (u_char) next available space */ - __u32 c_clustersumoff;/* (u_int32) counts of avail clusters */ - __u32 c_clusteroff; /* (u_int8) free cluster map */ - __u32 c_nclusterblks; /* number of clusters this cg */ -}; - - -struct ufs_sb_private_info { - struct ufs_buffer_head s_ubh; /* buffer containing super block */ - struct ufs_csum_core cs_total; - __u32 s_sblkno; /* offset of super-blocks in filesys */ - __u32 s_cblkno; /* offset of cg-block in filesys */ - __u32 s_iblkno; /* offset of inode-blocks in filesys */ - __u32 s_dblkno; /* offset of first data after cg */ - __u32 s_cgoffset; /* cylinder group offset in cylinder */ - __u32 s_cgmask; /* used to calc mod fs_ntrak */ - __u32 s_size; /* number of blocks (fragments) in fs */ - __u32 s_dsize; /* number of data blocks in fs */ - __u64 s_u2_size; /* ufs2: number of blocks (fragments) in fs */ - __u64 s_u2_dsize; /*ufs2: number of data blocks in fs */ - __u32 s_ncg; /* number of cylinder groups */ - __u32 s_bsize; /* size of basic blocks */ - __u32 s_fsize; /* size of fragments */ - __u32 s_fpb; /* fragments per block */ - __u32 s_minfree; /* minimum percentage of free blocks */ - __u32 s_bmask; /* `blkoff'' calc of blk offsets */ - __u32 s_fmask; /* s_fsize mask */ - __u32 s_bshift; /* `lblkno'' calc of logical blkno */ - __u32 s_fshift; /* s_fsize shift */ - __u32 s_fpbshift; /* fragments per block shift */ - __u32 s_fsbtodb; /* fsbtodb and dbtofsb shift constant */ - __u32 s_sbsize; /* actual size of super block */ - __u32 s_csmask; /* csum block offset */ - __u32 s_csshift; /* csum block number */ - __u32 s_nindir; /* value of NINDIR */ - __u32 s_inopb; /* value of INOPB */ - __u32 s_nspf; /* value of NSPF */ - __u32 s_npsect; /* # sectors/track including spares */ - __u32 s_interleave; /* hardware sector interleave */ - __u32 s_trackskew; /* sector 0 skew, per track */ - __u64 s_csaddr; /* blk addr of cyl grp summary area */ - __u32 s_cssize; /* size of cyl grp summary area */ - __u32 s_cgsize; /* cylinder group size */ - __u32 s_ntrak; /* tracks per cylinder */ - __u32 s_nsect; /* sectors per track */ - __u32 s_spc; /* sectors per cylinder */ - __u32 s_ipg; /* inodes per cylinder group */ - __u32 s_fpg; /* fragments per group */ - __u32 s_cpc; /* cyl per cycle in postbl */ - __s32 s_contigsumsize;/* size of cluster summary array, 44bsd */ - __s64 s_qbmask; /* ~usb_bmask */ - __s64 s_qfmask; /* ~usb_fmask */ - __s32 s_postblformat; /* format of positional layout tables */ - __s32 s_nrpos; /* number of rotational positions */ - __s32 s_postbloff; /* (__s16) rotation block list head */ - __s32 s_rotbloff; /* (__u8) blocks for each rotation */ - - __u32 s_fpbmask; /* fragments per block mask */ - __u32 s_apb; /* address per block */ - __u32 s_2apb; /* address per block^2 */ - __u32 s_3apb; /* address per block^3 */ - __u32 s_apbmask; /* address per block mask */ - __u32 s_apbshift; /* address per block shift */ - __u32 s_2apbshift; /* address per block shift * 2 */ - __u32 s_3apbshift; /* address per block shift * 3 */ - __u32 s_nspfshift; /* number of sector per fragment shift */ - __u32 s_nspb; /* number of sector per block */ - __u32 s_inopf; /* inodes per fragment */ - __u32 s_sbbase; /* offset of NeXTstep superblock */ - __u32 s_bpf; /* bits per fragment */ - __u32 s_bpfshift; /* bits per fragment shift*/ - __u32 s_bpfmask; /* bits per fragment mask */ - - __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */ - __s32 fs_magic; /* filesystem magic */ - unsigned int s_dirblksize; -}; - -/* - * Sizes of this structures are: - * ufs_super_block_first 512 - * ufs_super_block_second 512 - * ufs_super_block_third 356 - */ -struct ufs_super_block_first { - union { - struct { - __fs32 fs_link; /* UNUSED */ - } fs_42; - struct { - __fs32 fs_state; /* file system state flag */ - } fs_sun; - } fs_u0; - __fs32 fs_rlink; - __fs32 fs_sblkno; - __fs32 fs_cblkno; - __fs32 fs_iblkno; - __fs32 fs_dblkno; - __fs32 fs_cgoffset; - __fs32 fs_cgmask; - __fs32 fs_time; - __fs32 fs_size; - __fs32 fs_dsize; - __fs32 fs_ncg; - __fs32 fs_bsize; - __fs32 fs_fsize; - __fs32 fs_frag; - __fs32 fs_minfree; - __fs32 fs_rotdelay; - __fs32 fs_rps; - __fs32 fs_bmask; - __fs32 fs_fmask; - __fs32 fs_bshift; - __fs32 fs_fshift; - __fs32 fs_maxcontig; - __fs32 fs_maxbpg; - __fs32 fs_fragshift; - __fs32 fs_fsbtodb; - __fs32 fs_sbsize; - __fs32 fs_csmask; - __fs32 fs_csshift; - __fs32 fs_nindir; - __fs32 fs_inopb; - __fs32 fs_nspf; - __fs32 fs_optim; - union { - struct { - __fs32 fs_npsect; - } fs_sun; - struct { - __fs32 fs_state; - } fs_sunx86; - } fs_u1; - __fs32 fs_interleave; - __fs32 fs_trackskew; - __fs32 fs_id[2]; - __fs32 fs_csaddr; - __fs32 fs_cssize; - __fs32 fs_cgsize; - __fs32 fs_ntrak; - __fs32 fs_nsect; - __fs32 fs_spc; - __fs32 fs_ncyl; - __fs32 fs_cpg; - __fs32 fs_ipg; - __fs32 fs_fpg; - struct ufs_csum fs_cstotal; - __s8 fs_fmod; - __s8 fs_clean; - __s8 fs_ronly; - __s8 fs_flags; - __s8 fs_fsmnt[UFS_MAXMNTLEN - 212]; - -}; - -struct ufs_super_block_second { - union { - struct { - __s8 fs_fsmnt[212]; - __fs32 fs_cgrotor; - __fs32 fs_csp[UFS_MAXCSBUFS]; - __fs32 fs_maxcluster; - __fs32 fs_cpc; - __fs16 fs_opostbl[82]; - } fs_u1; - struct { - __s8 fs_fsmnt[UFS2_MAXMNTLEN - UFS_MAXMNTLEN + 212]; - __u8 fs_volname[UFS2_MAXVOLLEN]; - __fs64 fs_swuid; - __fs32 fs_pad; - __fs32 fs_cgrotor; - __fs32 fs_ocsp[UFS2_NOCSPTRS]; - __fs32 fs_contigdirs; - __fs32 fs_csp; - __fs32 fs_maxcluster; - __fs32 fs_active; - __fs32 fs_old_cpc; - __fs32 fs_maxbsize; - __fs64 fs_sparecon64[17]; - __fs64 fs_sblockloc; - __fs64 cs_ndir; - __fs64 cs_nbfree; - } fs_u2; - } fs_un; -}; - -struct ufs_super_block_third { - union { - struct { - __fs16 fs_opostbl[46]; - } fs_u1; - struct { - __fs64 cs_nifree; /* number of free inodes */ - __fs64 cs_nffree; /* number of free frags */ - __fs64 cs_numclusters; /* number of free clusters */ - __fs64 cs_spare[3]; /* future expansion */ - struct ufs_timeval fs_time; /* last time written */ - __fs64 fs_size; /* number of blocks in fs */ - __fs64 fs_dsize; /* number of data blocks in fs */ - __fs64 fs_csaddr; /* blk addr of cyl grp summary area */ - __fs64 fs_pendingblocks;/* blocks in process of being freed */ - __fs32 fs_pendinginodes;/*inodes in process of being freed */ - } __attribute__ ((packed)) fs_u2; - } fs_un1; - union { - struct { - __fs32 fs_sparecon[53];/* reserved for future constants */ - __fs32 fs_reclaim; - __fs32 fs_sparecon2[1]; - __fs32 fs_state; /* file system state time stamp */ - __fs32 fs_qbmask[2]; /* ~usb_bmask */ - __fs32 fs_qfmask[2]; /* ~usb_fmask */ - } fs_sun; - struct { - __fs32 fs_sparecon[53];/* reserved for future constants */ - __fs32 fs_reclaim; - __fs32 fs_sparecon2[1]; - __fs32 fs_npsect; /* # sectors/track including spares */ - __fs32 fs_qbmask[2]; /* ~usb_bmask */ - __fs32 fs_qfmask[2]; /* ~usb_fmask */ - } fs_sunx86; - struct { - __fs32 fs_sparecon[50];/* reserved for future constants */ - __fs32 fs_contigsumsize;/* size of cluster summary array */ - __fs32 fs_maxsymlinklen;/* max length of an internal symlink */ - __fs32 fs_inodefmt; /* format of on-disk inodes */ - __fs32 fs_maxfilesize[2]; /* max representable file size */ - __fs32 fs_qbmask[2]; /* ~usb_bmask */ - __fs32 fs_qfmask[2]; /* ~usb_fmask */ - __fs32 fs_state; /* file system state time stamp */ - } fs_44; - } fs_un2; - __fs32 fs_postblformat; - __fs32 fs_nrpos; - __fs32 fs_postbloff; - __fs32 fs_rotbloff; - __fs32 fs_magic; - __u8 fs_space[1]; -}; - -#endif /* __LINUX_UFS_FS_H */ diff --git a/include/linux/utsname.h b/include/linux/utsname.h index 923db99175f..11232676bff 100644 --- a/include/linux/utsname.h +++ b/include/linux/utsname.h @@ -35,6 +35,7 @@ struct new_utsname { #include <linux/sched.h> #include <linux/kref.h> #include <linux/nsproxy.h> +#include <linux/err.h> #include <asm/atomic.h> struct uts_namespace { @@ -43,6 +44,7 @@ struct uts_namespace { }; extern struct uts_namespace init_uts_ns; +#ifdef CONFIG_UTS_NS static inline void get_uts_ns(struct uts_namespace *ns) { kref_get(&ns->kref); @@ -56,6 +58,25 @@ static inline void put_uts_ns(struct uts_namespace *ns) { kref_put(&ns->kref, free_uts_ns); } +#else +static inline void get_uts_ns(struct uts_namespace *ns) +{ +} + +static inline void put_uts_ns(struct uts_namespace *ns) +{ +} + +static inline struct uts_namespace *copy_utsname(unsigned long flags, + struct uts_namespace *ns) +{ + if (flags & CLONE_NEWUTS) + return ERR_PTR(-EINVAL); + + return ns; +} +#endif + static inline struct new_utsname *utsname(void) { return ¤t->nsproxy->uts_ns->name; |