aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h84
1 files changed, 66 insertions, 18 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dba4cbd157e..6eafbe30948 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -27,6 +27,10 @@
27#define BLOCK_SIZE_BITS 10 27#define BLOCK_SIZE_BITS 10
28#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) 28#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
29 29
30#define SEEK_SET 0 /* seek relative to beginning of file */
31#define SEEK_CUR 1 /* seek relative to current file position */
32#define SEEK_END 2 /* seek relative to end of file */
33
30/* And dynamically-tunable limits and defaults: */ 34/* And dynamically-tunable limits and defaults: */
31struct files_stat_struct { 35struct files_stat_struct {
32 int nr_files; /* read only */ 36 int nr_files; /* read only */
@@ -88,9 +92,10 @@ extern int dir_notify_enable;
88#define FS_REQUIRES_DEV 1 92#define FS_REQUIRES_DEV 1
89#define FS_BINARY_MOUNTDATA 2 93#define FS_BINARY_MOUNTDATA 2
90#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ 94#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
91#define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon 95#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
92 * as nfs_rename() will be cleaned up 96 * during rename() internally.
93 */ 97 */
98
94/* 99/*
95 * These are the fs-independent mount-flags: up to 32 flags are supported 100 * These are the fs-independent mount-flags: up to 32 flags are supported
96 */ 101 */
@@ -392,7 +397,7 @@ struct address_space {
392 unsigned int truncate_count; /* Cover race condition with truncate */ 397 unsigned int truncate_count; /* Cover race condition with truncate */
393 unsigned long nrpages; /* number of total pages */ 398 unsigned long nrpages; /* number of total pages */
394 pgoff_t writeback_index;/* writeback starts here */ 399 pgoff_t writeback_index;/* writeback starts here */
395 struct address_space_operations *a_ops; /* methods */ 400 const struct address_space_operations *a_ops; /* methods */
396 unsigned long flags; /* error bits/gfp mask */ 401 unsigned long flags; /* error bits/gfp mask */
397 struct backing_dev_info *backing_dev_info; /* device readahead, etc */ 402 struct backing_dev_info *backing_dev_info; /* device readahead, etc */
398 spinlock_t private_lock; /* for use by the address_space */ 403 spinlock_t private_lock; /* for use by the address_space */
@@ -436,6 +441,21 @@ struct block_device {
436}; 441};
437 442
438/* 443/*
444 * bdev->bd_mutex nesting subclasses for the lock validator:
445 *
446 * 0: normal
447 * 1: 'whole'
448 * 2: 'partition'
449 */
450enum bdev_bd_mutex_lock_class
451{
452 BD_MUTEX_NORMAL,
453 BD_MUTEX_WHOLE,
454 BD_MUTEX_PARTITION
455};
456
457
458/*
439 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 459 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
440 * radix trees 460 * radix trees
441 */ 461 */
@@ -492,7 +512,6 @@ struct inode {
492 struct timespec i_mtime; 512 struct timespec i_mtime;
493 struct timespec i_ctime; 513 struct timespec i_ctime;
494 unsigned int i_blkbits; 514 unsigned int i_blkbits;
495 unsigned long i_blksize;
496 unsigned long i_version; 515 unsigned long i_version;
497 blkcnt_t i_blocks; 516 blkcnt_t i_blocks;
498 unsigned short i_bytes; 517 unsigned short i_bytes;
@@ -508,11 +527,12 @@ struct inode {
508#ifdef CONFIG_QUOTA 527#ifdef CONFIG_QUOTA
509 struct dquot *i_dquot[MAXQUOTAS]; 528 struct dquot *i_dquot[MAXQUOTAS];
510#endif 529#endif
511 /* These three should probably be a union */
512 struct list_head i_devices; 530 struct list_head i_devices;
513 struct pipe_inode_info *i_pipe; 531 union {
514 struct block_device *i_bdev; 532 struct pipe_inode_info *i_pipe;
515 struct cdev *i_cdev; 533 struct block_device *i_bdev;
534 struct cdev *i_cdev;
535 };
516 int i_cindex; 536 int i_cindex;
517 537
518 __u32 i_generation; 538 __u32 i_generation;
@@ -533,16 +553,36 @@ struct inode {
533 unsigned int i_flags; 553 unsigned int i_flags;
534 554
535 atomic_t i_writecount; 555 atomic_t i_writecount;
556#ifdef CONFIG_SECURITY
536 void *i_security; 557 void *i_security;
537 union { 558#endif
538 void *generic_ip; 559 void *i_private; /* fs or device private pointer */
539 } u;
540#ifdef __NEED_I_SIZE_ORDERED 560#ifdef __NEED_I_SIZE_ORDERED
541 seqcount_t i_size_seqcount; 561 seqcount_t i_size_seqcount;
542#endif 562#endif
543}; 563};
544 564
545/* 565/*
566 * inode->i_mutex nesting subclasses for the lock validator:
567 *
568 * 0: the object of the current VFS operation
569 * 1: parent
570 * 2: child/target
571 * 3: quota file
572 *
573 * The locking order between these classes is
574 * parent -> child -> normal -> xattr -> quota
575 */
576enum inode_i_mutex_lock_class
577{
578 I_MUTEX_NORMAL,
579 I_MUTEX_PARENT,
580 I_MUTEX_CHILD,
581 I_MUTEX_XATTR,
582 I_MUTEX_QUOTA
583};
584
585/*
546 * NOTE: in a 32bit arch with a preemptable kernel and 586 * NOTE: in a 32bit arch with a preemptable kernel and
547 * an UP compile the i_size_read/write must be atomic 587 * an UP compile the i_size_read/write must be atomic
548 * with respect to the local cpu (unlike with preempt disabled), 588 * with respect to the local cpu (unlike with preempt disabled),
@@ -607,7 +647,6 @@ struct fown_struct {
607 rwlock_t lock; /* protects pid, uid, euid fields */ 647 rwlock_t lock; /* protects pid, uid, euid fields */
608 int pid; /* pid or -pgrp where SIGIO should be sent */ 648 int pid; /* pid or -pgrp where SIGIO should be sent */
609 uid_t uid, euid; /* uid/euid of process setting the owner */ 649 uid_t uid, euid; /* uid/euid of process setting the owner */
610 void *security;
611 int signum; /* posix.1b rt signal to be delivered on IO */ 650 int signum; /* posix.1b rt signal to be delivered on IO */
612}; 651};
613 652
@@ -650,8 +689,9 @@ struct file {
650 struct file_ra_state f_ra; 689 struct file_ra_state f_ra;
651 690
652 unsigned long f_version; 691 unsigned long f_version;
692#ifdef CONFIG_SECURITY
653 void *f_security; 693 void *f_security;
654 694#endif
655 /* needed for tty driver, and maybe others */ 695 /* needed for tty driver, and maybe others */
656 void *private_data; 696 void *private_data;
657 697
@@ -682,6 +722,7 @@ extern spinlock_t files_lock;
682#define FL_POSIX 1 722#define FL_POSIX 1
683#define FL_FLOCK 2 723#define FL_FLOCK 2
684#define FL_ACCESS 8 /* not trying to lock, just looking */ 724#define FL_ACCESS 8 /* not trying to lock, just looking */
725#define FL_EXISTS 16 /* when unlocking, test for existence */
685#define FL_LEASE 32 /* lease held on this file */ 726#define FL_LEASE 32 /* lease held on this file */
686#define FL_CLOSE 64 /* unlock on close */ 727#define FL_CLOSE 64 /* unlock on close */
687#define FL_SLEEP 128 /* A blocking lock */ 728#define FL_SLEEP 128 /* A blocking lock */
@@ -838,7 +879,9 @@ struct super_block {
838 int s_syncing; 879 int s_syncing;
839 int s_need_sync_fs; 880 int s_need_sync_fs;
840 atomic_t s_active; 881 atomic_t s_active;
882#ifdef CONFIG_SECURITY
841 void *s_security; 883 void *s_security;
884#endif
842 struct xattr_handler **s_xattr; 885 struct xattr_handler **s_xattr;
843 886
844 struct list_head s_inodes; /* all inodes */ 887 struct list_head s_inodes; /* all inodes */
@@ -1100,13 +1143,14 @@ struct super_operations {
1100 int (*statfs) (struct dentry *, struct kstatfs *); 1143 int (*statfs) (struct dentry *, struct kstatfs *);
1101 int (*remount_fs) (struct super_block *, int *, char *); 1144 int (*remount_fs) (struct super_block *, int *, char *);
1102 void (*clear_inode) (struct inode *); 1145 void (*clear_inode) (struct inode *);
1103 void (*umount_begin) (struct super_block *); 1146 void (*umount_begin) (struct vfsmount *, int);
1104 1147
1105 int (*show_options)(struct seq_file *, struct vfsmount *); 1148 int (*show_options)(struct seq_file *, struct vfsmount *);
1106 int (*show_stats)(struct seq_file *, struct vfsmount *); 1149 int (*show_stats)(struct seq_file *, struct vfsmount *);
1107 1150#ifdef CONFIG_QUOTA
1108 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1151 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1109 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1152 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1153#endif
1110}; 1154};
1111 1155
1112/* Inode state bits. Protected by inode_lock. */ 1156/* Inode state bits. Protected by inode_lock. */
@@ -1276,6 +1320,8 @@ struct file_system_type {
1276 struct module *owner; 1320 struct module *owner;
1277 struct file_system_type * next; 1321 struct file_system_type * next;
1278 struct list_head fs_supers; 1322 struct list_head fs_supers;
1323 struct lock_class_key s_lock_key;
1324 struct lock_class_key s_umount_key;
1279}; 1325};
1280 1326
1281extern int get_sb_bdev(struct file_system_type *fs_type, 1327extern int get_sb_bdev(struct file_system_type *fs_type,
@@ -1404,8 +1450,9 @@ extern void bd_set_size(struct block_device *, loff_t size);
1404extern void bd_forget(struct inode *inode); 1450extern void bd_forget(struct inode *inode);
1405extern void bdput(struct block_device *); 1451extern void bdput(struct block_device *);
1406extern struct block_device *open_by_devnum(dev_t, unsigned); 1452extern struct block_device *open_by_devnum(dev_t, unsigned);
1453extern struct block_device *open_partition_by_devnum(dev_t, unsigned);
1407extern const struct file_operations def_blk_fops; 1454extern const struct file_operations def_blk_fops;
1408extern struct address_space_operations def_blk_aops; 1455extern const struct address_space_operations def_blk_aops;
1409extern const struct file_operations def_chr_fops; 1456extern const struct file_operations def_chr_fops;
1410extern const struct file_operations bad_sock_fops; 1457extern const struct file_operations bad_sock_fops;
1411extern const struct file_operations def_fifo_fops; 1458extern const struct file_operations def_fifo_fops;
@@ -1414,6 +1461,7 @@ extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1414extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1461extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1415extern int blkdev_get(struct block_device *, mode_t, unsigned); 1462extern int blkdev_get(struct block_device *, mode_t, unsigned);
1416extern int blkdev_put(struct block_device *); 1463extern int blkdev_put(struct block_device *);
1464extern int blkdev_put_partition(struct block_device *);
1417extern int bd_claim(struct block_device *, void *); 1465extern int bd_claim(struct block_device *, void *);
1418extern void bd_release(struct block_device *); 1466extern void bd_release(struct block_device *);
1419#ifdef CONFIG_SYSFS 1467#ifdef CONFIG_SYSFS
@@ -1767,7 +1815,7 @@ extern struct inode_operations simple_dir_inode_operations;
1767struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 1815struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1768struct dentry *d_alloc_name(struct dentry *, const char *); 1816struct dentry *d_alloc_name(struct dentry *, const char *);
1769extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1817extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
1770extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); 1818extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
1771extern void simple_release_fs(struct vfsmount **mount, int *count); 1819extern void simple_release_fs(struct vfsmount **mount, int *count);
1772 1820
1773extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t); 1821extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t);