diff options
Diffstat (limited to 'fs')
171 files changed, 451 insertions, 3505 deletions
diff --git a/fs/9p/conv.c b/fs/9p/conv.c index a767e05b60bf..1e898144eb7c 100644 --- a/fs/9p/conv.c +++ b/fs/9p/conv.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
29 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
30 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
diff --git a/fs/9p/error.c b/fs/9p/error.c index 981fe8ecd780..ae91555c1558 100644 --- a/fs/9p/error.c +++ b/fs/9p/error.c | |||
@@ -27,7 +27,6 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | 31 | ||
33 | #include <linux/list.h> | 32 | #include <linux/list.h> |
diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c index 6f2617820a4e..8556097fcda8 100644 --- a/fs/9p/fcall.c +++ b/fs/9p/fcall.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
29 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
30 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
diff --git a/fs/9p/fcprint.c b/fs/9p/fcprint.c index 583e827baebd..34b96114a28d 100644 --- a/fs/9p/fcprint.c +++ b/fs/9p/fcprint.c | |||
@@ -21,7 +21,6 @@ | |||
21 | * Boston, MA 02111-1301 USA | 21 | * Boston, MA 02111-1301 USA |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | #include <linux/config.h> | ||
25 | #include <linux/module.h> | 24 | #include <linux/module.h> |
26 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
27 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index b7608af07ce8..70492ccb4385 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/config.h> | ||
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
26 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
diff --git a/fs/9p/mux.c b/fs/9p/mux.c index 8d45ed668837..90a79c784549 100644 --- a/fs/9p/mux.c +++ b/fs/9p/mux.c | |||
@@ -23,7 +23,6 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/config.h> | ||
27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
28 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
29 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
diff --git a/fs/9p/trans_fd.c b/fs/9p/trans_fd.c index 94e0a7fd9fc2..34d43355beb7 100644 --- a/fs/9p/trans_fd.c +++ b/fs/9p/trans_fd.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/config.h> | ||
29 | #include <linux/in.h> | 28 | #include <linux/in.h> |
30 | #include <linux/module.h> | 29 | #include <linux/module.h> |
31 | #include <linux/net.h> | 30 | #include <linux/net.h> |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index d37416eb5791..22f7ccd58d38 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -23,7 +23,6 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/config.h> | ||
27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
28 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
29 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index d4f0aa3c87f2..9dfd259a70b4 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
33 | #include <linux/inet.h> | 33 | #include <linux/inet.h> |
34 | #include <linux/version.h> | ||
35 | #include <linux/pagemap.h> | 34 | #include <linux/pagemap.h> |
36 | #include <linux/idr.h> | 35 | #include <linux/idr.h> |
37 | 36 | ||
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 1a8e46084f0e..c3c47eda7574 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
33 | #include <linux/inet.h> | 33 | #include <linux/inet.h> |
34 | #include <linux/version.h> | ||
35 | #include <linux/list.h> | 34 | #include <linux/list.h> |
36 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
37 | #include <linux/idr.h> | 36 | #include <linux/idr.h> |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 8b15bb22caca..63320d4e15d2 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -25,7 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/config.h> | ||
29 | #include <linux/module.h> | 28 | #include <linux/module.h> |
30 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
31 | #include <linux/fs.h> | 30 | #include <linux/fs.h> |
diff --git a/fs/Kconfig b/fs/Kconfig index 6dc8cfd6d80c..53f5c6d61121 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -326,7 +326,7 @@ source "fs/xfs/Kconfig" | |||
326 | 326 | ||
327 | config OCFS2_FS | 327 | config OCFS2_FS |
328 | tristate "OCFS2 file system support (EXPERIMENTAL)" | 328 | tristate "OCFS2 file system support (EXPERIMENTAL)" |
329 | depends on NET && EXPERIMENTAL | 329 | depends on NET && SYSFS && EXPERIMENTAL |
330 | select CONFIGFS_FS | 330 | select CONFIGFS_FS |
331 | select JBD | 331 | select JBD |
332 | select CRC32 | 332 | select CRC32 |
@@ -356,6 +356,16 @@ config OCFS2_FS | |||
356 | - POSIX ACLs | 356 | - POSIX ACLs |
357 | - readpages / writepages (not user visible) | 357 | - readpages / writepages (not user visible) |
358 | 358 | ||
359 | config OCFS2_DEBUG_MASKLOG | ||
360 | bool "OCFS2 logging support" | ||
361 | depends on OCFS2_FS | ||
362 | default y | ||
363 | help | ||
364 | The ocfs2 filesystem has an extensive logging system. The system | ||
365 | allows selection of events to log via files in /sys/o2cb/logmask/. | ||
366 | This option will enlarge your kernel, but it allows debugging of | ||
367 | ocfs2 filesystem issues. | ||
368 | |||
359 | config MINIX_FS | 369 | config MINIX_FS |
360 | tristate "Minix fs support" | 370 | tristate "Minix fs support" |
361 | help | 371 | help |
diff --git a/fs/Makefile b/fs/Makefile index d0ea6bfccf29..89135428a539 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -66,7 +66,6 @@ obj-$(CONFIG_MSDOS_FS) += msdos/ | |||
66 | obj-$(CONFIG_VFAT_FS) += vfat/ | 66 | obj-$(CONFIG_VFAT_FS) += vfat/ |
67 | obj-$(CONFIG_BFS_FS) += bfs/ | 67 | obj-$(CONFIG_BFS_FS) += bfs/ |
68 | obj-$(CONFIG_ISO9660_FS) += isofs/ | 68 | obj-$(CONFIG_ISO9660_FS) += isofs/ |
69 | obj-$(CONFIG_DEVFS_FS) += devfs/ | ||
70 | obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+ | 69 | obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+ |
71 | obj-$(CONFIG_HFS_FS) += hfs/ | 70 | obj-$(CONFIG_HFS_FS) += hfs/ |
72 | obj-$(CONFIG_VXFS_FS) += freevxfs/ | 71 | obj-$(CONFIG_VXFS_FS) += freevxfs/ |
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index 7b075fc397da..d3c7905b2ddc 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * | 9 | * |
10 | * Common directory handling for ADFS | 10 | * Common directory handling for ADFS |
11 | */ | 11 | */ |
12 | #include <linux/config.h> | ||
13 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | #include <linux/adfs_fs.h> | 14 | #include <linux/adfs_fs.h> |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index a83e889a97cd..fcaeead9696b 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -325,7 +325,7 @@ befs_read_inode(struct inode *inode) | |||
325 | if (!bh) { | 325 | if (!bh) { |
326 | befs_error(sb, "unable to read inode block - " | 326 | befs_error(sb, "unable to read inode block - " |
327 | "inode = %lu", inode->i_ino); | 327 | "inode = %lu", inode->i_ino); |
328 | goto unaquire_none; | 328 | goto unacquire_none; |
329 | } | 329 | } |
330 | 330 | ||
331 | raw_inode = (befs_inode *) bh->b_data; | 331 | raw_inode = (befs_inode *) bh->b_data; |
@@ -334,7 +334,7 @@ befs_read_inode(struct inode *inode) | |||
334 | 334 | ||
335 | if (befs_check_inode(sb, raw_inode, inode->i_ino) != BEFS_OK) { | 335 | if (befs_check_inode(sb, raw_inode, inode->i_ino) != BEFS_OK) { |
336 | befs_error(sb, "Bad inode: %lu", inode->i_ino); | 336 | befs_error(sb, "Bad inode: %lu", inode->i_ino); |
337 | goto unaquire_bh; | 337 | goto unacquire_bh; |
338 | } | 338 | } |
339 | 339 | ||
340 | inode->i_mode = (umode_t) fs32_to_cpu(sb, raw_inode->mode); | 340 | inode->i_mode = (umode_t) fs32_to_cpu(sb, raw_inode->mode); |
@@ -402,17 +402,17 @@ befs_read_inode(struct inode *inode) | |||
402 | befs_error(sb, "Inode %lu is not a regular file, " | 402 | befs_error(sb, "Inode %lu is not a regular file, " |
403 | "directory or symlink. THAT IS WRONG! BeFS has no " | 403 | "directory or symlink. THAT IS WRONG! BeFS has no " |
404 | "on disk special files", inode->i_ino); | 404 | "on disk special files", inode->i_ino); |
405 | goto unaquire_bh; | 405 | goto unacquire_bh; |
406 | } | 406 | } |
407 | 407 | ||
408 | brelse(bh); | 408 | brelse(bh); |
409 | befs_debug(sb, "<--- befs_read_inode()"); | 409 | befs_debug(sb, "<--- befs_read_inode()"); |
410 | return; | 410 | return; |
411 | 411 | ||
412 | unaquire_bh: | 412 | unacquire_bh: |
413 | brelse(bh); | 413 | brelse(bh); |
414 | 414 | ||
415 | unaquire_none: | 415 | unacquire_none: |
416 | make_bad_inode(inode); | 416 | make_bad_inode(inode); |
417 | befs_debug(sb, "<--- befs_read_inode() - Bad inode"); | 417 | befs_debug(sb, "<--- befs_read_inode() - Bad inode"); |
418 | return; | 418 | return; |
@@ -761,14 +761,14 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | |||
761 | printk(KERN_ERR | 761 | printk(KERN_ERR |
762 | "BeFS(%s): Unable to allocate memory for private " | 762 | "BeFS(%s): Unable to allocate memory for private " |
763 | "portion of superblock. Bailing.\n", sb->s_id); | 763 | "portion of superblock. Bailing.\n", sb->s_id); |
764 | goto unaquire_none; | 764 | goto unacquire_none; |
765 | } | 765 | } |
766 | befs_sb = BEFS_SB(sb); | 766 | befs_sb = BEFS_SB(sb); |
767 | memset(befs_sb, 0, sizeof(befs_sb_info)); | 767 | memset(befs_sb, 0, sizeof(befs_sb_info)); |
768 | 768 | ||
769 | if (!parse_options((char *) data, &befs_sb->mount_opts)) { | 769 | if (!parse_options((char *) data, &befs_sb->mount_opts)) { |
770 | befs_error(sb, "cannot parse mount options"); | 770 | befs_error(sb, "cannot parse mount options"); |
771 | goto unaquire_priv_sbp; | 771 | goto unacquire_priv_sbp; |
772 | } | 772 | } |
773 | 773 | ||
774 | befs_debug(sb, "---> befs_fill_super()"); | 774 | befs_debug(sb, "---> befs_fill_super()"); |
@@ -794,7 +794,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | |||
794 | 794 | ||
795 | if (!(bh = sb_bread(sb, sb_block))) { | 795 | if (!(bh = sb_bread(sb, sb_block))) { |
796 | befs_error(sb, "unable to read superblock"); | 796 | befs_error(sb, "unable to read superblock"); |
797 | goto unaquire_priv_sbp; | 797 | goto unacquire_priv_sbp; |
798 | } | 798 | } |
799 | 799 | ||
800 | /* account for offset of super block on x86 */ | 800 | /* account for offset of super block on x86 */ |
@@ -809,20 +809,20 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | |||
809 | } | 809 | } |
810 | 810 | ||
811 | if (befs_load_sb(sb, disk_sb) != BEFS_OK) | 811 | if (befs_load_sb(sb, disk_sb) != BEFS_OK) |
812 | goto unaquire_bh; | 812 | goto unacquire_bh; |
813 | 813 | ||
814 | befs_dump_super_block(sb, disk_sb); | 814 | befs_dump_super_block(sb, disk_sb); |
815 | 815 | ||
816 | brelse(bh); | 816 | brelse(bh); |
817 | 817 | ||
818 | if (befs_check_sb(sb) != BEFS_OK) | 818 | if (befs_check_sb(sb) != BEFS_OK) |
819 | goto unaquire_priv_sbp; | 819 | goto unacquire_priv_sbp; |
820 | 820 | ||
821 | if( befs_sb->num_blocks > ~((sector_t)0) ) { | 821 | if( befs_sb->num_blocks > ~((sector_t)0) ) { |
822 | befs_error(sb, "blocks count: %Lu " | 822 | befs_error(sb, "blocks count: %Lu " |
823 | "is larger than the host can use", | 823 | "is larger than the host can use", |
824 | befs_sb->num_blocks); | 824 | befs_sb->num_blocks); |
825 | goto unaquire_priv_sbp; | 825 | goto unacquire_priv_sbp; |
826 | } | 826 | } |
827 | 827 | ||
828 | /* | 828 | /* |
@@ -838,7 +838,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | |||
838 | if (!sb->s_root) { | 838 | if (!sb->s_root) { |
839 | iput(root); | 839 | iput(root); |
840 | befs_error(sb, "get root inode failed"); | 840 | befs_error(sb, "get root inode failed"); |
841 | goto unaquire_priv_sbp; | 841 | goto unacquire_priv_sbp; |
842 | } | 842 | } |
843 | 843 | ||
844 | /* load nls library */ | 844 | /* load nls library */ |
@@ -860,13 +860,13 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | |||
860 | 860 | ||
861 | return 0; | 861 | return 0; |
862 | /*****************/ | 862 | /*****************/ |
863 | unaquire_bh: | 863 | unacquire_bh: |
864 | brelse(bh); | 864 | brelse(bh); |
865 | 865 | ||
866 | unaquire_priv_sbp: | 866 | unacquire_priv_sbp: |
867 | kfree(sb->s_fs_info); | 867 | kfree(sb->s_fs_info); |
868 | 868 | ||
869 | unaquire_none: | 869 | unacquire_none: |
870 | sb->s_fs_info = NULL; | 870 | sb->s_fs_info = NULL; |
871 | return -EINVAL; | 871 | return -EINVAL; |
872 | } | 872 | } |
@@ -925,18 +925,18 @@ init_befs_fs(void) | |||
925 | 925 | ||
926 | err = befs_init_inodecache(); | 926 | err = befs_init_inodecache(); |
927 | if (err) | 927 | if (err) |
928 | goto unaquire_none; | 928 | goto unacquire_none; |
929 | 929 | ||
930 | err = register_filesystem(&befs_fs_type); | 930 | err = register_filesystem(&befs_fs_type); |
931 | if (err) | 931 | if (err) |
932 | goto unaquire_inodecache; | 932 | goto unacquire_inodecache; |
933 | 933 | ||
934 | return 0; | 934 | return 0; |
935 | 935 | ||
936 | unaquire_inodecache: | 936 | unacquire_inodecache: |
937 | befs_destroy_inodecache(); | 937 | befs_destroy_inodecache(); |
938 | 938 | ||
939 | unaquire_none: | 939 | unacquire_none: |
940 | return err; | 940 | return err; |
941 | } | 941 | } |
942 | 942 | ||
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index c94d52eafd1b..a62fd4018a20 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -16,7 +16,6 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/config.h> | ||
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
22 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c index 00a91dc25d16..32b5d625ce9c 100644 --- a/fs/binfmt_som.c +++ b/fs/binfmt_som.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
34 | 34 | ||
35 | #include <linux/config.h> | ||
36 | 35 | ||
37 | #include <linux/elf.h> | 36 | #include <linux/elf.h> |
38 | 37 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index 7f7600e2381c..9633a490dab0 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -5,14 +5,12 @@ | |||
5 | * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE | 5 | * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/config.h> | ||
9 | #include <linux/init.h> | 8 | #include <linux/init.h> |
10 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
11 | #include <linux/fcntl.h> | 10 | #include <linux/fcntl.h> |
12 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
13 | #include <linux/kmod.h> | 12 | #include <linux/kmod.h> |
14 | #include <linux/major.h> | 13 | #include <linux/major.h> |
15 | #include <linux/devfs_fs_kernel.h> | ||
16 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
17 | #include <linux/highmem.h> | 15 | #include <linux/highmem.h> |
18 | #include <linux/blkdev.h> | 16 | #include <linux/blkdev.h> |
diff --git a/fs/buffer.c b/fs/buffer.c index e9994722f4a3..3660dcb97591 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * async buffer flushing, 1999 Andrea Arcangeli <andrea@suse.de> | 18 | * async buffer flushing, 1999 Andrea Arcangeli <andrea@suse.de> |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/config.h> | ||
22 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
23 | #include <linux/syscalls.h> | 22 | #include <linux/syscalls.h> |
24 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
@@ -852,7 +851,7 @@ int __set_page_dirty_buffers(struct page *page) | |||
852 | write_lock_irq(&mapping->tree_lock); | 851 | write_lock_irq(&mapping->tree_lock); |
853 | if (page->mapping) { /* Race with truncate? */ | 852 | if (page->mapping) { /* Race with truncate? */ |
854 | if (mapping_cap_account_dirty(mapping)) | 853 | if (mapping_cap_account_dirty(mapping)) |
855 | inc_page_state(nr_dirty); | 854 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
856 | radix_tree_tag_set(&mapping->page_tree, | 855 | radix_tree_tag_set(&mapping->page_tree, |
857 | page_index(page), | 856 | page_index(page), |
858 | PAGECACHE_TAG_DIRTY); | 857 | PAGECACHE_TAG_DIRTY); |
diff --git a/fs/char_dev.c b/fs/char_dev.c index f3418f7a6e9d..a4cbc6706ef0 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -4,7 +4,6 @@ | |||
4 | * Copyright (C) 1991, 1992 Linus Torvalds | 4 | * Copyright (C) 1991, 1992 Linus Torvalds |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/init.h> | 7 | #include <linux/init.h> |
9 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
10 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
@@ -14,7 +13,6 @@ | |||
14 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
16 | #include <linux/smp_lock.h> | 15 | #include <linux/smp_lock.h> |
17 | #include <linux/devfs_fs_kernel.h> | ||
18 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
19 | 17 | ||
20 | #include <linux/kobject.h> | 18 | #include <linux/kobject.h> |
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index 031cdf293256..2e75883b7f54 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -17,7 +17,6 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/config.h> | ||
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
22 | #include <linux/types.h> | 21 | #include <linux/types.h> |
23 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5861eb42e626..944d2b9e092d 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -324,7 +324,7 @@ out: | |||
324 | return rc; | 324 | return rc; |
325 | } | 325 | } |
326 | 326 | ||
327 | /* Try to reaquire byte range locks that were released when session */ | 327 | /* Try to reacquire byte range locks that were released when session */ |
328 | /* to server was lost */ | 328 | /* to server was lost */ |
329 | static int cifs_relock_file(struct cifsFileInfo *cifsFile) | 329 | static int cifs_relock_file(struct cifsFileInfo *cifsFile) |
330 | { | 330 | { |
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 7caee8d8ea3b..803aacf0d49c 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/skbuff.h> | 29 | #include <linux/skbuff.h> |
30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
31 | #include <linux/devfs_fs_kernel.h> | ||
32 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
33 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
34 | #include <linux/file.h> | 33 | #include <linux/file.h> |
@@ -365,22 +364,12 @@ static int init_coda_psdev(void) | |||
365 | err = PTR_ERR(coda_psdev_class); | 364 | err = PTR_ERR(coda_psdev_class); |
366 | goto out_chrdev; | 365 | goto out_chrdev; |
367 | } | 366 | } |
368 | devfs_mk_dir ("coda"); | 367 | for (i = 0; i < MAX_CODADEVS; i++) |
369 | for (i = 0; i < MAX_CODADEVS; i++) { | ||
370 | class_device_create(coda_psdev_class, NULL, | 368 | class_device_create(coda_psdev_class, NULL, |
371 | MKDEV(CODA_PSDEV_MAJOR,i), NULL, "cfs%d", i); | 369 | MKDEV(CODA_PSDEV_MAJOR,i), NULL, "cfs%d", i); |
372 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), | ||
373 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); | ||
374 | if (err) | ||
375 | goto out_class; | ||
376 | } | ||
377 | coda_sysctl_init(); | 370 | coda_sysctl_init(); |
378 | goto out; | 371 | goto out; |
379 | 372 | ||
380 | out_class: | ||
381 | for (i = 0; i < MAX_CODADEVS; i++) | ||
382 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); | ||
383 | class_destroy(coda_psdev_class); | ||
384 | out_chrdev: | 373 | out_chrdev: |
385 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 374 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
386 | out: | 375 | out: |
@@ -419,12 +408,9 @@ static int __init init_coda(void) | |||
419 | } | 408 | } |
420 | return 0; | 409 | return 0; |
421 | out: | 410 | out: |
422 | for (i = 0; i < MAX_CODADEVS; i++) { | 411 | for (i = 0; i < MAX_CODADEVS; i++) |
423 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); | 412 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
424 | devfs_remove("coda/%d", i); | ||
425 | } | ||
426 | class_destroy(coda_psdev_class); | 413 | class_destroy(coda_psdev_class); |
427 | devfs_remove("coda"); | ||
428 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 414 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
429 | coda_sysctl_clean(); | 415 | coda_sysctl_clean(); |
430 | out1: | 416 | out1: |
@@ -441,12 +427,9 @@ static void __exit exit_coda(void) | |||
441 | if ( err != 0 ) { | 427 | if ( err != 0 ) { |
442 | printk("coda: failed to unregister filesystem\n"); | 428 | printk("coda: failed to unregister filesystem\n"); |
443 | } | 429 | } |
444 | for (i = 0; i < MAX_CODADEVS; i++) { | 430 | for (i = 0; i < MAX_CODADEVS; i++) |
445 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); | 431 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
446 | devfs_remove("coda/%d", i); | ||
447 | } | ||
448 | class_destroy(coda_psdev_class); | 432 | class_destroy(coda_psdev_class); |
449 | devfs_remove("coda"); | ||
450 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 433 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
451 | coda_sysctl_clean(); | 434 | coda_sysctl_clean(); |
452 | coda_destroy_inodecache(); | 435 | coda_destroy_inodecache(); |
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index f0b10757288f..1c82e9a7d7c8 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/time.h> | 14 | #include <linux/time.h> |
16 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
17 | #include <linux/sysctl.h> | 16 | #include <linux/sysctl.h> |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index d8ecfedef189..4063a9396977 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * ioctls. | 10 | * ioctls. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/types.h> | 13 | #include <linux/types.h> |
15 | #include <linux/compat.h> | 14 | #include <linux/compat.h> |
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
@@ -44,7 +43,6 @@ | |||
44 | #include <linux/loop.h> | 43 | #include <linux/loop.h> |
45 | #include <linux/auto_fs.h> | 44 | #include <linux/auto_fs.h> |
46 | #include <linux/auto_fs4.h> | 45 | #include <linux/auto_fs4.h> |
47 | #include <linux/devfs_fs.h> | ||
48 | #include <linux/tty.h> | 46 | #include <linux/tty.h> |
49 | #include <linux/vt_kern.h> | 47 | #include <linux/vt_kern.h> |
50 | #include <linux/fb.h> | 48 | #include <linux/fb.h> |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 207f8006fd6c..df025453dd97 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -211,7 +211,7 @@ static void remove_dir(struct dentry * d) | |||
211 | struct configfs_dirent * sd; | 211 | struct configfs_dirent * sd; |
212 | 212 | ||
213 | sd = d->d_fsdata; | 213 | sd = d->d_fsdata; |
214 | list_del_init(&sd->s_sibling); | 214 | list_del_init(&sd->s_sibling); |
215 | configfs_put(sd); | 215 | configfs_put(sd); |
216 | if (d->d_inode) | 216 | if (d->d_inode) |
217 | simple_rmdir(parent->d_inode,d); | 217 | simple_rmdir(parent->d_inode,d); |
@@ -330,7 +330,7 @@ static int configfs_detach_prep(struct dentry *dentry) | |||
330 | 330 | ||
331 | ret = configfs_detach_prep(sd->s_dentry); | 331 | ret = configfs_detach_prep(sd->s_dentry); |
332 | if (!ret) | 332 | if (!ret) |
333 | continue; | 333 | continue; |
334 | } else | 334 | } else |
335 | ret = -ENOTEMPTY; | 335 | ret = -ENOTEMPTY; |
336 | 336 | ||
@@ -931,7 +931,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name) | |||
931 | 931 | ||
932 | new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); | 932 | new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); |
933 | if (!IS_ERR(new_dentry)) { | 933 | if (!IS_ERR(new_dentry)) { |
934 | if (!new_dentry->d_inode) { | 934 | if (!new_dentry->d_inode) { |
935 | error = config_item_set_name(item, "%s", new_name); | 935 | error = config_item_set_name(item, "%s", new_name); |
936 | if (!error) { | 936 | if (!error) { |
937 | d_add(new_dentry, NULL); | 937 | d_add(new_dentry, NULL); |
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index e5512e295cf2..fb65e0800a86 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c | |||
@@ -66,7 +66,7 @@ static void fill_item_path(struct config_item * item, char * buffer, int length) | |||
66 | } | 66 | } |
67 | 67 | ||
68 | static int create_link(struct config_item *parent_item, | 68 | static int create_link(struct config_item *parent_item, |
69 | struct config_item *item, | 69 | struct config_item *item, |
70 | struct dentry *dentry) | 70 | struct dentry *dentry) |
71 | { | 71 | { |
72 | struct configfs_dirent *target_sd = item->ci_dentry->d_fsdata; | 72 | struct configfs_dirent *target_sd = item->ci_dentry->d_fsdata; |
diff --git a/fs/dcache.c b/fs/dcache.c index 48b44a714b35..c6e3535be192 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -14,7 +14,6 @@ | |||
14 | * the dcache entry is deleted or garbage collected. | 14 | * the dcache entry is deleted or garbage collected. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/syscalls.h> | 17 | #include <linux/syscalls.h> |
19 | #include <linux/string.h> | 18 | #include <linux/string.h> |
20 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
diff --git a/fs/dcookies.c b/fs/dcookies.c index 8749339bf4f6..0c4b0674854b 100644 --- a/fs/dcookies.c +++ b/fs/dcookies.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * to the pair and can be looked up from userspace. | 12 | * to the pair and can be looked up from userspace. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 66a505422e5c..39640fd03458 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -13,7 +13,6 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/config.h> | ||
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
19 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 6fa1e04f8415..e8ae3042b806 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -16,7 +16,6 @@ | |||
16 | /* uncomment to get debug messages from the debug filesystem, ah the irony. */ | 16 | /* uncomment to get debug messages from the debug filesystem, ah the irony. */ |
17 | /* #define DEBUG */ | 17 | /* #define DEBUG */ |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
22 | #include <linux/mount.h> | 21 | #include <linux/mount.h> |
diff --git a/fs/devfs/Makefile b/fs/devfs/Makefile deleted file mode 100644 index 6dd8d1245e2c..000000000000 --- a/fs/devfs/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the linux devfs-filesystem routines. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_DEVFS_FS) += devfs.o | ||
6 | |||
7 | devfs-objs := base.o util.o | ||
8 | |||
diff --git a/fs/devfs/base.c b/fs/devfs/base.c deleted file mode 100644 index 51a97f132745..000000000000 --- a/fs/devfs/base.c +++ /dev/null | |||
@@ -1,2836 +0,0 @@ | |||
1 | /* devfs (Device FileSystem) driver. | ||
2 | |||
3 | Copyright (C) 1998-2002 Richard Gooch | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Library General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public | ||
16 | License along with this library; if not, write to the Free | ||
17 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | |||
19 | Richard Gooch may be reached by email at rgooch@atnf.csiro.au | ||
20 | The postal address is: | ||
21 | Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. | ||
22 | |||
23 | ChangeLog | ||
24 | |||
25 | 19980110 Richard Gooch <rgooch@atnf.csiro.au> | ||
26 | Original version. | ||
27 | v0.1 | ||
28 | 19980111 Richard Gooch <rgooch@atnf.csiro.au> | ||
29 | Created per-fs inode table rather than using inode->u.generic_ip | ||
30 | v0.2 | ||
31 | 19980111 Richard Gooch <rgooch@atnf.csiro.au> | ||
32 | Created .epoch inode which has a ctime of 0. | ||
33 | Fixed loss of named pipes when dentries lost. | ||
34 | Fixed loss of inode data when devfs_register() follows mknod(). | ||
35 | v0.3 | ||
36 | 19980111 Richard Gooch <rgooch@atnf.csiro.au> | ||
37 | Fix for when compiling with CONFIG_KERNELD. | ||
38 | 19980112 Richard Gooch <rgooch@atnf.csiro.au> | ||
39 | Fix for readdir() which sometimes didn't show entries. | ||
40 | Added <<tolerant>> option to <devfs_register>. | ||
41 | v0.4 | ||
42 | 19980113 Richard Gooch <rgooch@atnf.csiro.au> | ||
43 | Created <devfs_fill_file> function. | ||
44 | v0.5 | ||
45 | 19980115 Richard Gooch <rgooch@atnf.csiro.au> | ||
46 | Added subdirectory support. Major restructuring. | ||
47 | 19980116 Richard Gooch <rgooch@atnf.csiro.au> | ||
48 | Fixed <find_by_dev> to not search major=0,minor=0. | ||
49 | Added symlink support. | ||
50 | v0.6 | ||
51 | 19980120 Richard Gooch <rgooch@atnf.csiro.au> | ||
52 | Created <devfs_mk_dir> function and support directory unregister | ||
53 | 19980120 Richard Gooch <rgooch@atnf.csiro.au> | ||
54 | Auto-ownership uses real uid/gid rather than effective uid/gid. | ||
55 | v0.7 | ||
56 | 19980121 Richard Gooch <rgooch@atnf.csiro.au> | ||
57 | Supported creation of sockets. | ||
58 | v0.8 | ||
59 | 19980122 Richard Gooch <rgooch@atnf.csiro.au> | ||
60 | Added DEVFS_FL_HIDE_UNREG flag. | ||
61 | Interface change to <devfs_mk_symlink>. | ||
62 | Created <devfs_symlink> to support symlink(2). | ||
63 | v0.9 | ||
64 | 19980123 Richard Gooch <rgooch@atnf.csiro.au> | ||
65 | Added check to <devfs_fill_file> to check inode is in devfs. | ||
66 | Added optional traversal of symlinks. | ||
67 | v0.10 | ||
68 | 19980124 Richard Gooch <rgooch@atnf.csiro.au> | ||
69 | Created <devfs_get_flags> and <devfs_set_flags>. | ||
70 | v0.11 | ||
71 | 19980125 C. Scott Ananian <cananian@alumni.princeton.edu> | ||
72 | Created <devfs_find_handle>. | ||
73 | 19980125 Richard Gooch <rgooch@atnf.csiro.au> | ||
74 | Allow removal of symlinks. | ||
75 | v0.12 | ||
76 | 19980125 Richard Gooch <rgooch@atnf.csiro.au> | ||
77 | Created <devfs_set_symlink_destination>. | ||
78 | 19980126 Richard Gooch <rgooch@atnf.csiro.au> | ||
79 | Moved DEVFS_SUPER_MAGIC into header file. | ||
80 | Added DEVFS_FL_HIDE flag. | ||
81 | Created <devfs_get_maj_min>. | ||
82 | Created <devfs_get_handle_from_inode>. | ||
83 | Fixed minor bug in <find_by_dev>. | ||
84 | 19980127 Richard Gooch <rgooch@atnf.csiro.au> | ||
85 | Changed interface to <find_by_dev>, <find_entry>, | ||
86 | <devfs_unregister>, <devfs_fill_file> and <devfs_find_handle>. | ||
87 | Fixed inode times when symlink created with symlink(2). | ||
88 | v0.13 | ||
89 | 19980129 C. Scott Ananian <cananian@alumni.princeton.edu> | ||
90 | Exported <devfs_set_symlink_destination>, <devfs_get_maj_min> | ||
91 | and <devfs_get_handle_from_inode>. | ||
92 | 19980129 Richard Gooch <rgooch@atnf.csiro.au> | ||
93 | Created <devfs_unlink> to support unlink(2). | ||
94 | v0.14 | ||
95 | 19980129 Richard Gooch <rgooch@atnf.csiro.au> | ||
96 | Fixed kerneld support for entries in devfs subdirectories. | ||
97 | 19980130 Richard Gooch <rgooch@atnf.csiro.au> | ||
98 | Bugfixes in <call_kerneld>. | ||
99 | v0.15 | ||
100 | 19980207 Richard Gooch <rgooch@atnf.csiro.au> | ||
101 | Call kerneld when looking up unregistered entries. | ||
102 | v0.16 | ||
103 | 19980326 Richard Gooch <rgooch@atnf.csiro.au> | ||
104 | Modified interface to <devfs_find_handle> for symlink traversal. | ||
105 | v0.17 | ||
106 | 19980331 Richard Gooch <rgooch@atnf.csiro.au> | ||
107 | Fixed persistence bug with device numbers for manually created | ||
108 | device files. | ||
109 | Fixed problem with recreating symlinks with different content. | ||
110 | v0.18 | ||
111 | 19980401 Richard Gooch <rgooch@atnf.csiro.au> | ||
112 | Changed to CONFIG_KMOD. | ||
113 | Hide entries which are manually unlinked. | ||
114 | Always invalidate devfs dentry cache when registering entries. | ||
115 | Created <devfs_rmdir> to support rmdir(2). | ||
116 | Ensure directories created by <devfs_mk_dir> are visible. | ||
117 | v0.19 | ||
118 | 19980402 Richard Gooch <rgooch@atnf.csiro.au> | ||
119 | Invalidate devfs dentry cache when making directories. | ||
120 | Invalidate devfs dentry cache when removing entries. | ||
121 | Fixed persistence bug with fifos. | ||
122 | v0.20 | ||
123 | 19980421 Richard Gooch <rgooch@atnf.csiro.au> | ||
124 | Print process command when debugging kerneld/kmod. | ||
125 | Added debugging for register/unregister/change operations. | ||
126 | 19980422 Richard Gooch <rgooch@atnf.csiro.au> | ||
127 | Added "devfs=" boot options. | ||
128 | v0.21 | ||
129 | 19980426 Richard Gooch <rgooch@atnf.csiro.au> | ||
130 | No longer lock/unlock superblock in <devfs_put_super>. | ||
131 | Drop negative dentries when they are released. | ||
132 | Manage dcache more efficiently. | ||
133 | v0.22 | ||
134 | 19980427 Richard Gooch <rgooch@atnf.csiro.au> | ||
135 | Added DEVFS_FL_AUTO_DEVNUM flag. | ||
136 | v0.23 | ||
137 | 19980430 Richard Gooch <rgooch@atnf.csiro.au> | ||
138 | No longer set unnecessary methods. | ||
139 | v0.24 | ||
140 | 19980504 Richard Gooch <rgooch@atnf.csiro.au> | ||
141 | Added PID display to <call_kerneld> debugging message. | ||
142 | Added "after" debugging message to <call_kerneld>. | ||
143 | 19980519 Richard Gooch <rgooch@atnf.csiro.au> | ||
144 | Added "diread" and "diwrite" boot options. | ||
145 | 19980520 Richard Gooch <rgooch@atnf.csiro.au> | ||
146 | Fixed persistence problem with permissions. | ||
147 | v0.25 | ||
148 | 19980602 Richard Gooch <rgooch@atnf.csiro.au> | ||
149 | Support legacy device nodes. | ||
150 | Fixed bug where recreated inodes were hidden. | ||
151 | v0.26 | ||
152 | 19980602 Richard Gooch <rgooch@atnf.csiro.au> | ||
153 | Improved debugging in <get_vfs_inode>. | ||
154 | 19980607 Richard Gooch <rgooch@atnf.csiro.au> | ||
155 | No longer free old dentries in <devfs_mk_dir>. | ||
156 | Free all dentries for a given entry when deleting inodes. | ||
157 | v0.27 | ||
158 | 19980627 Richard Gooch <rgooch@atnf.csiro.au> | ||
159 | Limit auto-device numbering to majors 128 to 239. | ||
160 | v0.28 | ||
161 | 19980629 Richard Gooch <rgooch@atnf.csiro.au> | ||
162 | Fixed inode times persistence problem. | ||
163 | v0.29 | ||
164 | 19980704 Richard Gooch <rgooch@atnf.csiro.au> | ||
165 | Fixed spelling in <devfs_readlink> debug. | ||
166 | Fixed bug in <devfs_setup> parsing "dilookup". | ||
167 | v0.30 | ||
168 | 19980705 Richard Gooch <rgooch@atnf.csiro.au> | ||
169 | Fixed devfs inode leak when manually recreating inodes. | ||
170 | Fixed permission persistence problem when recreating inodes. | ||
171 | v0.31 | ||
172 | 19980727 Richard Gooch <rgooch@atnf.csiro.au> | ||
173 | Removed harmless "unused variable" compiler warning. | ||
174 | Fixed modes for manually recreated device nodes. | ||
175 | v0.32 | ||
176 | 19980728 Richard Gooch <rgooch@atnf.csiro.au> | ||
177 | Added NULL devfs inode warning in <devfs_read_inode>. | ||
178 | Force all inode nlink values to 1. | ||
179 | v0.33 | ||
180 | 19980730 Richard Gooch <rgooch@atnf.csiro.au> | ||
181 | Added "dimknod" boot option. | ||
182 | Set inode nlink to 0 when freeing dentries. | ||
183 | Fixed modes for manually recreated symlinks. | ||
184 | v0.34 | ||
185 | 19980802 Richard Gooch <rgooch@atnf.csiro.au> | ||
186 | Fixed bugs in recreated directories and symlinks. | ||
187 | v0.35 | ||
188 | 19980806 Richard Gooch <rgooch@atnf.csiro.au> | ||
189 | Fixed bugs in recreated device nodes. | ||
190 | 19980807 Richard Gooch <rgooch@atnf.csiro.au> | ||
191 | Fixed bug in currently unused <devfs_get_handle_from_inode>. | ||
192 | Defined new <devfs_handle_t> type. | ||
193 | Improved debugging when getting entries. | ||
194 | Fixed bug where directories could be emptied. | ||
195 | v0.36 | ||
196 | 19980809 Richard Gooch <rgooch@atnf.csiro.au> | ||
197 | Replaced dummy .epoch inode with .devfsd character device. | ||
198 | 19980810 Richard Gooch <rgooch@atnf.csiro.au> | ||
199 | Implemented devfsd protocol revision 0. | ||
200 | v0.37 | ||
201 | 19980819 Richard Gooch <rgooch@atnf.csiro.au> | ||
202 | Added soothing message to warning in <devfs_d_iput>. | ||
203 | v0.38 | ||
204 | 19980829 Richard Gooch <rgooch@atnf.csiro.au> | ||
205 | Use GCC extensions for structure initialisations. | ||
206 | Implemented async open notification. | ||
207 | Incremented devfsd protocol revision to 1. | ||
208 | v0.39 | ||
209 | 19980908 Richard Gooch <rgooch@atnf.csiro.au> | ||
210 | Moved async open notification to end of <devfs_open>. | ||
211 | v0.40 | ||
212 | 19980910 Richard Gooch <rgooch@atnf.csiro.au> | ||
213 | Prepended "/dev/" to module load request. | ||
214 | Renamed <call_kerneld> to <call_kmod>. | ||
215 | v0.41 | ||
216 | 19980910 Richard Gooch <rgooch@atnf.csiro.au> | ||
217 | Fixed typo "AYSNC" -> "ASYNC". | ||
218 | v0.42 | ||
219 | 19980910 Richard Gooch <rgooch@atnf.csiro.au> | ||
220 | Added open flag for files. | ||
221 | v0.43 | ||
222 | 19980927 Richard Gooch <rgooch@atnf.csiro.au> | ||
223 | Set i_blocks=0 and i_blksize=1024 in <devfs_read_inode>. | ||
224 | v0.44 | ||
225 | 19981005 Richard Gooch <rgooch@atnf.csiro.au> | ||
226 | Added test for empty <<name>> in <devfs_find_handle>. | ||
227 | Renamed <generate_path> to <devfs_generate_path> and published. | ||
228 | v0.45 | ||
229 | 19981006 Richard Gooch <rgooch@atnf.csiro.au> | ||
230 | Created <devfs_get_fops>. | ||
231 | v0.46 | ||
232 | 19981007 Richard Gooch <rgooch@atnf.csiro.au> | ||
233 | Limit auto-device numbering to majors 144 to 239. | ||
234 | v0.47 | ||
235 | 19981010 Richard Gooch <rgooch@atnf.csiro.au> | ||
236 | Updated <devfs_follow_link> for VFS change in 2.1.125. | ||
237 | v0.48 | ||
238 | 19981022 Richard Gooch <rgooch@atnf.csiro.au> | ||
239 | Created DEVFS_ FL_COMPAT flag. | ||
240 | v0.49 | ||
241 | 19981023 Richard Gooch <rgooch@atnf.csiro.au> | ||
242 | Created "nocompat" boot option. | ||
243 | v0.50 | ||
244 | 19981025 Richard Gooch <rgooch@atnf.csiro.au> | ||
245 | Replaced "mount" boot option with "nomount". | ||
246 | v0.51 | ||
247 | 19981110 Richard Gooch <rgooch@atnf.csiro.au> | ||
248 | Created "only" boot option. | ||
249 | v0.52 | ||
250 | 19981112 Richard Gooch <rgooch@atnf.csiro.au> | ||
251 | Added DEVFS_FL_REMOVABLE flag. | ||
252 | v0.53 | ||
253 | 19981114 Richard Gooch <rgooch@atnf.csiro.au> | ||
254 | Only call <scan_dir_for_removable> on first call to | ||
255 | <devfs_readdir>. | ||
256 | v0.54 | ||
257 | 19981205 Richard Gooch <rgooch@atnf.csiro.au> | ||
258 | Updated <devfs_rmdir> for VFS change in 2.1.131. | ||
259 | v0.55 | ||
260 | 19981218 Richard Gooch <rgooch@atnf.csiro.au> | ||
261 | Created <devfs_mk_compat>. | ||
262 | 19981220 Richard Gooch <rgooch@atnf.csiro.au> | ||
263 | Check for partitions on removable media in <devfs_lookup>. | ||
264 | v0.56 | ||
265 | 19990118 Richard Gooch <rgooch@atnf.csiro.au> | ||
266 | Added support for registering regular files. | ||
267 | Created <devfs_set_file_size>. | ||
268 | Update devfs inodes from entries if not changed through FS. | ||
269 | v0.57 | ||
270 | 19990124 Richard Gooch <rgooch@atnf.csiro.au> | ||
271 | Fixed <devfs_fill_file> to only initialise temporary inodes. | ||
272 | Trap for NULL fops in <devfs_register>. | ||
273 | Return -ENODEV in <devfs_fill_file> for non-driver inodes. | ||
274 | v0.58 | ||
275 | 19990126 Richard Gooch <rgooch@atnf.csiro.au> | ||
276 | Switched from PATH_MAX to DEVFS_PATHLEN. | ||
277 | v0.59 | ||
278 | 19990127 Richard Gooch <rgooch@atnf.csiro.au> | ||
279 | Created "nottycompat" boot option. | ||
280 | v0.60 | ||
281 | 19990318 Richard Gooch <rgooch@atnf.csiro.au> | ||
282 | Fixed <devfsd_read> to not overrun event buffer. | ||
283 | v0.61 | ||
284 | 19990329 Richard Gooch <rgooch@atnf.csiro.au> | ||
285 | Created <devfs_auto_unregister>. | ||
286 | v0.62 | ||
287 | 19990330 Richard Gooch <rgooch@atnf.csiro.au> | ||
288 | Don't return unregistred entries in <devfs_find_handle>. | ||
289 | Panic in <devfs_unregister> if entry unregistered. | ||
290 | 19990401 Richard Gooch <rgooch@atnf.csiro.au> | ||
291 | Don't panic in <devfs_auto_unregister> for duplicates. | ||
292 | v0.63 | ||
293 | 19990402 Richard Gooch <rgooch@atnf.csiro.au> | ||
294 | Don't unregister already unregistered entries in <unregister>. | ||
295 | v0.64 | ||
296 | 19990510 Richard Gooch <rgooch@atnf.csiro.au> | ||
297 | Disable warning messages when unable to read partition table for | ||
298 | removable media. | ||
299 | v0.65 | ||
300 | 19990512 Richard Gooch <rgooch@atnf.csiro.au> | ||
301 | Updated <devfs_lookup> for VFS change in 2.3.1-pre1. | ||
302 | Created "oops-on-panic" boot option. | ||
303 | Improved debugging in <devfs_register> and <devfs_unregister>. | ||
304 | v0.66 | ||
305 | 19990519 Richard Gooch <rgooch@atnf.csiro.au> | ||
306 | Added documentation for some functions. | ||
307 | 19990525 Richard Gooch <rgooch@atnf.csiro.au> | ||
308 | Removed "oops-on-panic" boot option: now always Oops. | ||
309 | v0.67 | ||
310 | 19990531 Richard Gooch <rgooch@atnf.csiro.au> | ||
311 | Improved debugging in <devfs_register>. | ||
312 | v0.68 | ||
313 | 19990604 Richard Gooch <rgooch@atnf.csiro.au> | ||
314 | Added "diunlink" and "nokmod" boot options. | ||
315 | Removed superfluous warning message in <devfs_d_iput>. | ||
316 | v0.69 | ||
317 | 19990611 Richard Gooch <rgooch@atnf.csiro.au> | ||
318 | Took account of change to <d_alloc_root>. | ||
319 | v0.70 | ||
320 | 19990614 Richard Gooch <rgooch@atnf.csiro.au> | ||
321 | Created separate event queue for each mounted devfs. | ||
322 | Removed <devfs_invalidate_dcache>. | ||
323 | Created new ioctl()s. | ||
324 | Incremented devfsd protocol revision to 3. | ||
325 | Fixed bug when re-creating directories: contents were lost. | ||
326 | Block access to inodes until devfsd updates permissions. | ||
327 | 19990615 Richard Gooch <rgooch@atnf.csiro.au> | ||
328 | Support 2.2.x kernels. | ||
329 | v0.71 | ||
330 | 19990623 Richard Gooch <rgooch@atnf.csiro.au> | ||
331 | Switched to sending process uid/gid to devfsd. | ||
332 | Renamed <call_kmod> to <try_modload>. | ||
333 | Added DEVFSD_NOTIFY_LOOKUP event. | ||
334 | 19990624 Richard Gooch <rgooch@atnf.csiro.au> | ||
335 | Added DEVFSD_NOTIFY_CHANGE event. | ||
336 | Incremented devfsd protocol revision to 4. | ||
337 | v0.72 | ||
338 | 19990713 Richard Gooch <rgooch@atnf.csiro.au> | ||
339 | Return EISDIR rather than EINVAL for read(2) on directories. | ||
340 | v0.73 | ||
341 | 19990809 Richard Gooch <rgooch@atnf.csiro.au> | ||
342 | Changed <devfs_setup> to new __init scheme. | ||
343 | v0.74 | ||
344 | 19990901 Richard Gooch <rgooch@atnf.csiro.au> | ||
345 | Changed remaining function declarations to new __init scheme. | ||
346 | v0.75 | ||
347 | 19991013 Richard Gooch <rgooch@atnf.csiro.au> | ||
348 | Created <devfs_get_info>, <devfs_set_info>, | ||
349 | <devfs_get_first_child> and <devfs_get_next_sibling>. | ||
350 | Added <<dir>> parameter to <devfs_register>, <devfs_mk_compat>, | ||
351 | <devfs_mk_dir> and <devfs_find_handle>. | ||
352 | Work sponsored by SGI. | ||
353 | v0.76 | ||
354 | 19991017 Richard Gooch <rgooch@atnf.csiro.au> | ||
355 | Allow multiple unregistrations. | ||
356 | Work sponsored by SGI. | ||
357 | v0.77 | ||
358 | 19991026 Richard Gooch <rgooch@atnf.csiro.au> | ||
359 | Added major and minor number to devfsd protocol. | ||
360 | Incremented devfsd protocol revision to 5. | ||
361 | Work sponsored by SGI. | ||
362 | v0.78 | ||
363 | 19991030 Richard Gooch <rgooch@atnf.csiro.au> | ||
364 | Support info pointer for all devfs entry types. | ||
365 | Added <<info>> parameter to <devfs_mk_dir> and | ||
366 | <devfs_mk_symlink>. | ||
367 | Work sponsored by SGI. | ||
368 | v0.79 | ||
369 | 19991031 Richard Gooch <rgooch@atnf.csiro.au> | ||
370 | Support "../" when searching devfs namespace. | ||
371 | Work sponsored by SGI. | ||
372 | v0.80 | ||
373 | 19991101 Richard Gooch <rgooch@atnf.csiro.au> | ||
374 | Created <devfs_get_unregister_slave>. | ||
375 | Work sponsored by SGI. | ||
376 | v0.81 | ||
377 | 19991103 Richard Gooch <rgooch@atnf.csiro.au> | ||
378 | Exported <devfs_get_parent>. | ||
379 | Work sponsored by SGI. | ||
380 | v0.82 | ||
381 | 19991104 Richard Gooch <rgooch@atnf.csiro.au> | ||
382 | Removed unused <devfs_set_symlink_destination>. | ||
383 | 19991105 Richard Gooch <rgooch@atnf.csiro.au> | ||
384 | Do not hide entries from devfsd or children. | ||
385 | Removed DEVFS_ FL_TTY_COMPAT flag. | ||
386 | Removed "nottycompat" boot option. | ||
387 | Removed <devfs_mk_compat>. | ||
388 | Work sponsored by SGI. | ||
389 | v0.83 | ||
390 | 19991107 Richard Gooch <rgooch@atnf.csiro.au> | ||
391 | Added DEVFS_FL_WAIT flag. | ||
392 | Work sponsored by SGI. | ||
393 | v0.84 | ||
394 | 19991107 Richard Gooch <rgooch@atnf.csiro.au> | ||
395 | Support new "disc" naming scheme in <get_removable_partition>. | ||
396 | Allow NULL fops in <devfs_register>. | ||
397 | Work sponsored by SGI. | ||
398 | v0.85 | ||
399 | 19991110 Richard Gooch <rgooch@atnf.csiro.au> | ||
400 | Fall back to major table if NULL fops given to <devfs_register>. | ||
401 | Work sponsored by SGI. | ||
402 | v0.86 | ||
403 | 19991204 Richard Gooch <rgooch@atnf.csiro.au> | ||
404 | Support fifos when unregistering. | ||
405 | Work sponsored by SGI. | ||
406 | v0.87 | ||
407 | 19991209 Richard Gooch <rgooch@atnf.csiro.au> | ||
408 | Removed obsolete DEVFS_ FL_COMPAT and DEVFS_ FL_TOLERANT flags. | ||
409 | Work sponsored by SGI. | ||
410 | v0.88 | ||
411 | 19991214 Richard Gooch <rgooch@atnf.csiro.au> | ||
412 | Removed kmod support. | ||
413 | Work sponsored by SGI. | ||
414 | v0.89 | ||
415 | 19991216 Richard Gooch <rgooch@atnf.csiro.au> | ||
416 | Improved debugging in <get_vfs_inode>. | ||
417 | Ensure dentries created by devfsd will be cleaned up. | ||
418 | Work sponsored by SGI. | ||
419 | v0.90 | ||
420 | 19991223 Richard Gooch <rgooch@atnf.csiro.au> | ||
421 | Created <devfs_get_name>. | ||
422 | Work sponsored by SGI. | ||
423 | v0.91 | ||
424 | 20000203 Richard Gooch <rgooch@atnf.csiro.au> | ||
425 | Ported to kernel 2.3.42. | ||
426 | Removed <devfs_fill_file>. | ||
427 | Work sponsored by SGI. | ||
428 | v0.92 | ||
429 | 20000306 Richard Gooch <rgooch@atnf.csiro.au> | ||
430 | Added DEVFS_ FL_NO_PERSISTENCE flag. | ||
431 | Removed unnecessary call to <update_devfs_inode_from_entry> in | ||
432 | <devfs_readdir>. | ||
433 | Work sponsored by SGI. | ||
434 | v0.93 | ||
435 | 20000413 Richard Gooch <rgooch@atnf.csiro.au> | ||
436 | Set inode->i_size to correct size for symlinks. | ||
437 | 20000414 Richard Gooch <rgooch@atnf.csiro.au> | ||
438 | Only give lookup() method to directories to comply with new VFS | ||
439 | assumptions. | ||
440 | Work sponsored by SGI. | ||
441 | 20000415 Richard Gooch <rgooch@atnf.csiro.au> | ||
442 | Remove unnecessary tests in symlink methods. | ||
443 | Don't kill existing block ops in <devfs_read_inode>. | ||
444 | Work sponsored by SGI. | ||
445 | v0.94 | ||
446 | 20000424 Richard Gooch <rgooch@atnf.csiro.au> | ||
447 | Don't create missing directories in <devfs_find_handle>. | ||
448 | Work sponsored by SGI. | ||
449 | v0.95 | ||
450 | 20000430 Richard Gooch <rgooch@atnf.csiro.au> | ||
451 | Added CONFIG_DEVFS_MOUNT. | ||
452 | Work sponsored by SGI. | ||
453 | v0.96 | ||
454 | 20000608 Richard Gooch <rgooch@atnf.csiro.au> | ||
455 | Disabled multi-mount capability (use VFS bindings instead). | ||
456 | Work sponsored by SGI. | ||
457 | v0.97 | ||
458 | 20000610 Richard Gooch <rgooch@atnf.csiro.au> | ||
459 | Switched to FS_SINGLE to disable multi-mounts. | ||
460 | 20000612 Richard Gooch <rgooch@atnf.csiro.au> | ||
461 | Removed module support. | ||
462 | Removed multi-mount code. | ||
463 | Removed compatibility macros: VFS has changed too much. | ||
464 | Work sponsored by SGI. | ||
465 | v0.98 | ||
466 | 20000614 Richard Gooch <rgooch@atnf.csiro.au> | ||
467 | Merged devfs inode into devfs entry. | ||
468 | Work sponsored by SGI. | ||
469 | v0.99 | ||
470 | 20000619 Richard Gooch <rgooch@atnf.csiro.au> | ||
471 | Removed dead code in <devfs_register> which used to call | ||
472 | <free_dentries>. | ||
473 | Work sponsored by SGI. | ||
474 | v0.100 | ||
475 | 20000621 Richard Gooch <rgooch@atnf.csiro.au> | ||
476 | Changed interface to <devfs_register>. | ||
477 | Work sponsored by SGI. | ||
478 | v0.101 | ||
479 | 20000622 Richard Gooch <rgooch@atnf.csiro.au> | ||
480 | Simplified interface to <devfs_mk_symlink> and <devfs_mk_dir>. | ||
481 | Simplified interface to <devfs_find_handle>. | ||
482 | Work sponsored by SGI. | ||
483 | v0.102 | ||
484 | 20010519 Richard Gooch <rgooch@atnf.csiro.au> | ||
485 | Ensure <devfs_generate_path> terminates string for root entry. | ||
486 | Exported <devfs_get_name> to modules. | ||
487 | 20010520 Richard Gooch <rgooch@atnf.csiro.au> | ||
488 | Make <devfs_mk_symlink> send events to devfsd. | ||
489 | Cleaned up option processing in <devfs_setup>. | ||
490 | 20010521 Richard Gooch <rgooch@atnf.csiro.au> | ||
491 | Fixed bugs in handling symlinks: could leak or cause Oops. | ||
492 | 20010522 Richard Gooch <rgooch@atnf.csiro.au> | ||
493 | Cleaned up directory handling by separating fops. | ||
494 | v0.103 | ||
495 | 20010601 Richard Gooch <rgooch@atnf.csiro.au> | ||
496 | Fixed handling of inverted options in <devfs_setup>. | ||
497 | v0.104 | ||
498 | 20010604 Richard Gooch <rgooch@atnf.csiro.au> | ||
499 | Adjusted <try_modload> to account for <devfs_generate_path> fix. | ||
500 | v0.105 | ||
501 | 20010617 Richard Gooch <rgooch@atnf.csiro.au> | ||
502 | Answered question posed by Al Viro and removed his comments. | ||
503 | Moved setting of registered flag after other fields are changed. | ||
504 | Fixed race between <devfsd_close> and <devfsd_notify_one>. | ||
505 | Global VFS changes added bogus BKL to <devfsd_close>: removed. | ||
506 | Widened locking in <devfs_readlink> and <devfs_follow_link>. | ||
507 | Replaced <devfsd_read> stack usage with <devfsd_ioctl> kmalloc. | ||
508 | Simplified locking in <devfsd_ioctl> and fixed memory leak. | ||
509 | v0.106 | ||
510 | 20010709 Richard Gooch <rgooch@atnf.csiro.au> | ||
511 | Removed broken devnum allocation and use <devfs_alloc_devnum>. | ||
512 | Fixed old devnum leak by calling new <devfs_dealloc_devnum>. | ||
513 | v0.107 | ||
514 | 20010712 Richard Gooch <rgooch@atnf.csiro.au> | ||
515 | Fixed bug in <devfs_setup> which could hang boot process. | ||
516 | v0.108 | ||
517 | 20010730 Richard Gooch <rgooch@atnf.csiro.au> | ||
518 | Added DEVFSD_NOTIFY_DELETE event. | ||
519 | 20010801 Richard Gooch <rgooch@atnf.csiro.au> | ||
520 | Removed #include <asm/segment.h>. | ||
521 | v0.109 | ||
522 | 20010807 Richard Gooch <rgooch@atnf.csiro.au> | ||
523 | Fixed inode table races by removing it and using | ||
524 | inode->u.generic_ip instead. | ||
525 | Moved <devfs_read_inode> into <get_vfs_inode>. | ||
526 | Moved <devfs_write_inode> into <devfs_notify_change>. | ||
527 | v0.110 | ||
528 | 20010808 Richard Gooch <rgooch@atnf.csiro.au> | ||
529 | Fixed race in <devfs_do_symlink> for uni-processor. | ||
530 | v0.111 | ||
531 | 20010818 Richard Gooch <rgooch@atnf.csiro.au> | ||
532 | Removed remnant of multi-mount support in <devfs_mknod>. | ||
533 | Removed unused DEVFS_FL_SHOW_UNREG flag. | ||
534 | v0.112 | ||
535 | 20010820 Richard Gooch <rgooch@atnf.csiro.au> | ||
536 | Removed nlink field from struct devfs_inode. | ||
537 | v0.113 | ||
538 | 20010823 Richard Gooch <rgooch@atnf.csiro.au> | ||
539 | Replaced BKL with global rwsem to protect symlink data (quick | ||
540 | and dirty hack). | ||
541 | v0.114 | ||
542 | 20010827 Richard Gooch <rgooch@atnf.csiro.au> | ||
543 | Replaced global rwsem for symlink with per-link refcount. | ||
544 | v0.115 | ||
545 | 20010919 Richard Gooch <rgooch@atnf.csiro.au> | ||
546 | Set inode->i_mapping->a_ops for block nodes in <get_vfs_inode>. | ||
547 | v0.116 | ||
548 | 20011008 Richard Gooch <rgooch@atnf.csiro.au> | ||
549 | Fixed overrun in <devfs_link> by removing function (not needed). | ||
550 | 20011009 Richard Gooch <rgooch@atnf.csiro.au> | ||
551 | Fixed buffer underrun in <try_modload>. | ||
552 | 20011029 Richard Gooch <rgooch@atnf.csiro.au> | ||
553 | Fixed race in <devfsd_ioctl> when setting event mask. | ||
554 | 20011114 Richard Gooch <rgooch@atnf.csiro.au> | ||
555 | First release of new locking code. | ||
556 | v1.0 | ||
557 | 20011117 Richard Gooch <rgooch@atnf.csiro.au> | ||
558 | Discard temporary buffer, now use "%s" for dentry names. | ||
559 | 20011118 Richard Gooch <rgooch@atnf.csiro.au> | ||
560 | Don't generate path in <try_modload>: use fake entry instead. | ||
561 | Use "existing" directory in <_devfs_make_parent_for_leaf>. | ||
562 | 20011122 Richard Gooch <rgooch@atnf.csiro.au> | ||
563 | Use slab cache rather than fixed buffer for devfsd events. | ||
564 | v1.1 | ||
565 | 20011125 Richard Gooch <rgooch@atnf.csiro.au> | ||
566 | Send DEVFSD_NOTIFY_REGISTERED events in <devfs_mk_dir>. | ||
567 | 20011127 Richard Gooch <rgooch@atnf.csiro.au> | ||
568 | Fixed locking bug in <devfs_d_revalidate_wait> due to typo. | ||
569 | Do not send CREATE, CHANGE, ASYNC_OPEN or DELETE events from | ||
570 | devfsd or children. | ||
571 | v1.2 | ||
572 | 20011202 Richard Gooch <rgooch@atnf.csiro.au> | ||
573 | Fixed bug in <devfsd_read>: was dereferencing freed pointer. | ||
574 | v1.3 | ||
575 | 20011203 Richard Gooch <rgooch@atnf.csiro.au> | ||
576 | Fixed bug in <devfsd_close>: was dereferencing freed pointer. | ||
577 | Added process group check for devfsd privileges. | ||
578 | v1.4 | ||
579 | 20011204 Richard Gooch <rgooch@atnf.csiro.au> | ||
580 | Use SLAB_ATOMIC in <devfsd_notify_de> from <devfs_d_delete>. | ||
581 | v1.5 | ||
582 | 20011211 Richard Gooch <rgooch@atnf.csiro.au> | ||
583 | Return old entry in <devfs_mk_dir> for 2.4.x kernels. | ||
584 | 20011212 Richard Gooch <rgooch@atnf.csiro.au> | ||
585 | Increment refcount on module in <check_disc_changed>. | ||
586 | 20011215 Richard Gooch <rgooch@atnf.csiro.au> | ||
587 | Created <devfs_get_handle> and exported <devfs_put>. | ||
588 | Increment refcount on module in <devfs_get_ops>. | ||
589 | Created <devfs_put_ops>. | ||
590 | v1.6 | ||
591 | 20011216 Richard Gooch <rgooch@atnf.csiro.au> | ||
592 | Added poisoning to <devfs_put>. | ||
593 | Improved debugging messages. | ||
594 | v1.7 | ||
595 | 20011221 Richard Gooch <rgooch@atnf.csiro.au> | ||
596 | Corrected (made useful) debugging message in <unregister>. | ||
597 | Moved <kmem_cache_create> in <mount_devfs_fs> to <init_devfs_fs> | ||
598 | 20011224 Richard Gooch <rgooch@atnf.csiro.au> | ||
599 | Added magic number to guard against scribbling drivers. | ||
600 | 20011226 Richard Gooch <rgooch@atnf.csiro.au> | ||
601 | Only return old entry in <devfs_mk_dir> if a directory. | ||
602 | Defined macros for error and debug messages. | ||
603 | v1.8 | ||
604 | 20020113 Richard Gooch <rgooch@atnf.csiro.au> | ||
605 | Fixed (rare, old) race in <devfs_lookup>. | ||
606 | v1.9 | ||
607 | 20020120 Richard Gooch <rgooch@atnf.csiro.au> | ||
608 | Fixed deadlock bug in <devfs_d_revalidate_wait>. | ||
609 | Tag VFS deletable in <devfs_mk_symlink> if handle ignored. | ||
610 | v1.10 | ||
611 | 20020129 Richard Gooch <rgooch@atnf.csiro.au> | ||
612 | Added KERN_* to remaining messages. | ||
613 | Cleaned up declaration of <stat_read>. | ||
614 | v1.11 | ||
615 | 20020219 Richard Gooch <rgooch@atnf.csiro.au> | ||
616 | Changed <devfs_rmdir> to allow later additions if not yet empty. | ||
617 | v1.12 | ||
618 | 20020406 Richard Gooch <rgooch@atnf.csiro.au> | ||
619 | Removed silently introduced calls to lock_kernel() and | ||
620 | unlock_kernel() due to recent VFS locking changes. BKL isn't | ||
621 | required in devfs. | ||
622 | v1.13 | ||
623 | 20020428 Richard Gooch <rgooch@atnf.csiro.au> | ||
624 | Removed 2.4.x compatibility code. | ||
625 | v1.14 | ||
626 | 20020510 Richard Gooch <rgooch@atnf.csiro.au> | ||
627 | Added BKL to <devfs_open> because drivers still need it. | ||
628 | v1.15 | ||
629 | 20020512 Richard Gooch <rgooch@atnf.csiro.au> | ||
630 | Protected <scan_dir_for_removable> and <get_removable_partition> | ||
631 | from changing directory contents. | ||
632 | v1.16 | ||
633 | 20020514 Richard Gooch <rgooch@atnf.csiro.au> | ||
634 | Minor cleanup of <scan_dir_for_removable>. | ||
635 | v1.17 | ||
636 | 20020721 Richard Gooch <rgooch@atnf.csiro.au> | ||
637 | Switched to ISO C structure field initialisers. | ||
638 | Switch to set_current_state() and move before add_wait_queue(). | ||
639 | 20020722 Richard Gooch <rgooch@atnf.csiro.au> | ||
640 | Fixed devfs entry leak in <devfs_readdir> when *readdir fails. | ||
641 | v1.18 | ||
642 | 20020725 Richard Gooch <rgooch@atnf.csiro.au> | ||
643 | Created <devfs_find_and_unregister>. | ||
644 | v1.19 | ||
645 | 20020728 Richard Gooch <rgooch@atnf.csiro.au> | ||
646 | Removed deprecated <devfs_find_handle>. | ||
647 | v1.20 | ||
648 | 20020820 Richard Gooch <rgooch@atnf.csiro.au> | ||
649 | Fixed module unload race in <devfs_open>. | ||
650 | v1.21 | ||
651 | 20021013 Richard Gooch <rgooch@atnf.csiro.au> | ||
652 | Removed DEVFS_ FL_AUTO_OWNER. | ||
653 | Switched lingering structure field initialiser to ISO C. | ||
654 | Added locking when updating FCB flags. | ||
655 | v1.22 | ||
656 | */ | ||
657 | #include <linux/types.h> | ||
658 | #include <linux/errno.h> | ||
659 | #include <linux/time.h> | ||
660 | #include <linux/tty.h> | ||
661 | #include <linux/timer.h> | ||
662 | #include <linux/config.h> | ||
663 | #include <linux/kernel.h> | ||
664 | #include <linux/wait.h> | ||
665 | #include <linux/string.h> | ||
666 | #include <linux/slab.h> | ||
667 | #include <linux/ioport.h> | ||
668 | #include <linux/delay.h> | ||
669 | #include <linux/ctype.h> | ||
670 | #include <linux/mm.h> | ||
671 | #include <linux/module.h> | ||
672 | #include <linux/init.h> | ||
673 | #include <linux/devfs_fs.h> | ||
674 | #include <linux/devfs_fs_kernel.h> | ||
675 | #include <linux/smp_lock.h> | ||
676 | #include <linux/smp.h> | ||
677 | #include <linux/rwsem.h> | ||
678 | #include <linux/sched.h> | ||
679 | #include <linux/namei.h> | ||
680 | #include <linux/bitops.h> | ||
681 | |||
682 | #include <asm/uaccess.h> | ||
683 | #include <asm/io.h> | ||
684 | #include <asm/processor.h> | ||
685 | #include <asm/system.h> | ||
686 | #include <asm/pgtable.h> | ||
687 | #include <asm/atomic.h> | ||
688 | |||
689 | #define DEVFS_VERSION "2004-01-31" | ||
690 | |||
691 | #define DEVFS_NAME "devfs" | ||
692 | |||
693 | #define FIRST_INODE 1 | ||
694 | |||
695 | #define STRING_LENGTH 256 | ||
696 | #define FAKE_BLOCK_SIZE 1024 | ||
697 | #define POISON_PTR ( *(void **) poison_array ) | ||
698 | #define MAGIC_VALUE 0x327db823 | ||
699 | |||
700 | #ifndef TRUE | ||
701 | # define TRUE 1 | ||
702 | # define FALSE 0 | ||
703 | #endif | ||
704 | |||
705 | #define MODE_DIR (S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO) | ||
706 | |||
707 | #define DEBUG_NONE 0x0000000 | ||
708 | #define DEBUG_MODULE_LOAD 0x0000001 | ||
709 | #define DEBUG_REGISTER 0x0000002 | ||
710 | #define DEBUG_UNREGISTER 0x0000004 | ||
711 | #define DEBUG_FREE 0x0000008 | ||
712 | #define DEBUG_SET_FLAGS 0x0000010 | ||
713 | #define DEBUG_S_READ 0x0000100 /* Break */ | ||
714 | #define DEBUG_I_LOOKUP 0x0001000 /* Break */ | ||
715 | #define DEBUG_I_CREATE 0x0002000 | ||
716 | #define DEBUG_I_GET 0x0004000 | ||
717 | #define DEBUG_I_CHANGE 0x0008000 | ||
718 | #define DEBUG_I_UNLINK 0x0010000 | ||
719 | #define DEBUG_I_RLINK 0x0020000 | ||
720 | #define DEBUG_I_FLINK 0x0040000 | ||
721 | #define DEBUG_I_MKNOD 0x0080000 | ||
722 | #define DEBUG_F_READDIR 0x0100000 /* Break */ | ||
723 | #define DEBUG_D_DELETE 0x1000000 /* Break */ | ||
724 | #define DEBUG_D_RELEASE 0x2000000 | ||
725 | #define DEBUG_D_IPUT 0x4000000 | ||
726 | #define DEBUG_ALL 0xfffffff | ||
727 | #define DEBUG_DISABLED DEBUG_NONE | ||
728 | |||
729 | #define OPTION_NONE 0x00 | ||
730 | #define OPTION_MOUNT 0x01 | ||
731 | |||
732 | #define PRINTK(format, args...) \ | ||
733 | {printk (KERN_ERR "%s" format, __FUNCTION__ , ## args);} | ||
734 | |||
735 | #define OOPS(format, args...) \ | ||
736 | {printk (KERN_CRIT "%s" format, __FUNCTION__ , ## args); \ | ||
737 | printk ("Forcing Oops\n"); \ | ||
738 | BUG();} | ||
739 | |||
740 | #ifdef CONFIG_DEVFS_DEBUG | ||
741 | # define VERIFY_ENTRY(de) \ | ||
742 | {if ((de) && (de)->magic_number != MAGIC_VALUE) \ | ||
743 | OOPS ("(%p): bad magic value: %x\n", (de), (de)->magic_number);} | ||
744 | # define WRITE_ENTRY_MAGIC(de,magic) (de)->magic_number = (magic) | ||
745 | # define DPRINTK(flag, format, args...) \ | ||
746 | {if (devfs_debug & flag) \ | ||
747 | printk (KERN_INFO "%s" format, __FUNCTION__ , ## args);} | ||
748 | #else | ||
749 | # define VERIFY_ENTRY(de) | ||
750 | # define WRITE_ENTRY_MAGIC(de,magic) | ||
751 | # define DPRINTK(flag, format, args...) | ||
752 | #endif | ||
753 | |||
754 | typedef struct devfs_entry *devfs_handle_t; | ||
755 | |||
756 | struct directory_type { | ||
757 | rwlock_t lock; /* Lock for searching(R)/updating(W) */ | ||
758 | struct devfs_entry *first; | ||
759 | struct devfs_entry *last; | ||
760 | unsigned char no_more_additions:1; | ||
761 | }; | ||
762 | |||
763 | struct symlink_type { | ||
764 | unsigned int length; /* Not including the NULL-termimator */ | ||
765 | char *linkname; /* This is NULL-terminated */ | ||
766 | }; | ||
767 | |||
768 | struct devfs_inode { /* This structure is for "persistent" inode storage */ | ||
769 | struct dentry *dentry; | ||
770 | struct timespec atime; | ||
771 | struct timespec mtime; | ||
772 | struct timespec ctime; | ||
773 | unsigned int ino; /* Inode number as seen in the VFS */ | ||
774 | uid_t uid; | ||
775 | gid_t gid; | ||
776 | }; | ||
777 | |||
778 | struct devfs_entry { | ||
779 | #ifdef CONFIG_DEVFS_DEBUG | ||
780 | unsigned int magic_number; | ||
781 | #endif | ||
782 | void *info; | ||
783 | atomic_t refcount; /* When this drops to zero, it's unused */ | ||
784 | union { | ||
785 | struct directory_type dir; | ||
786 | dev_t dev; | ||
787 | struct symlink_type symlink; | ||
788 | const char *name; /* Only used for (mode == 0) */ | ||
789 | } u; | ||
790 | struct devfs_entry *prev; /* Previous entry in the parent directory */ | ||
791 | struct devfs_entry *next; /* Next entry in the parent directory */ | ||
792 | struct devfs_entry *parent; /* The parent directory */ | ||
793 | struct devfs_inode inode; | ||
794 | umode_t mode; | ||
795 | unsigned short namelen; /* I think 64k+ filenames are a way off... */ | ||
796 | unsigned char vfs:1; /* Whether the VFS may delete the entry */ | ||
797 | char name[1]; /* This is just a dummy: the allocated array | ||
798 | is bigger. This is NULL-terminated */ | ||
799 | }; | ||
800 | |||
801 | /* The root of the device tree */ | ||
802 | static struct devfs_entry *root_entry; | ||
803 | |||
804 | struct devfsd_buf_entry { | ||
805 | struct devfs_entry *de; /* The name is generated with this */ | ||
806 | unsigned short type; /* The type of event */ | ||
807 | umode_t mode; | ||
808 | uid_t uid; | ||
809 | gid_t gid; | ||
810 | struct devfsd_buf_entry *next; | ||
811 | }; | ||
812 | |||
813 | struct fs_info { /* This structure is for the mounted devfs */ | ||
814 | struct super_block *sb; | ||
815 | spinlock_t devfsd_buffer_lock; /* Lock when inserting/deleting events */ | ||
816 | struct devfsd_buf_entry *devfsd_first_event; | ||
817 | struct devfsd_buf_entry *devfsd_last_event; | ||
818 | volatile int devfsd_sleeping; | ||
819 | volatile struct task_struct *devfsd_task; | ||
820 | volatile pid_t devfsd_pgrp; | ||
821 | volatile struct file *devfsd_file; | ||
822 | struct devfsd_notify_struct *devfsd_info; | ||
823 | volatile unsigned long devfsd_event_mask; | ||
824 | atomic_t devfsd_overrun_count; | ||
825 | wait_queue_head_t devfsd_wait_queue; /* Wake devfsd on input */ | ||
826 | wait_queue_head_t revalidate_wait_queue; /* Wake when devfsd sleeps */ | ||
827 | }; | ||
828 | |||
829 | static struct fs_info fs_info = {.devfsd_buffer_lock = SPIN_LOCK_UNLOCKED }; | ||
830 | static kmem_cache_t *devfsd_buf_cache; | ||
831 | #ifdef CONFIG_DEVFS_DEBUG | ||
832 | static unsigned int devfs_debug_init __initdata = DEBUG_NONE; | ||
833 | static unsigned int devfs_debug = DEBUG_NONE; | ||
834 | static DEFINE_SPINLOCK(stat_lock); | ||
835 | static unsigned int stat_num_entries; | ||
836 | static unsigned int stat_num_bytes; | ||
837 | #endif | ||
838 | static unsigned char poison_array[8] = | ||
839 | { 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a }; | ||
840 | |||
841 | #ifdef CONFIG_DEVFS_MOUNT | ||
842 | static unsigned int boot_options = OPTION_MOUNT; | ||
843 | #else | ||
844 | static unsigned int boot_options = OPTION_NONE; | ||
845 | #endif | ||
846 | |||
847 | /* Forward function declarations */ | ||
848 | static devfs_handle_t _devfs_walk_path(struct devfs_entry *dir, | ||
849 | const char *name, int namelen, | ||
850 | int traverse_symlink); | ||
851 | static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len, | ||
852 | loff_t * ppos); | ||
853 | static int devfsd_ioctl(struct inode *inode, struct file *file, | ||
854 | unsigned int cmd, unsigned long arg); | ||
855 | static int devfsd_close(struct inode *inode, struct file *file); | ||
856 | #ifdef CONFIG_DEVFS_DEBUG | ||
857 | static ssize_t stat_read(struct file *file, char __user *buf, size_t len, | ||
858 | loff_t * ppos); | ||
859 | static const struct file_operations stat_fops = { | ||
860 | .open = nonseekable_open, | ||
861 | .read = stat_read, | ||
862 | }; | ||
863 | #endif | ||
864 | |||
865 | /* Devfs daemon file operations */ | ||
866 | static const struct file_operations devfsd_fops = { | ||
867 | .open = nonseekable_open, | ||
868 | .read = devfsd_read, | ||
869 | .ioctl = devfsd_ioctl, | ||
870 | .release = devfsd_close, | ||
871 | }; | ||
872 | |||
873 | /* Support functions follow */ | ||
874 | |||
875 | /** | ||
876 | * devfs_get - Get a reference to a devfs entry. | ||
877 | * @de: The devfs entry. | ||
878 | */ | ||
879 | |||
880 | static struct devfs_entry *devfs_get(struct devfs_entry *de) | ||
881 | { | ||
882 | VERIFY_ENTRY(de); | ||
883 | if (de) | ||
884 | atomic_inc(&de->refcount); | ||
885 | return de; | ||
886 | } /* End Function devfs_get */ | ||
887 | |||
888 | /** | ||
889 | * devfs_put - Put (release) a reference to a devfs entry. | ||
890 | * @de: The handle to the devfs entry. | ||
891 | */ | ||
892 | |||
893 | static void devfs_put(devfs_handle_t de) | ||
894 | { | ||
895 | if (!de) | ||
896 | return; | ||
897 | VERIFY_ENTRY(de); | ||
898 | if (de->info == POISON_PTR) | ||
899 | OOPS("(%p): poisoned pointer\n", de); | ||
900 | if (!atomic_dec_and_test(&de->refcount)) | ||
901 | return; | ||
902 | if (de == root_entry) | ||
903 | OOPS("(%p): root entry being freed\n", de); | ||
904 | DPRINTK(DEBUG_FREE, "(%s): de: %p, parent: %p \"%s\"\n", | ||
905 | de->name, de, de->parent, | ||
906 | de->parent ? de->parent->name : "no parent"); | ||
907 | if (S_ISLNK(de->mode)) | ||
908 | kfree(de->u.symlink.linkname); | ||
909 | WRITE_ENTRY_MAGIC(de, 0); | ||
910 | #ifdef CONFIG_DEVFS_DEBUG | ||
911 | spin_lock(&stat_lock); | ||
912 | --stat_num_entries; | ||
913 | stat_num_bytes -= sizeof *de + de->namelen; | ||
914 | if (S_ISLNK(de->mode)) | ||
915 | stat_num_bytes -= de->u.symlink.length + 1; | ||
916 | spin_unlock(&stat_lock); | ||
917 | #endif | ||
918 | de->info = POISON_PTR; | ||
919 | kfree(de); | ||
920 | } /* End Function devfs_put */ | ||
921 | |||
922 | /** | ||
923 | * _devfs_search_dir - Search for a devfs entry in a directory. | ||
924 | * @dir: The directory to search. | ||
925 | * @name: The name of the entry to search for. | ||
926 | * @namelen: The number of characters in @name. | ||
927 | * | ||
928 | * Search for a devfs entry in a directory and returns a pointer to the entry | ||
929 | * on success, else %NULL. The directory must be locked already. | ||
930 | * An implicit devfs_get() is performed on the returned entry. | ||
931 | */ | ||
932 | |||
933 | static struct devfs_entry *_devfs_search_dir(struct devfs_entry *dir, | ||
934 | const char *name, | ||
935 | unsigned int namelen) | ||
936 | { | ||
937 | struct devfs_entry *curr; | ||
938 | |||
939 | if (!S_ISDIR(dir->mode)) { | ||
940 | PRINTK("(%s): not a directory\n", dir->name); | ||
941 | return NULL; | ||
942 | } | ||
943 | for (curr = dir->u.dir.first; curr != NULL; curr = curr->next) { | ||
944 | if (curr->namelen != namelen) | ||
945 | continue; | ||
946 | if (memcmp(curr->name, name, namelen) == 0) | ||
947 | break; | ||
948 | /* Not found: try the next one */ | ||
949 | } | ||
950 | return devfs_get(curr); | ||
951 | } /* End Function _devfs_search_dir */ | ||
952 | |||
953 | /** | ||
954 | * _devfs_alloc_entry - Allocate a devfs entry. | ||
955 | * @name: the name of the entry | ||
956 | * @namelen: the number of characters in @name | ||
957 | * @mode: the mode for the entry | ||
958 | * | ||
959 | * Allocate a devfs entry and returns a pointer to the entry on success, else | ||
960 | * %NULL. | ||
961 | */ | ||
962 | |||
963 | static struct devfs_entry *_devfs_alloc_entry(const char *name, | ||
964 | unsigned int namelen, | ||
965 | umode_t mode) | ||
966 | { | ||
967 | struct devfs_entry *new; | ||
968 | static unsigned long inode_counter = FIRST_INODE; | ||
969 | static DEFINE_SPINLOCK(counter_lock); | ||
970 | |||
971 | if (name && (namelen < 1)) | ||
972 | namelen = strlen(name); | ||
973 | if ((new = kmalloc(sizeof *new + namelen, GFP_KERNEL)) == NULL) | ||
974 | return NULL; | ||
975 | memset(new, 0, sizeof *new + namelen); /* Will set '\0' on name */ | ||
976 | new->mode = mode; | ||
977 | if (S_ISDIR(mode)) | ||
978 | rwlock_init(&new->u.dir.lock); | ||
979 | atomic_set(&new->refcount, 1); | ||
980 | spin_lock(&counter_lock); | ||
981 | new->inode.ino = inode_counter++; | ||
982 | spin_unlock(&counter_lock); | ||
983 | if (name) | ||
984 | memcpy(new->name, name, namelen); | ||
985 | new->namelen = namelen; | ||
986 | WRITE_ENTRY_MAGIC(new, MAGIC_VALUE); | ||
987 | #ifdef CONFIG_DEVFS_DEBUG | ||
988 | spin_lock(&stat_lock); | ||
989 | ++stat_num_entries; | ||
990 | stat_num_bytes += sizeof *new + namelen; | ||
991 | spin_unlock(&stat_lock); | ||
992 | #endif | ||
993 | return new; | ||
994 | } /* End Function _devfs_alloc_entry */ | ||
995 | |||
996 | /** | ||
997 | * _devfs_append_entry - Append a devfs entry to a directory's child list. | ||
998 | * @dir: The directory to add to. | ||
999 | * @de: The devfs entry to append. | ||
1000 | * @old_de: If an existing entry exists, it will be written here. This may | ||
1001 | * be %NULL. An implicit devfs_get() is performed on this entry. | ||
1002 | * | ||
1003 | * Append a devfs entry to a directory's list of children, checking first to | ||
1004 | * see if an entry of the same name exists. The directory will be locked. | ||
1005 | * The value 0 is returned on success, else a negative error code. | ||
1006 | * On failure, an implicit devfs_put() is performed on %de. | ||
1007 | */ | ||
1008 | |||
1009 | static int _devfs_append_entry(devfs_handle_t dir, devfs_handle_t de, | ||
1010 | devfs_handle_t * old_de) | ||
1011 | { | ||
1012 | int retval; | ||
1013 | |||
1014 | if (old_de) | ||
1015 | *old_de = NULL; | ||
1016 | if (!S_ISDIR(dir->mode)) { | ||
1017 | PRINTK("(%s): dir: \"%s\" is not a directory\n", de->name, | ||
1018 | dir->name); | ||
1019 | devfs_put(de); | ||
1020 | return -ENOTDIR; | ||
1021 | } | ||
1022 | write_lock(&dir->u.dir.lock); | ||
1023 | if (dir->u.dir.no_more_additions) | ||
1024 | retval = -ENOENT; | ||
1025 | else { | ||
1026 | struct devfs_entry *old; | ||
1027 | |||
1028 | old = _devfs_search_dir(dir, de->name, de->namelen); | ||
1029 | if (old_de) | ||
1030 | *old_de = old; | ||
1031 | else | ||
1032 | devfs_put(old); | ||
1033 | if (old == NULL) { | ||
1034 | de->parent = dir; | ||
1035 | de->prev = dir->u.dir.last; | ||
1036 | /* Append to the directory's list of children */ | ||
1037 | if (dir->u.dir.first == NULL) | ||
1038 | dir->u.dir.first = de; | ||
1039 | else | ||
1040 | dir->u.dir.last->next = de; | ||
1041 | dir->u.dir.last = de; | ||
1042 | retval = 0; | ||
1043 | } else | ||
1044 | retval = -EEXIST; | ||
1045 | } | ||
1046 | write_unlock(&dir->u.dir.lock); | ||
1047 | if (retval) | ||
1048 | devfs_put(de); | ||
1049 | return retval; | ||
1050 | } /* End Function _devfs_append_entry */ | ||
1051 | |||
1052 | /** | ||
1053 | * _devfs_get_root_entry - Get the root devfs entry. | ||
1054 | * | ||
1055 | * Returns the root devfs entry on success, else %NULL. | ||
1056 | * | ||
1057 | * TODO it must be called asynchronously due to the fact | ||
1058 | * that devfs is initialized relatively late. Proper way | ||
1059 | * is to remove module_init from init_devfs_fs and manually | ||
1060 | * call it early enough during system init | ||
1061 | */ | ||
1062 | |||
1063 | static struct devfs_entry *_devfs_get_root_entry(void) | ||
1064 | { | ||
1065 | struct devfs_entry *new; | ||
1066 | static DEFINE_SPINLOCK(root_lock); | ||
1067 | |||
1068 | if (root_entry) | ||
1069 | return root_entry; | ||
1070 | |||
1071 | new = _devfs_alloc_entry(NULL, 0, MODE_DIR); | ||
1072 | if (new == NULL) | ||
1073 | return NULL; | ||
1074 | |||
1075 | spin_lock(&root_lock); | ||
1076 | if (root_entry) { | ||
1077 | spin_unlock(&root_lock); | ||
1078 | devfs_put(new); | ||
1079 | return root_entry; | ||
1080 | } | ||
1081 | root_entry = new; | ||
1082 | spin_unlock(&root_lock); | ||
1083 | |||
1084 | return root_entry; | ||
1085 | } /* End Function _devfs_get_root_entry */ | ||
1086 | |||
1087 | /** | ||
1088 | * _devfs_descend - Descend down a tree using the next component name. | ||
1089 | * @dir: The directory to search. | ||
1090 | * @name: The component name to search for. | ||
1091 | * @namelen: The length of %name. | ||
1092 | * @next_pos: The position of the next '/' or '\0' is written here. | ||
1093 | * | ||
1094 | * Descend into a directory, searching for a component. This function forms | ||
1095 | * the core of a tree-walking algorithm. The directory will be locked. | ||
1096 | * The devfs entry corresponding to the component is returned. If there is | ||
1097 | * no matching entry, %NULL is returned. | ||
1098 | * An implicit devfs_get() is performed on the returned entry. | ||
1099 | */ | ||
1100 | |||
1101 | static struct devfs_entry *_devfs_descend(struct devfs_entry *dir, | ||
1102 | const char *name, int namelen, | ||
1103 | int *next_pos) | ||
1104 | { | ||
1105 | const char *stop, *ptr; | ||
1106 | struct devfs_entry *entry; | ||
1107 | |||
1108 | if ((namelen >= 3) && (strncmp(name, "../", 3) == 0)) { /* Special-case going to parent directory */ | ||
1109 | *next_pos = 3; | ||
1110 | return devfs_get(dir->parent); | ||
1111 | } | ||
1112 | stop = name + namelen; | ||
1113 | /* Search for a possible '/' */ | ||
1114 | for (ptr = name; (ptr < stop) && (*ptr != '/'); ++ptr) ; | ||
1115 | *next_pos = ptr - name; | ||
1116 | read_lock(&dir->u.dir.lock); | ||
1117 | entry = _devfs_search_dir(dir, name, *next_pos); | ||
1118 | read_unlock(&dir->u.dir.lock); | ||
1119 | return entry; | ||
1120 | } /* End Function _devfs_descend */ | ||
1121 | |||
1122 | static devfs_handle_t _devfs_make_parent_for_leaf(struct devfs_entry *dir, | ||
1123 | const char *name, | ||
1124 | int namelen, int *leaf_pos) | ||
1125 | { | ||
1126 | int next_pos = 0; | ||
1127 | |||
1128 | if (dir == NULL) | ||
1129 | dir = _devfs_get_root_entry(); | ||
1130 | if (dir == NULL) | ||
1131 | return NULL; | ||
1132 | devfs_get(dir); | ||
1133 | /* Search for possible trailing component and ignore it */ | ||
1134 | for (--namelen; (namelen > 0) && (name[namelen] != '/'); --namelen) ; | ||
1135 | *leaf_pos = (name[namelen] == '/') ? (namelen + 1) : 0; | ||
1136 | for (; namelen > 0; name += next_pos, namelen -= next_pos) { | ||
1137 | struct devfs_entry *de, *old = NULL; | ||
1138 | |||
1139 | if ((de = | ||
1140 | _devfs_descend(dir, name, namelen, &next_pos)) == NULL) { | ||
1141 | de = _devfs_alloc_entry(name, next_pos, MODE_DIR); | ||
1142 | devfs_get(de); | ||
1143 | if (!de || _devfs_append_entry(dir, de, &old)) { | ||
1144 | devfs_put(de); | ||
1145 | if (!old || !S_ISDIR(old->mode)) { | ||
1146 | devfs_put(old); | ||
1147 | devfs_put(dir); | ||
1148 | return NULL; | ||
1149 | } | ||
1150 | de = old; /* Use the existing directory */ | ||
1151 | } | ||
1152 | } | ||
1153 | if (de == dir->parent) { | ||
1154 | devfs_put(dir); | ||
1155 | devfs_put(de); | ||
1156 | return NULL; | ||
1157 | } | ||
1158 | devfs_put(dir); | ||
1159 | dir = de; | ||
1160 | if (name[next_pos] == '/') | ||
1161 | ++next_pos; | ||
1162 | } | ||
1163 | return dir; | ||
1164 | } /* End Function _devfs_make_parent_for_leaf */ | ||
1165 | |||
1166 | static devfs_handle_t _devfs_prepare_leaf(devfs_handle_t * dir, | ||
1167 | const char *name, umode_t mode) | ||
1168 | { | ||
1169 | int namelen, leaf_pos; | ||
1170 | struct devfs_entry *de; | ||
1171 | |||
1172 | namelen = strlen(name); | ||
1173 | if ((*dir = _devfs_make_parent_for_leaf(*dir, name, namelen, | ||
1174 | &leaf_pos)) == NULL) { | ||
1175 | PRINTK("(%s): could not create parent path\n", name); | ||
1176 | return NULL; | ||
1177 | } | ||
1178 | if ((de = _devfs_alloc_entry(name + leaf_pos, namelen - leaf_pos, mode)) | ||
1179 | == NULL) { | ||
1180 | PRINTK("(%s): could not allocate entry\n", name); | ||
1181 | devfs_put(*dir); | ||
1182 | return NULL; | ||
1183 | } | ||
1184 | return de; | ||
1185 | } /* End Function _devfs_prepare_leaf */ | ||
1186 | |||
1187 | static devfs_handle_t _devfs_walk_path(struct devfs_entry *dir, | ||
1188 | const char *name, int namelen, | ||
1189 | int traverse_symlink) | ||
1190 | { | ||
1191 | int next_pos = 0; | ||
1192 | |||
1193 | if (dir == NULL) | ||
1194 | dir = _devfs_get_root_entry(); | ||
1195 | if (dir == NULL) | ||
1196 | return NULL; | ||
1197 | devfs_get(dir); | ||
1198 | for (; namelen > 0; name += next_pos, namelen -= next_pos) { | ||
1199 | struct devfs_entry *de, *link; | ||
1200 | |||
1201 | if (!S_ISDIR(dir->mode)) { | ||
1202 | devfs_put(dir); | ||
1203 | return NULL; | ||
1204 | } | ||
1205 | |||
1206 | if ((de = | ||
1207 | _devfs_descend(dir, name, namelen, &next_pos)) == NULL) { | ||
1208 | devfs_put(dir); | ||
1209 | return NULL; | ||
1210 | } | ||
1211 | if (S_ISLNK(de->mode) && traverse_symlink) { /* Need to follow the link: this is a stack chomper */ | ||
1212 | /* FIXME what if it puts outside of mounted tree? */ | ||
1213 | link = _devfs_walk_path(dir, de->u.symlink.linkname, | ||
1214 | de->u.symlink.length, TRUE); | ||
1215 | devfs_put(de); | ||
1216 | if (!link) { | ||
1217 | devfs_put(dir); | ||
1218 | return NULL; | ||
1219 | } | ||
1220 | de = link; | ||
1221 | } | ||
1222 | devfs_put(dir); | ||
1223 | dir = de; | ||
1224 | if (name[next_pos] == '/') | ||
1225 | ++next_pos; | ||
1226 | } | ||
1227 | return dir; | ||
1228 | } /* End Function _devfs_walk_path */ | ||
1229 | |||
1230 | /** | ||
1231 | * _devfs_find_entry - Find a devfs entry. | ||
1232 | * @dir: The handle to the parent devfs directory entry. If this is %NULL the | ||
1233 | * name is relative to the root of the devfs. | ||
1234 | * @name: The name of the entry. This may be %NULL. | ||
1235 | * @traverse_symlink: If %TRUE then symbolic links are traversed. | ||
1236 | * | ||
1237 | * Returns the devfs_entry pointer on success, else %NULL. An implicit | ||
1238 | * devfs_get() is performed. | ||
1239 | */ | ||
1240 | |||
1241 | static struct devfs_entry *_devfs_find_entry(devfs_handle_t dir, | ||
1242 | const char *name, | ||
1243 | int traverse_symlink) | ||
1244 | { | ||
1245 | unsigned int namelen = strlen(name); | ||
1246 | |||
1247 | if (name[0] == '/') { | ||
1248 | /* Skip leading pathname component */ | ||
1249 | if (namelen < 2) { | ||
1250 | PRINTK("(%s): too short\n", name); | ||
1251 | return NULL; | ||
1252 | } | ||
1253 | for (++name, --namelen; (*name != '/') && (namelen > 0); | ||
1254 | ++name, --namelen) ; | ||
1255 | if (namelen < 2) { | ||
1256 | PRINTK("(%s): too short\n", name); | ||
1257 | return NULL; | ||
1258 | } | ||
1259 | ++name; | ||
1260 | --namelen; | ||
1261 | } | ||
1262 | return _devfs_walk_path(dir, name, namelen, traverse_symlink); | ||
1263 | } /* End Function _devfs_find_entry */ | ||
1264 | |||
1265 | static struct devfs_entry *get_devfs_entry_from_vfs_inode(struct inode *inode) | ||
1266 | { | ||
1267 | if (inode == NULL) | ||
1268 | return NULL; | ||
1269 | VERIFY_ENTRY((struct devfs_entry *)inode->u.generic_ip); | ||
1270 | return inode->u.generic_ip; | ||
1271 | } /* End Function get_devfs_entry_from_vfs_inode */ | ||
1272 | |||
1273 | /** | ||
1274 | * free_dentry - Free the dentry for a device entry and invalidate inode. | ||
1275 | * @de: The entry. | ||
1276 | * | ||
1277 | * This must only be called after the entry has been unhooked from its | ||
1278 | * parent directory. | ||
1279 | */ | ||
1280 | |||
1281 | static void free_dentry(struct devfs_entry *de) | ||
1282 | { | ||
1283 | struct dentry *dentry = de->inode.dentry; | ||
1284 | |||
1285 | if (!dentry) | ||
1286 | return; | ||
1287 | spin_lock(&dcache_lock); | ||
1288 | dget_locked(dentry); | ||
1289 | spin_unlock(&dcache_lock); | ||
1290 | /* Forcefully remove the inode */ | ||
1291 | if (dentry->d_inode != NULL) | ||
1292 | dentry->d_inode->i_nlink = 0; | ||
1293 | d_drop(dentry); | ||
1294 | dput(dentry); | ||
1295 | } /* End Function free_dentry */ | ||
1296 | |||
1297 | /** | ||
1298 | * is_devfsd_or_child - Test if the current process is devfsd or one of its children. | ||
1299 | * @fs_info: The filesystem information. | ||
1300 | * | ||
1301 | * Returns %TRUE if devfsd or child, else %FALSE. | ||
1302 | */ | ||
1303 | |||
1304 | static int is_devfsd_or_child(struct fs_info *fs_info) | ||
1305 | { | ||
1306 | struct task_struct *p = current; | ||
1307 | |||
1308 | if (p == fs_info->devfsd_task) | ||
1309 | return (TRUE); | ||
1310 | if (process_group(p) == fs_info->devfsd_pgrp) | ||
1311 | return (TRUE); | ||
1312 | read_lock(&tasklist_lock); | ||
1313 | for (; p != &init_task; p = p->real_parent) { | ||
1314 | if (p == fs_info->devfsd_task) { | ||
1315 | read_unlock(&tasklist_lock); | ||
1316 | return (TRUE); | ||
1317 | } | ||
1318 | } | ||
1319 | read_unlock(&tasklist_lock); | ||
1320 | return (FALSE); | ||
1321 | } /* End Function is_devfsd_or_child */ | ||
1322 | |||
1323 | /** | ||
1324 | * devfsd_queue_empty - Test if devfsd has work pending in its event queue. | ||
1325 | * @fs_info: The filesystem information. | ||
1326 | * | ||
1327 | * Returns %TRUE if the queue is empty, else %FALSE. | ||
1328 | */ | ||
1329 | |||
1330 | static inline int devfsd_queue_empty(struct fs_info *fs_info) | ||
1331 | { | ||
1332 | return (fs_info->devfsd_last_event) ? FALSE : TRUE; | ||
1333 | } /* End Function devfsd_queue_empty */ | ||
1334 | |||
1335 | /** | ||
1336 | * wait_for_devfsd_finished - Wait for devfsd to finish processing its event queue. | ||
1337 | * @fs_info: The filesystem information. | ||
1338 | * | ||
1339 | * Returns %TRUE if no more waiting will be required, else %FALSE. | ||
1340 | */ | ||
1341 | |||
1342 | static int wait_for_devfsd_finished(struct fs_info *fs_info) | ||
1343 | { | ||
1344 | DECLARE_WAITQUEUE(wait, current); | ||
1345 | |||
1346 | if (fs_info->devfsd_task == NULL) | ||
1347 | return (TRUE); | ||
1348 | if (devfsd_queue_empty(fs_info) && fs_info->devfsd_sleeping) | ||
1349 | return TRUE; | ||
1350 | if (is_devfsd_or_child(fs_info)) | ||
1351 | return (FALSE); | ||
1352 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
1353 | add_wait_queue(&fs_info->revalidate_wait_queue, &wait); | ||
1354 | if (!devfsd_queue_empty(fs_info) || !fs_info->devfsd_sleeping) | ||
1355 | if (fs_info->devfsd_task) | ||
1356 | schedule(); | ||
1357 | remove_wait_queue(&fs_info->revalidate_wait_queue, &wait); | ||
1358 | __set_current_state(TASK_RUNNING); | ||
1359 | return (TRUE); | ||
1360 | } /* End Function wait_for_devfsd_finished */ | ||
1361 | |||
1362 | /** | ||
1363 | * devfsd_notify_de - Notify the devfsd daemon of a change. | ||
1364 | * @de: The devfs entry that has changed. This and all parent entries will | ||
1365 | * have their reference counts incremented if the event was queued. | ||
1366 | * @type: The type of change. | ||
1367 | * @mode: The mode of the entry. | ||
1368 | * @uid: The user ID. | ||
1369 | * @gid: The group ID. | ||
1370 | * @fs_info: The filesystem info. | ||
1371 | * | ||
1372 | * Returns %TRUE if an event was queued and devfsd woken up, else %FALSE. | ||
1373 | */ | ||
1374 | |||
1375 | static int devfsd_notify_de(struct devfs_entry *de, | ||
1376 | unsigned short type, umode_t mode, | ||
1377 | uid_t uid, gid_t gid, struct fs_info *fs_info) | ||
1378 | { | ||
1379 | struct devfsd_buf_entry *entry; | ||
1380 | struct devfs_entry *curr; | ||
1381 | |||
1382 | if (!(fs_info->devfsd_event_mask & (1 << type))) | ||
1383 | return (FALSE); | ||
1384 | if ((entry = kmem_cache_alloc(devfsd_buf_cache, SLAB_KERNEL)) == NULL) { | ||
1385 | atomic_inc(&fs_info->devfsd_overrun_count); | ||
1386 | return (FALSE); | ||
1387 | } | ||
1388 | for (curr = de; curr != NULL; curr = curr->parent) | ||
1389 | devfs_get(curr); | ||
1390 | entry->de = de; | ||
1391 | entry->type = type; | ||
1392 | entry->mode = mode; | ||
1393 | entry->uid = uid; | ||
1394 | entry->gid = gid; | ||
1395 | entry->next = NULL; | ||
1396 | spin_lock(&fs_info->devfsd_buffer_lock); | ||
1397 | if (!fs_info->devfsd_first_event) | ||
1398 | fs_info->devfsd_first_event = entry; | ||
1399 | if (fs_info->devfsd_last_event) | ||
1400 | fs_info->devfsd_last_event->next = entry; | ||
1401 | fs_info->devfsd_last_event = entry; | ||
1402 | spin_unlock(&fs_info->devfsd_buffer_lock); | ||
1403 | wake_up_interruptible(&fs_info->devfsd_wait_queue); | ||
1404 | return (TRUE); | ||
1405 | } /* End Function devfsd_notify_de */ | ||
1406 | |||
1407 | /** | ||
1408 | * devfsd_notify - Notify the devfsd daemon of a change. | ||
1409 | * @de: The devfs entry that has changed. | ||
1410 | * @type: The type of change event. | ||
1411 | * @wait: If TRUE, the function waits for the daemon to finish processing | ||
1412 | * the event. | ||
1413 | */ | ||
1414 | |||
1415 | static void devfsd_notify(struct devfs_entry *de, unsigned short type) | ||
1416 | { | ||
1417 | devfsd_notify_de(de, type, de->mode, current->euid, | ||
1418 | current->egid, &fs_info); | ||
1419 | } | ||
1420 | |||
1421 | static int devfs_mk_dev(dev_t dev, umode_t mode, const char *fmt, va_list args) | ||
1422 | { | ||
1423 | struct devfs_entry *dir = NULL, *de; | ||
1424 | char buf[64]; | ||
1425 | int error, n; | ||
1426 | |||
1427 | n = vsnprintf(buf, sizeof(buf), fmt, args); | ||
1428 | if (n >= sizeof(buf) || !buf[0]) { | ||
1429 | printk(KERN_WARNING "%s: invalid format string %s\n", | ||
1430 | __FUNCTION__, fmt); | ||
1431 | return -EINVAL; | ||
1432 | } | ||
1433 | |||
1434 | de = _devfs_prepare_leaf(&dir, buf, mode); | ||
1435 | if (!de) { | ||
1436 | printk(KERN_WARNING "%s: could not prepare leaf for %s\n", | ||
1437 | __FUNCTION__, buf); | ||
1438 | return -ENOMEM; /* could be more accurate... */ | ||
1439 | } | ||
1440 | |||
1441 | de->u.dev = dev; | ||
1442 | |||
1443 | error = _devfs_append_entry(dir, de, NULL); | ||
1444 | if (error) { | ||
1445 | printk(KERN_WARNING "%s: could not append to parent for %s\n", | ||
1446 | __FUNCTION__, buf); | ||
1447 | goto out; | ||
1448 | } | ||
1449 | |||
1450 | devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED); | ||
1451 | out: | ||
1452 | devfs_put(dir); | ||
1453 | return error; | ||
1454 | } | ||
1455 | |||
1456 | int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...) | ||
1457 | { | ||
1458 | va_list args; | ||
1459 | |||
1460 | if (!S_ISBLK(mode)) { | ||
1461 | printk(KERN_WARNING "%s: invalide mode (%u) for %s\n", | ||
1462 | __FUNCTION__, mode, fmt); | ||
1463 | return -EINVAL; | ||
1464 | } | ||
1465 | |||
1466 | va_start(args, fmt); | ||
1467 | return devfs_mk_dev(dev, mode, fmt, args); | ||
1468 | } | ||
1469 | |||
1470 | EXPORT_SYMBOL(devfs_mk_bdev); | ||
1471 | |||
1472 | int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...) | ||
1473 | { | ||
1474 | va_list args; | ||
1475 | |||
1476 | if (!S_ISCHR(mode)) { | ||
1477 | printk(KERN_WARNING "%s: invalide mode (%u) for %s\n", | ||
1478 | __FUNCTION__, mode, fmt); | ||
1479 | return -EINVAL; | ||
1480 | } | ||
1481 | |||
1482 | va_start(args, fmt); | ||
1483 | return devfs_mk_dev(dev, mode, fmt, args); | ||
1484 | } | ||
1485 | |||
1486 | EXPORT_SYMBOL(devfs_mk_cdev); | ||
1487 | |||
1488 | /** | ||
1489 | * _devfs_unhook - Unhook a device entry from its parents list | ||
1490 | * @de: The entry to unhook. | ||
1491 | * | ||
1492 | * Returns %TRUE if the entry was unhooked, else %FALSE if it was | ||
1493 | * previously unhooked. | ||
1494 | * The caller must have a write lock on the parent directory. | ||
1495 | */ | ||
1496 | |||
1497 | static int _devfs_unhook(struct devfs_entry *de) | ||
1498 | { | ||
1499 | struct devfs_entry *parent; | ||
1500 | |||
1501 | if (!de || (de->prev == de)) | ||
1502 | return FALSE; | ||
1503 | parent = de->parent; | ||
1504 | if (de->prev == NULL) | ||
1505 | parent->u.dir.first = de->next; | ||
1506 | else | ||
1507 | de->prev->next = de->next; | ||
1508 | if (de->next == NULL) | ||
1509 | parent->u.dir.last = de->prev; | ||
1510 | else | ||
1511 | de->next->prev = de->prev; | ||
1512 | de->prev = de; /* Indicate we're unhooked */ | ||
1513 | de->next = NULL; /* Force early termination for <devfs_readdir> */ | ||
1514 | return TRUE; | ||
1515 | } /* End Function _devfs_unhook */ | ||
1516 | |||
1517 | /** | ||
1518 | * _devfs_unregister - Unregister a device entry from its parent. | ||
1519 | * @dir: The parent directory. | ||
1520 | * @de: The entry to unregister. | ||
1521 | * | ||
1522 | * The caller must have a write lock on the parent directory, which is | ||
1523 | * unlocked by this function. | ||
1524 | */ | ||
1525 | |||
1526 | static void _devfs_unregister(struct devfs_entry *dir, struct devfs_entry *de) | ||
1527 | { | ||
1528 | int unhooked = _devfs_unhook(de); | ||
1529 | |||
1530 | write_unlock(&dir->u.dir.lock); | ||
1531 | if (!unhooked) | ||
1532 | return; | ||
1533 | devfs_get(dir); | ||
1534 | devfsd_notify(de, DEVFSD_NOTIFY_UNREGISTERED); | ||
1535 | free_dentry(de); | ||
1536 | devfs_put(dir); | ||
1537 | if (!S_ISDIR(de->mode)) | ||
1538 | return; | ||
1539 | while (TRUE) { /* Recursively unregister: this is a stack chomper */ | ||
1540 | struct devfs_entry *child; | ||
1541 | |||
1542 | write_lock(&de->u.dir.lock); | ||
1543 | de->u.dir.no_more_additions = TRUE; | ||
1544 | child = de->u.dir.first; | ||
1545 | VERIFY_ENTRY(child); | ||
1546 | _devfs_unregister(de, child); | ||
1547 | if (!child) | ||
1548 | break; | ||
1549 | DPRINTK(DEBUG_UNREGISTER, "(%s): child: %p refcount: %d\n", | ||
1550 | child->name, child, atomic_read(&child->refcount)); | ||
1551 | devfs_put(child); | ||
1552 | } | ||
1553 | } /* End Function _devfs_unregister */ | ||
1554 | |||
1555 | static int devfs_do_symlink(devfs_handle_t dir, const char *name, | ||
1556 | const char *link, devfs_handle_t * handle) | ||
1557 | { | ||
1558 | int err; | ||
1559 | unsigned int linklength; | ||
1560 | char *newlink; | ||
1561 | struct devfs_entry *de; | ||
1562 | |||
1563 | if (handle != NULL) | ||
1564 | *handle = NULL; | ||
1565 | if (name == NULL) { | ||
1566 | PRINTK("(): NULL name pointer\n"); | ||
1567 | return -EINVAL; | ||
1568 | } | ||
1569 | if (link == NULL) { | ||
1570 | PRINTK("(%s): NULL link pointer\n", name); | ||
1571 | return -EINVAL; | ||
1572 | } | ||
1573 | linklength = strlen(link); | ||
1574 | if ((newlink = kmalloc(linklength + 1, GFP_KERNEL)) == NULL) | ||
1575 | return -ENOMEM; | ||
1576 | memcpy(newlink, link, linklength); | ||
1577 | newlink[linklength] = '\0'; | ||
1578 | if ((de = _devfs_prepare_leaf(&dir, name, S_IFLNK | S_IRUGO | S_IXUGO)) | ||
1579 | == NULL) { | ||
1580 | PRINTK("(%s): could not prepare leaf\n", name); | ||
1581 | kfree(newlink); | ||
1582 | return -ENOTDIR; | ||
1583 | } | ||
1584 | de->info = NULL; | ||
1585 | de->u.symlink.linkname = newlink; | ||
1586 | de->u.symlink.length = linklength; | ||
1587 | if ((err = _devfs_append_entry(dir, de, NULL)) != 0) { | ||
1588 | PRINTK("(%s): could not append to parent, err: %d\n", name, | ||
1589 | err); | ||
1590 | devfs_put(dir); | ||
1591 | return err; | ||
1592 | } | ||
1593 | devfs_put(dir); | ||
1594 | #ifdef CONFIG_DEVFS_DEBUG | ||
1595 | spin_lock(&stat_lock); | ||
1596 | stat_num_bytes += linklength + 1; | ||
1597 | spin_unlock(&stat_lock); | ||
1598 | #endif | ||
1599 | if (handle != NULL) | ||
1600 | *handle = de; | ||
1601 | return 0; | ||
1602 | } /* End Function devfs_do_symlink */ | ||
1603 | |||
1604 | /** | ||
1605 | * devfs_mk_symlink Create a symbolic link in the devfs namespace. | ||
1606 | * @from: The name of the entry. | ||
1607 | * @to: Name of the destination | ||
1608 | * | ||
1609 | * Returns 0 on success, else a negative error code is returned. | ||
1610 | */ | ||
1611 | |||
1612 | int devfs_mk_symlink(const char *from, const char *to) | ||
1613 | { | ||
1614 | devfs_handle_t de; | ||
1615 | int err; | ||
1616 | |||
1617 | err = devfs_do_symlink(NULL, from, to, &de); | ||
1618 | if (!err) { | ||
1619 | de->vfs = TRUE; | ||
1620 | devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED); | ||
1621 | } | ||
1622 | |||
1623 | return err; | ||
1624 | } | ||
1625 | |||
1626 | /** | ||
1627 | * devfs_mk_dir - Create a directory in the devfs namespace. | ||
1628 | * new name is relative to the root of the devfs. | ||
1629 | * @fmt: The name of the entry. | ||
1630 | * | ||
1631 | * Use of this function is optional. The devfs_register() function | ||
1632 | * will automatically create intermediate directories as needed. This function | ||
1633 | * is provided for efficiency reasons, as it provides a handle to a directory. | ||
1634 | * On failure %NULL is returned. | ||
1635 | */ | ||
1636 | |||
1637 | int devfs_mk_dir(const char *fmt, ...) | ||
1638 | { | ||
1639 | struct devfs_entry *dir = NULL, *de = NULL, *old; | ||
1640 | char buf[64]; | ||
1641 | va_list args; | ||
1642 | int error, n; | ||
1643 | |||
1644 | va_start(args, fmt); | ||
1645 | n = vsnprintf(buf, 64, fmt, args); | ||
1646 | if (n >= 64 || !buf[0]) { | ||
1647 | printk(KERN_WARNING "%s: invalid argument.", __FUNCTION__); | ||
1648 | return -EINVAL; | ||
1649 | } | ||
1650 | |||
1651 | de = _devfs_prepare_leaf(&dir, buf, MODE_DIR); | ||
1652 | if (!de) { | ||
1653 | PRINTK("(%s): could not prepare leaf\n", buf); | ||
1654 | return -EINVAL; | ||
1655 | } | ||
1656 | |||
1657 | error = _devfs_append_entry(dir, de, &old); | ||
1658 | if (error == -EEXIST && S_ISDIR(old->mode)) { | ||
1659 | /* | ||
1660 | * devfs_mk_dir() of an already-existing directory will | ||
1661 | * return success. | ||
1662 | */ | ||
1663 | error = 0; | ||
1664 | goto out_put; | ||
1665 | } else if (error) { | ||
1666 | PRINTK("(%s): could not append to dir: %p \"%s\"\n", | ||
1667 | buf, dir, dir->name); | ||
1668 | devfs_put(old); | ||
1669 | goto out_put; | ||
1670 | } | ||
1671 | |||
1672 | devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED); | ||
1673 | |||
1674 | out_put: | ||
1675 | devfs_put(dir); | ||
1676 | return error; | ||
1677 | } | ||
1678 | |||
1679 | void devfs_remove(const char *fmt, ...) | ||
1680 | { | ||
1681 | char buf[64]; | ||
1682 | va_list args; | ||
1683 | int n; | ||
1684 | |||
1685 | va_start(args, fmt); | ||
1686 | n = vsnprintf(buf, sizeof(buf), fmt, args); | ||
1687 | if (n < sizeof(buf) && buf[0]) { | ||
1688 | devfs_handle_t de = _devfs_find_entry(NULL, buf, 0); | ||
1689 | |||
1690 | if (!de) { | ||
1691 | printk(KERN_ERR "%s: %s not found, cannot remove\n", | ||
1692 | __FUNCTION__, buf); | ||
1693 | dump_stack(); | ||
1694 | return; | ||
1695 | } | ||
1696 | |||
1697 | write_lock(&de->parent->u.dir.lock); | ||
1698 | _devfs_unregister(de->parent, de); | ||
1699 | devfs_put(de); | ||
1700 | devfs_put(de); | ||
1701 | } | ||
1702 | } | ||
1703 | |||
1704 | /** | ||
1705 | * devfs_generate_path - Generate a pathname for an entry, relative to the devfs root. | ||
1706 | * @de: The devfs entry. | ||
1707 | * @path: The buffer to write the pathname to. The pathname and '\0' | ||
1708 | * terminator will be written at the end of the buffer. | ||
1709 | * @buflen: The length of the buffer. | ||
1710 | * | ||
1711 | * Returns the offset in the buffer where the pathname starts on success, | ||
1712 | * else a negative error code. | ||
1713 | */ | ||
1714 | |||
1715 | static int devfs_generate_path(devfs_handle_t de, char *path, int buflen) | ||
1716 | { | ||
1717 | int pos; | ||
1718 | #define NAMEOF(de) ( (de)->mode ? (de)->name : (de)->u.name ) | ||
1719 | |||
1720 | if (de == NULL) | ||
1721 | return -EINVAL; | ||
1722 | VERIFY_ENTRY(de); | ||
1723 | if (de->namelen >= buflen) | ||
1724 | return -ENAMETOOLONG; /* Must be first */ | ||
1725 | path[buflen - 1] = '\0'; | ||
1726 | if (de->parent == NULL) | ||
1727 | return buflen - 1; /* Don't prepend root */ | ||
1728 | pos = buflen - de->namelen - 1; | ||
1729 | memcpy(path + pos, NAMEOF(de), de->namelen); | ||
1730 | for (de = de->parent; de->parent != NULL; de = de->parent) { | ||
1731 | if (pos - de->namelen - 1 < 0) | ||
1732 | return -ENAMETOOLONG; | ||
1733 | path[--pos] = '/'; | ||
1734 | pos -= de->namelen; | ||
1735 | memcpy(path + pos, NAMEOF(de), de->namelen); | ||
1736 | } | ||
1737 | return pos; | ||
1738 | } /* End Function devfs_generate_path */ | ||
1739 | |||
1740 | /** | ||
1741 | * devfs_setup - Process kernel boot options. | ||
1742 | * @str: The boot options after the "devfs=". | ||
1743 | */ | ||
1744 | |||
1745 | static int __init devfs_setup(char *str) | ||
1746 | { | ||
1747 | static struct { | ||
1748 | char *name; | ||
1749 | unsigned int mask; | ||
1750 | unsigned int *opt; | ||
1751 | } devfs_options_tab[] __initdata = { | ||
1752 | #ifdef CONFIG_DEVFS_DEBUG | ||
1753 | { | ||
1754 | "dall", DEBUG_ALL, &devfs_debug_init}, { | ||
1755 | "dmod", DEBUG_MODULE_LOAD, &devfs_debug_init}, { | ||
1756 | "dreg", DEBUG_REGISTER, &devfs_debug_init}, { | ||
1757 | "dunreg", DEBUG_UNREGISTER, &devfs_debug_init}, { | ||
1758 | "dfree", DEBUG_FREE, &devfs_debug_init}, { | ||
1759 | "diget", DEBUG_I_GET, &devfs_debug_init}, { | ||
1760 | "dchange", DEBUG_SET_FLAGS, &devfs_debug_init}, { | ||
1761 | "dsread", DEBUG_S_READ, &devfs_debug_init}, { | ||
1762 | "dichange", DEBUG_I_CHANGE, &devfs_debug_init}, { | ||
1763 | "dimknod", DEBUG_I_MKNOD, &devfs_debug_init}, { | ||
1764 | "dilookup", DEBUG_I_LOOKUP, &devfs_debug_init}, { | ||
1765 | "diunlink", DEBUG_I_UNLINK, &devfs_debug_init}, | ||
1766 | #endif /* CONFIG_DEVFS_DEBUG */ | ||
1767 | { | ||
1768 | "mount", OPTION_MOUNT, &boot_options}, { | ||
1769 | NULL, 0, NULL} | ||
1770 | }; | ||
1771 | |||
1772 | while ((*str != '\0') && !isspace(*str)) { | ||
1773 | int i, found = 0, invert = 0; | ||
1774 | |||
1775 | if (strncmp(str, "no", 2) == 0) { | ||
1776 | invert = 1; | ||
1777 | str += 2; | ||
1778 | } | ||
1779 | for (i = 0; devfs_options_tab[i].name != NULL; i++) { | ||
1780 | int len = strlen(devfs_options_tab[i].name); | ||
1781 | |||
1782 | if (strncmp(str, devfs_options_tab[i].name, len) == 0) { | ||
1783 | if (invert) | ||
1784 | *devfs_options_tab[i].opt &= | ||
1785 | ~devfs_options_tab[i].mask; | ||
1786 | else | ||
1787 | *devfs_options_tab[i].opt |= | ||
1788 | devfs_options_tab[i].mask; | ||
1789 | str += len; | ||
1790 | found = 1; | ||
1791 | break; | ||
1792 | } | ||
1793 | } | ||
1794 | if (!found) | ||
1795 | return 0; /* No match */ | ||
1796 | if (*str != ',') | ||
1797 | return 0; /* No more options */ | ||
1798 | ++str; | ||
1799 | } | ||
1800 | return 1; | ||
1801 | } /* End Function devfs_setup */ | ||
1802 | |||
1803 | __setup("devfs=", devfs_setup); | ||
1804 | |||
1805 | EXPORT_SYMBOL(devfs_mk_dir); | ||
1806 | EXPORT_SYMBOL(devfs_remove); | ||
1807 | |||
1808 | /** | ||
1809 | * try_modload - Notify devfsd of an inode lookup by a non-devfsd process. | ||
1810 | * @parent: The parent devfs entry. | ||
1811 | * @fs_info: The filesystem info. | ||
1812 | * @name: The device name. | ||
1813 | * @namelen: The number of characters in @name. | ||
1814 | * @buf: A working area that will be used. This must not go out of scope | ||
1815 | * until devfsd is idle again. | ||
1816 | * | ||
1817 | * Returns 0 on success (event was queued), else a negative error code. | ||
1818 | */ | ||
1819 | |||
1820 | static int try_modload(struct devfs_entry *parent, struct fs_info *fs_info, | ||
1821 | const char *name, unsigned namelen, | ||
1822 | struct devfs_entry *buf) | ||
1823 | { | ||
1824 | if (!(fs_info->devfsd_event_mask & (1 << DEVFSD_NOTIFY_LOOKUP))) | ||
1825 | return -ENOENT; | ||
1826 | if (is_devfsd_or_child(fs_info)) | ||
1827 | return -ENOENT; | ||
1828 | memset(buf, 0, sizeof *buf); | ||
1829 | atomic_set(&buf->refcount, 1); | ||
1830 | buf->parent = parent; | ||
1831 | buf->namelen = namelen; | ||
1832 | buf->u.name = name; | ||
1833 | WRITE_ENTRY_MAGIC(buf, MAGIC_VALUE); | ||
1834 | if (!devfsd_notify_de(buf, DEVFSD_NOTIFY_LOOKUP, 0, | ||
1835 | current->euid, current->egid, fs_info)) | ||
1836 | return -ENOENT; | ||
1837 | /* Possible success: event has been queued */ | ||
1838 | return 0; | ||
1839 | } /* End Function try_modload */ | ||
1840 | |||
1841 | /* Superblock operations follow */ | ||
1842 | |||
1843 | static struct inode_operations devfs_iops; | ||
1844 | static struct inode_operations devfs_dir_iops; | ||
1845 | static const struct file_operations devfs_fops; | ||
1846 | static const struct file_operations devfs_dir_fops; | ||
1847 | static struct inode_operations devfs_symlink_iops; | ||
1848 | |||
1849 | static int devfs_notify_change(struct dentry *dentry, struct iattr *iattr) | ||
1850 | { | ||
1851 | int retval; | ||
1852 | struct devfs_entry *de; | ||
1853 | struct inode *inode = dentry->d_inode; | ||
1854 | struct fs_info *fs_info = inode->i_sb->s_fs_info; | ||
1855 | |||
1856 | de = get_devfs_entry_from_vfs_inode(inode); | ||
1857 | if (de == NULL) | ||
1858 | return -ENODEV; | ||
1859 | retval = inode_change_ok(inode, iattr); | ||
1860 | if (retval != 0) | ||
1861 | return retval; | ||
1862 | retval = inode_setattr(inode, iattr); | ||
1863 | if (retval != 0) | ||
1864 | return retval; | ||
1865 | DPRINTK(DEBUG_I_CHANGE, "(%d): VFS inode: %p devfs_entry: %p\n", | ||
1866 | (int)inode->i_ino, inode, de); | ||
1867 | DPRINTK(DEBUG_I_CHANGE, "(): mode: 0%o uid: %d gid: %d\n", | ||
1868 | (int)inode->i_mode, (int)inode->i_uid, (int)inode->i_gid); | ||
1869 | /* Inode is not on hash chains, thus must save permissions here rather | ||
1870 | than in a write_inode() method */ | ||
1871 | de->mode = inode->i_mode; | ||
1872 | de->inode.uid = inode->i_uid; | ||
1873 | de->inode.gid = inode->i_gid; | ||
1874 | de->inode.atime = inode->i_atime; | ||
1875 | de->inode.mtime = inode->i_mtime; | ||
1876 | de->inode.ctime = inode->i_ctime; | ||
1877 | if ((iattr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) && | ||
1878 | !is_devfsd_or_child(fs_info)) | ||
1879 | devfsd_notify_de(de, DEVFSD_NOTIFY_CHANGE, inode->i_mode, | ||
1880 | inode->i_uid, inode->i_gid, fs_info); | ||
1881 | return 0; | ||
1882 | } /* End Function devfs_notify_change */ | ||
1883 | |||
1884 | static struct super_operations devfs_sops = { | ||
1885 | .drop_inode = generic_delete_inode, | ||
1886 | .statfs = simple_statfs, | ||
1887 | }; | ||
1888 | |||
1889 | /** | ||
1890 | * _devfs_get_vfs_inode - Get a VFS inode. | ||
1891 | * @sb: The super block. | ||
1892 | * @de: The devfs inode. | ||
1893 | * @dentry: The dentry to register with the devfs inode. | ||
1894 | * | ||
1895 | * Returns the inode on success, else %NULL. An implicit devfs_get() is | ||
1896 | * performed if the inode is created. | ||
1897 | */ | ||
1898 | |||
1899 | static struct inode *_devfs_get_vfs_inode(struct super_block *sb, | ||
1900 | struct devfs_entry *de, | ||
1901 | struct dentry *dentry) | ||
1902 | { | ||
1903 | struct inode *inode; | ||
1904 | |||
1905 | if (de->prev == de) | ||
1906 | return NULL; /* Quick check to see if unhooked */ | ||
1907 | if ((inode = new_inode(sb)) == NULL) { | ||
1908 | PRINTK("(%s): new_inode() failed, de: %p\n", de->name, de); | ||
1909 | return NULL; | ||
1910 | } | ||
1911 | if (de->parent) { | ||
1912 | read_lock(&de->parent->u.dir.lock); | ||
1913 | if (de->prev != de) | ||
1914 | de->inode.dentry = dentry; /* Not unhooked */ | ||
1915 | read_unlock(&de->parent->u.dir.lock); | ||
1916 | } else | ||
1917 | de->inode.dentry = dentry; /* Root: no locking needed */ | ||
1918 | if (de->inode.dentry != dentry) { /* Must have been unhooked */ | ||
1919 | iput(inode); | ||
1920 | return NULL; | ||
1921 | } | ||
1922 | /* FIXME where is devfs_put? */ | ||
1923 | inode->u.generic_ip = devfs_get(de); | ||
1924 | inode->i_ino = de->inode.ino; | ||
1925 | DPRINTK(DEBUG_I_GET, "(%d): VFS inode: %p devfs_entry: %p\n", | ||
1926 | (int)inode->i_ino, inode, de); | ||
1927 | inode->i_blocks = 0; | ||
1928 | inode->i_blksize = FAKE_BLOCK_SIZE; | ||
1929 | inode->i_op = &devfs_iops; | ||
1930 | inode->i_mode = de->mode; | ||
1931 | if (S_ISDIR(de->mode)) { | ||
1932 | inode->i_op = &devfs_dir_iops; | ||
1933 | inode->i_fop = &devfs_dir_fops; | ||
1934 | } else if (S_ISLNK(de->mode)) { | ||
1935 | inode->i_op = &devfs_symlink_iops; | ||
1936 | inode->i_size = de->u.symlink.length; | ||
1937 | } else if (S_ISCHR(de->mode) || S_ISBLK(de->mode)) { | ||
1938 | init_special_inode(inode, de->mode, de->u.dev); | ||
1939 | } else if (S_ISFIFO(de->mode) || S_ISSOCK(de->mode)) { | ||
1940 | init_special_inode(inode, de->mode, 0); | ||
1941 | } else { | ||
1942 | PRINTK("(%s): unknown mode %o de: %p\n", | ||
1943 | de->name, de->mode, de); | ||
1944 | iput(inode); | ||
1945 | devfs_put(de); | ||
1946 | return NULL; | ||
1947 | } | ||
1948 | |||
1949 | inode->i_uid = de->inode.uid; | ||
1950 | inode->i_gid = de->inode.gid; | ||
1951 | inode->i_atime = de->inode.atime; | ||
1952 | inode->i_mtime = de->inode.mtime; | ||
1953 | inode->i_ctime = de->inode.ctime; | ||
1954 | DPRINTK(DEBUG_I_GET, "(): mode: 0%o uid: %d gid: %d\n", | ||
1955 | (int)inode->i_mode, (int)inode->i_uid, (int)inode->i_gid); | ||
1956 | return inode; | ||
1957 | } /* End Function _devfs_get_vfs_inode */ | ||
1958 | |||
1959 | /* File operations for device entries follow */ | ||
1960 | |||
1961 | static int devfs_readdir(struct file *file, void *dirent, filldir_t filldir) | ||
1962 | { | ||
1963 | int err, count; | ||
1964 | int stored = 0; | ||
1965 | struct fs_info *fs_info; | ||
1966 | struct devfs_entry *parent, *de, *next = NULL; | ||
1967 | struct inode *inode = file->f_dentry->d_inode; | ||
1968 | |||
1969 | fs_info = inode->i_sb->s_fs_info; | ||
1970 | parent = get_devfs_entry_from_vfs_inode(file->f_dentry->d_inode); | ||
1971 | if ((long)file->f_pos < 0) | ||
1972 | return -EINVAL; | ||
1973 | DPRINTK(DEBUG_F_READDIR, "(%s): fs_info: %p pos: %ld\n", | ||
1974 | parent->name, fs_info, (long)file->f_pos); | ||
1975 | switch ((long)file->f_pos) { | ||
1976 | case 0: | ||
1977 | err = (*filldir) (dirent, "..", 2, file->f_pos, | ||
1978 | parent_ino(file->f_dentry), DT_DIR); | ||
1979 | if (err == -EINVAL) | ||
1980 | break; | ||
1981 | if (err < 0) | ||
1982 | return err; | ||
1983 | file->f_pos++; | ||
1984 | ++stored; | ||
1985 | /* Fall through */ | ||
1986 | case 1: | ||
1987 | err = | ||
1988 | (*filldir) (dirent, ".", 1, file->f_pos, inode->i_ino, | ||
1989 | DT_DIR); | ||
1990 | if (err == -EINVAL) | ||
1991 | break; | ||
1992 | if (err < 0) | ||
1993 | return err; | ||
1994 | file->f_pos++; | ||
1995 | ++stored; | ||
1996 | /* Fall through */ | ||
1997 | default: | ||
1998 | /* Skip entries */ | ||
1999 | count = file->f_pos - 2; | ||
2000 | read_lock(&parent->u.dir.lock); | ||
2001 | for (de = parent->u.dir.first; de && (count > 0); de = de->next) | ||
2002 | --count; | ||
2003 | devfs_get(de); | ||
2004 | read_unlock(&parent->u.dir.lock); | ||
2005 | /* Now add all remaining entries */ | ||
2006 | while (de) { | ||
2007 | err = (*filldir) (dirent, de->name, de->namelen, | ||
2008 | file->f_pos, de->inode.ino, | ||
2009 | de->mode >> 12); | ||
2010 | if (err < 0) | ||
2011 | devfs_put(de); | ||
2012 | else { | ||
2013 | file->f_pos++; | ||
2014 | ++stored; | ||
2015 | } | ||
2016 | if (err == -EINVAL) | ||
2017 | break; | ||
2018 | if (err < 0) | ||
2019 | return err; | ||
2020 | read_lock(&parent->u.dir.lock); | ||
2021 | next = devfs_get(de->next); | ||
2022 | read_unlock(&parent->u.dir.lock); | ||
2023 | devfs_put(de); | ||
2024 | de = next; | ||
2025 | } | ||
2026 | break; | ||
2027 | } | ||
2028 | return stored; | ||
2029 | } /* End Function devfs_readdir */ | ||
2030 | |||
2031 | /* Open devfs specific special files */ | ||
2032 | static int devfs_open(struct inode *inode, struct file *file) | ||
2033 | { | ||
2034 | int err; | ||
2035 | int minor = MINOR(inode->i_rdev); | ||
2036 | struct file_operations *old_fops, *new_fops; | ||
2037 | |||
2038 | switch (minor) { | ||
2039 | case 0: /* /dev/.devfsd */ | ||
2040 | new_fops = fops_get(&devfsd_fops); | ||
2041 | break; | ||
2042 | #ifdef CONFIG_DEVFS_DEBUG | ||
2043 | case 1: /* /dev/.stat */ | ||
2044 | new_fops = fops_get(&stat_fops); | ||
2045 | break; | ||
2046 | #endif | ||
2047 | default: | ||
2048 | return -ENODEV; | ||
2049 | } | ||
2050 | |||
2051 | if (new_fops == NULL) | ||
2052 | return -ENODEV; | ||
2053 | old_fops = file->f_op; | ||
2054 | file->f_op = new_fops; | ||
2055 | err = new_fops->open ? new_fops->open(inode, file) : 0; | ||
2056 | if (err) { | ||
2057 | file->f_op = old_fops; | ||
2058 | fops_put(new_fops); | ||
2059 | } else | ||
2060 | fops_put(old_fops); | ||
2061 | return err; | ||
2062 | } /* End Function devfs_open */ | ||
2063 | |||
2064 | static const struct file_operations devfs_fops = { | ||
2065 | .open = devfs_open, | ||
2066 | }; | ||
2067 | |||
2068 | static const struct file_operations devfs_dir_fops = { | ||
2069 | .read = generic_read_dir, | ||
2070 | .readdir = devfs_readdir, | ||
2071 | }; | ||
2072 | |||
2073 | /* Dentry operations for device entries follow */ | ||
2074 | |||
2075 | /** | ||
2076 | * devfs_d_release - Callback for when a dentry is freed. | ||
2077 | * @dentry: The dentry. | ||
2078 | */ | ||
2079 | |||
2080 | static void devfs_d_release(struct dentry *dentry) | ||
2081 | { | ||
2082 | DPRINTK(DEBUG_D_RELEASE, "(%p): inode: %p\n", dentry, dentry->d_inode); | ||
2083 | } /* End Function devfs_d_release */ | ||
2084 | |||
2085 | /** | ||
2086 | * devfs_d_iput - Callback for when a dentry loses its inode. | ||
2087 | * @dentry: The dentry. | ||
2088 | * @inode: The inode. | ||
2089 | */ | ||
2090 | |||
2091 | static void devfs_d_iput(struct dentry *dentry, struct inode *inode) | ||
2092 | { | ||
2093 | struct devfs_entry *de; | ||
2094 | |||
2095 | de = get_devfs_entry_from_vfs_inode(inode); | ||
2096 | DPRINTK(DEBUG_D_IPUT, | ||
2097 | "(%s): dentry: %p inode: %p de: %p de->dentry: %p\n", de->name, | ||
2098 | dentry, inode, de, de->inode.dentry); | ||
2099 | if (de->inode.dentry && (de->inode.dentry != dentry)) | ||
2100 | OOPS("(%s): de: %p dentry: %p de->dentry: %p\n", | ||
2101 | de->name, de, dentry, de->inode.dentry); | ||
2102 | de->inode.dentry = NULL; | ||
2103 | iput(inode); | ||
2104 | devfs_put(de); | ||
2105 | } /* End Function devfs_d_iput */ | ||
2106 | |||
2107 | static int devfs_d_delete(struct dentry *dentry); | ||
2108 | |||
2109 | static struct dentry_operations devfs_dops = { | ||
2110 | .d_delete = devfs_d_delete, | ||
2111 | .d_release = devfs_d_release, | ||
2112 | .d_iput = devfs_d_iput, | ||
2113 | }; | ||
2114 | |||
2115 | static int devfs_d_revalidate_wait(struct dentry *dentry, struct nameidata *); | ||
2116 | |||
2117 | static struct dentry_operations devfs_wait_dops = { | ||
2118 | .d_delete = devfs_d_delete, | ||
2119 | .d_release = devfs_d_release, | ||
2120 | .d_iput = devfs_d_iput, | ||
2121 | .d_revalidate = devfs_d_revalidate_wait, | ||
2122 | }; | ||
2123 | |||
2124 | /** | ||
2125 | * devfs_d_delete - Callback for when all files for a dentry are closed. | ||
2126 | * @dentry: The dentry. | ||
2127 | */ | ||
2128 | |||
2129 | static int devfs_d_delete(struct dentry *dentry) | ||
2130 | { | ||
2131 | struct inode *inode = dentry->d_inode; | ||
2132 | |||
2133 | if (dentry->d_op == &devfs_wait_dops) | ||
2134 | dentry->d_op = &devfs_dops; | ||
2135 | /* Unhash dentry if negative (has no inode) */ | ||
2136 | if (inode == NULL) { | ||
2137 | DPRINTK(DEBUG_D_DELETE, "(%p): dropping negative dentry\n", | ||
2138 | dentry); | ||
2139 | return 1; | ||
2140 | } | ||
2141 | return 0; | ||
2142 | } /* End Function devfs_d_delete */ | ||
2143 | |||
2144 | struct devfs_lookup_struct { | ||
2145 | devfs_handle_t de; | ||
2146 | wait_queue_head_t wait_queue; | ||
2147 | }; | ||
2148 | |||
2149 | /* XXX: this doesn't handle the case where we got a negative dentry | ||
2150 | but a devfs entry has been registered in the meanwhile */ | ||
2151 | static int devfs_d_revalidate_wait(struct dentry *dentry, struct nameidata *nd) | ||
2152 | { | ||
2153 | struct inode *dir = dentry->d_parent->d_inode; | ||
2154 | struct fs_info *fs_info = dir->i_sb->s_fs_info; | ||
2155 | devfs_handle_t parent = get_devfs_entry_from_vfs_inode(dir); | ||
2156 | struct devfs_lookup_struct *lookup_info = dentry->d_fsdata; | ||
2157 | DECLARE_WAITQUEUE(wait, current); | ||
2158 | int need_lock; | ||
2159 | |||
2160 | /* | ||
2161 | * FIXME HACK | ||
2162 | * | ||
2163 | * make sure that | ||
2164 | * d_instantiate always runs under lock | ||
2165 | * we release i_mutex lock before going to sleep | ||
2166 | * | ||
2167 | * unfortunately sometimes d_revalidate is called with | ||
2168 | * and sometimes without i_mutex lock held. The following checks | ||
2169 | * attempt to deduce when we need to add (and drop resp.) lock | ||
2170 | * here. This relies on current (2.6.2) calling coventions: | ||
2171 | * | ||
2172 | * lookup_hash is always run under i_mutex and is passing NULL | ||
2173 | * as nd | ||
2174 | * | ||
2175 | * open(...,O_CREATE,...) calls _lookup_hash under i_mutex | ||
2176 | * and sets flags to LOOKUP_OPEN|LOOKUP_CREATE | ||
2177 | * | ||
2178 | * all other invocations of ->d_revalidate seem to happen | ||
2179 | * outside of i_mutex | ||
2180 | */ | ||
2181 | need_lock = nd && | ||
2182 | (!(nd->flags & LOOKUP_CREATE) || (nd->flags & LOOKUP_PARENT)); | ||
2183 | |||
2184 | if (need_lock) | ||
2185 | mutex_lock(&dir->i_mutex); | ||
2186 | |||
2187 | if (is_devfsd_or_child(fs_info)) { | ||
2188 | devfs_handle_t de = lookup_info->de; | ||
2189 | struct inode *inode; | ||
2190 | |||
2191 | DPRINTK(DEBUG_I_LOOKUP, | ||
2192 | "(%s): dentry: %p inode: %p de: %p by: \"%s\"\n", | ||
2193 | dentry->d_name.name, dentry, dentry->d_inode, de, | ||
2194 | current->comm); | ||
2195 | if (dentry->d_inode) | ||
2196 | goto out; | ||
2197 | if (de == NULL) { | ||
2198 | read_lock(&parent->u.dir.lock); | ||
2199 | de = _devfs_search_dir(parent, dentry->d_name.name, | ||
2200 | dentry->d_name.len); | ||
2201 | read_unlock(&parent->u.dir.lock); | ||
2202 | if (de == NULL) | ||
2203 | goto out; | ||
2204 | lookup_info->de = de; | ||
2205 | } | ||
2206 | /* Create an inode, now that the driver information is available */ | ||
2207 | inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry); | ||
2208 | if (!inode) | ||
2209 | goto out; | ||
2210 | DPRINTK(DEBUG_I_LOOKUP, | ||
2211 | "(%s): new VFS inode(%u): %p de: %p by: \"%s\"\n", | ||
2212 | de->name, de->inode.ino, inode, de, current->comm); | ||
2213 | d_instantiate(dentry, inode); | ||
2214 | goto out; | ||
2215 | } | ||
2216 | if (lookup_info == NULL) | ||
2217 | goto out; /* Early termination */ | ||
2218 | read_lock(&parent->u.dir.lock); | ||
2219 | if (dentry->d_fsdata) { | ||
2220 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
2221 | add_wait_queue(&lookup_info->wait_queue, &wait); | ||
2222 | read_unlock(&parent->u.dir.lock); | ||
2223 | /* at this point it is always (hopefully) locked */ | ||
2224 | mutex_unlock(&dir->i_mutex); | ||
2225 | schedule(); | ||
2226 | mutex_lock(&dir->i_mutex); | ||
2227 | /* | ||
2228 | * This does not need nor should remove wait from wait_queue. | ||
2229 | * Wait queue head is never reused - nothing is ever added to it | ||
2230 | * after all waiters have been waked up and head itself disappears | ||
2231 | * very soon after it. Moreover it is local variable on stack that | ||
2232 | * is likely to have already disappeared so any reference to it | ||
2233 | * at this point is buggy. | ||
2234 | */ | ||
2235 | |||
2236 | } else | ||
2237 | read_unlock(&parent->u.dir.lock); | ||
2238 | |||
2239 | out: | ||
2240 | if (need_lock) | ||
2241 | mutex_unlock(&dir->i_mutex); | ||
2242 | return 1; | ||
2243 | } /* End Function devfs_d_revalidate_wait */ | ||
2244 | |||
2245 | /* Inode operations for device entries follow */ | ||
2246 | |||
2247 | static struct dentry *devfs_lookup(struct inode *dir, struct dentry *dentry, | ||
2248 | struct nameidata *nd) | ||
2249 | { | ||
2250 | struct devfs_entry tmp; /* Must stay in scope until devfsd idle again */ | ||
2251 | struct devfs_lookup_struct lookup_info; | ||
2252 | struct fs_info *fs_info = dir->i_sb->s_fs_info; | ||
2253 | struct devfs_entry *parent, *de; | ||
2254 | struct inode *inode; | ||
2255 | struct dentry *retval = NULL; | ||
2256 | |||
2257 | /* Set up the dentry operations before anything else, to ensure cleaning | ||
2258 | up on any error */ | ||
2259 | dentry->d_op = &devfs_dops; | ||
2260 | /* First try to get the devfs entry for this directory */ | ||
2261 | parent = get_devfs_entry_from_vfs_inode(dir); | ||
2262 | DPRINTK(DEBUG_I_LOOKUP, "(%s): dentry: %p parent: %p by: \"%s\"\n", | ||
2263 | dentry->d_name.name, dentry, parent, current->comm); | ||
2264 | if (parent == NULL) | ||
2265 | return ERR_PTR(-ENOENT); | ||
2266 | read_lock(&parent->u.dir.lock); | ||
2267 | de = _devfs_search_dir(parent, dentry->d_name.name, dentry->d_name.len); | ||
2268 | read_unlock(&parent->u.dir.lock); | ||
2269 | lookup_info.de = de; | ||
2270 | init_waitqueue_head(&lookup_info.wait_queue); | ||
2271 | dentry->d_fsdata = &lookup_info; | ||
2272 | if (de == NULL) { /* Try with devfsd. For any kind of failure, leave a negative dentry | ||
2273 | so someone else can deal with it (in the case where the sysadmin | ||
2274 | does a mknod()). It's important to do this before hashing the | ||
2275 | dentry, so that the devfsd queue is filled before revalidates | ||
2276 | can start */ | ||
2277 | if (try_modload(parent, fs_info, dentry->d_name.name, dentry->d_name.len, &tmp) < 0) { /* Lookup event was not queued to devfsd */ | ||
2278 | d_add(dentry, NULL); | ||
2279 | return NULL; | ||
2280 | } | ||
2281 | } | ||
2282 | dentry->d_op = &devfs_wait_dops; | ||
2283 | d_add(dentry, NULL); /* Open the floodgates */ | ||
2284 | /* Unlock directory semaphore, which will release any waiters. They | ||
2285 | will get the hashed dentry, and may be forced to wait for | ||
2286 | revalidation */ | ||
2287 | mutex_unlock(&dir->i_mutex); | ||
2288 | wait_for_devfsd_finished(fs_info); /* If I'm not devfsd, must wait */ | ||
2289 | mutex_lock(&dir->i_mutex); /* Grab it again because them's the rules */ | ||
2290 | de = lookup_info.de; | ||
2291 | /* If someone else has been so kind as to make the inode, we go home | ||
2292 | early */ | ||
2293 | if (dentry->d_inode) | ||
2294 | goto out; | ||
2295 | if (de == NULL) { | ||
2296 | read_lock(&parent->u.dir.lock); | ||
2297 | de = _devfs_search_dir(parent, dentry->d_name.name, | ||
2298 | dentry->d_name.len); | ||
2299 | read_unlock(&parent->u.dir.lock); | ||
2300 | if (de == NULL) | ||
2301 | goto out; | ||
2302 | /* OK, there's an entry now, but no VFS inode yet */ | ||
2303 | } | ||
2304 | /* Create an inode, now that the driver information is available */ | ||
2305 | inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry); | ||
2306 | if (!inode) { | ||
2307 | retval = ERR_PTR(-ENOMEM); | ||
2308 | goto out; | ||
2309 | } | ||
2310 | DPRINTK(DEBUG_I_LOOKUP, | ||
2311 | "(%s): new VFS inode(%u): %p de: %p by: \"%s\"\n", de->name, | ||
2312 | de->inode.ino, inode, de, current->comm); | ||
2313 | d_instantiate(dentry, inode); | ||
2314 | out: | ||
2315 | write_lock(&parent->u.dir.lock); | ||
2316 | dentry->d_op = &devfs_dops; | ||
2317 | dentry->d_fsdata = NULL; | ||
2318 | wake_up(&lookup_info.wait_queue); | ||
2319 | write_unlock(&parent->u.dir.lock); | ||
2320 | devfs_put(de); | ||
2321 | return retval; | ||
2322 | } /* End Function devfs_lookup */ | ||
2323 | |||
2324 | static int devfs_unlink(struct inode *dir, struct dentry *dentry) | ||
2325 | { | ||
2326 | int unhooked; | ||
2327 | struct devfs_entry *de; | ||
2328 | struct inode *inode = dentry->d_inode; | ||
2329 | struct fs_info *fs_info = dir->i_sb->s_fs_info; | ||
2330 | |||
2331 | de = get_devfs_entry_from_vfs_inode(inode); | ||
2332 | DPRINTK(DEBUG_I_UNLINK, "(%s): de: %p\n", dentry->d_name.name, de); | ||
2333 | if (de == NULL) | ||
2334 | return -ENOENT; | ||
2335 | if (!de->vfs) | ||
2336 | return -EPERM; | ||
2337 | write_lock(&de->parent->u.dir.lock); | ||
2338 | unhooked = _devfs_unhook(de); | ||
2339 | write_unlock(&de->parent->u.dir.lock); | ||
2340 | if (!unhooked) | ||
2341 | return -ENOENT; | ||
2342 | if (!is_devfsd_or_child(fs_info)) | ||
2343 | devfsd_notify_de(de, DEVFSD_NOTIFY_DELETE, inode->i_mode, | ||
2344 | inode->i_uid, inode->i_gid, fs_info); | ||
2345 | free_dentry(de); | ||
2346 | devfs_put(de); | ||
2347 | return 0; | ||
2348 | } /* End Function devfs_unlink */ | ||
2349 | |||
2350 | static int devfs_symlink(struct inode *dir, struct dentry *dentry, | ||
2351 | const char *symname) | ||
2352 | { | ||
2353 | int err; | ||
2354 | struct fs_info *fs_info = dir->i_sb->s_fs_info; | ||
2355 | struct devfs_entry *parent, *de; | ||
2356 | struct inode *inode; | ||
2357 | |||
2358 | /* First try to get the devfs entry for this directory */ | ||
2359 | parent = get_devfs_entry_from_vfs_inode(dir); | ||
2360 | if (parent == NULL) | ||
2361 | return -ENOENT; | ||
2362 | err = devfs_do_symlink(parent, dentry->d_name.name, symname, &de); | ||
2363 | DPRINTK(DEBUG_DISABLED, "(%s): errcode from <devfs_do_symlink>: %d\n", | ||
2364 | dentry->d_name.name, err); | ||
2365 | if (err < 0) | ||
2366 | return err; | ||
2367 | de->vfs = TRUE; | ||
2368 | de->inode.uid = current->euid; | ||
2369 | de->inode.gid = current->egid; | ||
2370 | de->inode.atime = CURRENT_TIME; | ||
2371 | de->inode.mtime = CURRENT_TIME; | ||
2372 | de->inode.ctime = CURRENT_TIME; | ||
2373 | if ((inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry)) == NULL) | ||
2374 | return -ENOMEM; | ||
2375 | DPRINTK(DEBUG_DISABLED, "(%s): new VFS inode(%u): %p dentry: %p\n", | ||
2376 | dentry->d_name.name, de->inode.ino, inode, dentry); | ||
2377 | d_instantiate(dentry, inode); | ||
2378 | if (!is_devfsd_or_child(fs_info)) | ||
2379 | devfsd_notify_de(de, DEVFSD_NOTIFY_CREATE, inode->i_mode, | ||
2380 | inode->i_uid, inode->i_gid, fs_info); | ||
2381 | return 0; | ||
2382 | } /* End Function devfs_symlink */ | ||
2383 | |||
2384 | static int devfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | ||
2385 | { | ||
2386 | int err; | ||
2387 | struct fs_info *fs_info = dir->i_sb->s_fs_info; | ||
2388 | struct devfs_entry *parent, *de; | ||
2389 | struct inode *inode; | ||
2390 | |||
2391 | mode = (mode & ~S_IFMT) | S_IFDIR; /* VFS doesn't pass S_IFMT part */ | ||
2392 | parent = get_devfs_entry_from_vfs_inode(dir); | ||
2393 | if (parent == NULL) | ||
2394 | return -ENOENT; | ||
2395 | de = _devfs_alloc_entry(dentry->d_name.name, dentry->d_name.len, mode); | ||
2396 | if (!de) | ||
2397 | return -ENOMEM; | ||
2398 | de->vfs = TRUE; | ||
2399 | if ((err = _devfs_append_entry(parent, de, NULL)) != 0) | ||
2400 | return err; | ||
2401 | de->inode.uid = current->euid; | ||
2402 | de->inode.gid = current->egid; | ||
2403 | de->inode.atime = CURRENT_TIME; | ||
2404 | de->inode.mtime = CURRENT_TIME; | ||
2405 | de->inode.ctime = CURRENT_TIME; | ||
2406 | if ((inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry)) == NULL) | ||
2407 | return -ENOMEM; | ||
2408 | DPRINTK(DEBUG_DISABLED, "(%s): new VFS inode(%u): %p dentry: %p\n", | ||
2409 | dentry->d_name.name, de->inode.ino, inode, dentry); | ||
2410 | d_instantiate(dentry, inode); | ||
2411 | if (!is_devfsd_or_child(fs_info)) | ||
2412 | devfsd_notify_de(de, DEVFSD_NOTIFY_CREATE, inode->i_mode, | ||
2413 | inode->i_uid, inode->i_gid, fs_info); | ||
2414 | return 0; | ||
2415 | } /* End Function devfs_mkdir */ | ||
2416 | |||
2417 | static int devfs_rmdir(struct inode *dir, struct dentry *dentry) | ||
2418 | { | ||
2419 | int err = 0; | ||
2420 | struct devfs_entry *de; | ||
2421 | struct fs_info *fs_info = dir->i_sb->s_fs_info; | ||
2422 | struct inode *inode = dentry->d_inode; | ||
2423 | |||
2424 | if (dir->i_sb->s_fs_info != inode->i_sb->s_fs_info) | ||
2425 | return -EINVAL; | ||
2426 | de = get_devfs_entry_from_vfs_inode(inode); | ||
2427 | if (de == NULL) | ||
2428 | return -ENOENT; | ||
2429 | if (!S_ISDIR(de->mode)) | ||
2430 | return -ENOTDIR; | ||
2431 | if (!de->vfs) | ||
2432 | return -EPERM; | ||
2433 | /* First ensure the directory is empty and will stay that way */ | ||
2434 | write_lock(&de->u.dir.lock); | ||
2435 | if (de->u.dir.first) | ||
2436 | err = -ENOTEMPTY; | ||
2437 | else | ||
2438 | de->u.dir.no_more_additions = TRUE; | ||
2439 | write_unlock(&de->u.dir.lock); | ||
2440 | if (err) | ||
2441 | return err; | ||
2442 | /* Now unhook the directory from its parent */ | ||
2443 | write_lock(&de->parent->u.dir.lock); | ||
2444 | if (!_devfs_unhook(de)) | ||
2445 | err = -ENOENT; | ||
2446 | write_unlock(&de->parent->u.dir.lock); | ||
2447 | if (err) | ||
2448 | return err; | ||
2449 | if (!is_devfsd_or_child(fs_info)) | ||
2450 | devfsd_notify_de(de, DEVFSD_NOTIFY_DELETE, inode->i_mode, | ||
2451 | inode->i_uid, inode->i_gid, fs_info); | ||
2452 | free_dentry(de); | ||
2453 | devfs_put(de); | ||
2454 | return 0; | ||
2455 | } /* End Function devfs_rmdir */ | ||
2456 | |||
2457 | static int devfs_mknod(struct inode *dir, struct dentry *dentry, int mode, | ||
2458 | dev_t rdev) | ||
2459 | { | ||
2460 | int err; | ||
2461 | struct fs_info *fs_info = dir->i_sb->s_fs_info; | ||
2462 | struct devfs_entry *parent, *de; | ||
2463 | struct inode *inode; | ||
2464 | |||
2465 | DPRINTK(DEBUG_I_MKNOD, "(%s): mode: 0%o dev: %u:%u\n", | ||
2466 | dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev)); | ||
2467 | parent = get_devfs_entry_from_vfs_inode(dir); | ||
2468 | if (parent == NULL) | ||
2469 | return -ENOENT; | ||
2470 | de = _devfs_alloc_entry(dentry->d_name.name, dentry->d_name.len, mode); | ||
2471 | if (!de) | ||
2472 | return -ENOMEM; | ||
2473 | de->vfs = TRUE; | ||
2474 | if (S_ISCHR(mode) || S_ISBLK(mode)) | ||
2475 | de->u.dev = rdev; | ||
2476 | if ((err = _devfs_append_entry(parent, de, NULL)) != 0) | ||
2477 | return err; | ||
2478 | de->inode.uid = current->euid; | ||
2479 | de->inode.gid = current->egid; | ||
2480 | de->inode.atime = CURRENT_TIME; | ||
2481 | de->inode.mtime = CURRENT_TIME; | ||
2482 | de->inode.ctime = CURRENT_TIME; | ||
2483 | if ((inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry)) == NULL) | ||
2484 | return -ENOMEM; | ||
2485 | DPRINTK(DEBUG_I_MKNOD, ": new VFS inode(%u): %p dentry: %p\n", | ||
2486 | de->inode.ino, inode, dentry); | ||
2487 | d_instantiate(dentry, inode); | ||
2488 | if (!is_devfsd_or_child(fs_info)) | ||
2489 | devfsd_notify_de(de, DEVFSD_NOTIFY_CREATE, inode->i_mode, | ||
2490 | inode->i_uid, inode->i_gid, fs_info); | ||
2491 | return 0; | ||
2492 | } /* End Function devfs_mknod */ | ||
2493 | |||
2494 | static void *devfs_follow_link(struct dentry *dentry, struct nameidata *nd) | ||
2495 | { | ||
2496 | struct devfs_entry *p = get_devfs_entry_from_vfs_inode(dentry->d_inode); | ||
2497 | nd_set_link(nd, p ? p->u.symlink.linkname : ERR_PTR(-ENODEV)); | ||
2498 | return NULL; | ||
2499 | } /* End Function devfs_follow_link */ | ||
2500 | |||
2501 | static struct inode_operations devfs_iops = { | ||
2502 | .setattr = devfs_notify_change, | ||
2503 | }; | ||
2504 | |||
2505 | static struct inode_operations devfs_dir_iops = { | ||
2506 | .lookup = devfs_lookup, | ||
2507 | .unlink = devfs_unlink, | ||
2508 | .symlink = devfs_symlink, | ||
2509 | .mkdir = devfs_mkdir, | ||
2510 | .rmdir = devfs_rmdir, | ||
2511 | .mknod = devfs_mknod, | ||
2512 | .setattr = devfs_notify_change, | ||
2513 | }; | ||
2514 | |||
2515 | static struct inode_operations devfs_symlink_iops = { | ||
2516 | .readlink = generic_readlink, | ||
2517 | .follow_link = devfs_follow_link, | ||
2518 | .setattr = devfs_notify_change, | ||
2519 | }; | ||
2520 | |||
2521 | static int devfs_fill_super(struct super_block *sb, void *data, int silent) | ||
2522 | { | ||
2523 | struct inode *root_inode = NULL; | ||
2524 | |||
2525 | if (_devfs_get_root_entry() == NULL) | ||
2526 | goto out_no_root; | ||
2527 | atomic_set(&fs_info.devfsd_overrun_count, 0); | ||
2528 | init_waitqueue_head(&fs_info.devfsd_wait_queue); | ||
2529 | init_waitqueue_head(&fs_info.revalidate_wait_queue); | ||
2530 | fs_info.sb = sb; | ||
2531 | sb->s_fs_info = &fs_info; | ||
2532 | sb->s_blocksize = 1024; | ||
2533 | sb->s_blocksize_bits = 10; | ||
2534 | sb->s_magic = DEVFS_SUPER_MAGIC; | ||
2535 | sb->s_op = &devfs_sops; | ||
2536 | sb->s_time_gran = 1; | ||
2537 | if ((root_inode = _devfs_get_vfs_inode(sb, root_entry, NULL)) == NULL) | ||
2538 | goto out_no_root; | ||
2539 | sb->s_root = d_alloc_root(root_inode); | ||
2540 | if (!sb->s_root) | ||
2541 | goto out_no_root; | ||
2542 | DPRINTK(DEBUG_S_READ, "(): made devfs ptr: %p\n", sb->s_fs_info); | ||
2543 | return 0; | ||
2544 | |||
2545 | out_no_root: | ||
2546 | PRINTK("(): get root inode failed\n"); | ||
2547 | if (root_inode) | ||
2548 | iput(root_inode); | ||
2549 | return -EINVAL; | ||
2550 | } /* End Function devfs_fill_super */ | ||
2551 | |||
2552 | static int devfs_get_sb(struct file_system_type *fs_type, | ||
2553 | int flags, const char *dev_name, | ||
2554 | void *data, struct vfsmount *mnt) | ||
2555 | { | ||
2556 | return get_sb_single(fs_type, flags, data, devfs_fill_super, mnt); | ||
2557 | } | ||
2558 | |||
2559 | static struct file_system_type devfs_fs_type = { | ||
2560 | .name = DEVFS_NAME, | ||
2561 | .get_sb = devfs_get_sb, | ||
2562 | .kill_sb = kill_anon_super, | ||
2563 | }; | ||
2564 | |||
2565 | /* File operations for devfsd follow */ | ||
2566 | |||
2567 | static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len, | ||
2568 | loff_t * ppos) | ||
2569 | { | ||
2570 | int done = FALSE; | ||
2571 | int ival; | ||
2572 | loff_t pos, devname_offset, tlen, rpos; | ||
2573 | devfs_handle_t de; | ||
2574 | struct devfsd_buf_entry *entry; | ||
2575 | struct fs_info *fs_info = file->f_dentry->d_inode->i_sb->s_fs_info; | ||
2576 | struct devfsd_notify_struct *info = fs_info->devfsd_info; | ||
2577 | DECLARE_WAITQUEUE(wait, current); | ||
2578 | |||
2579 | /* Verify the task has grabbed the queue */ | ||
2580 | if (fs_info->devfsd_task != current) | ||
2581 | return -EPERM; | ||
2582 | info->major = 0; | ||
2583 | info->minor = 0; | ||
2584 | /* Block for a new entry */ | ||
2585 | set_current_state(TASK_INTERRUPTIBLE); | ||
2586 | add_wait_queue(&fs_info->devfsd_wait_queue, &wait); | ||
2587 | while (devfsd_queue_empty(fs_info)) { | ||
2588 | fs_info->devfsd_sleeping = TRUE; | ||
2589 | wake_up(&fs_info->revalidate_wait_queue); | ||
2590 | schedule(); | ||
2591 | fs_info->devfsd_sleeping = FALSE; | ||
2592 | if (signal_pending(current)) { | ||
2593 | remove_wait_queue(&fs_info->devfsd_wait_queue, &wait); | ||
2594 | __set_current_state(TASK_RUNNING); | ||
2595 | return -EINTR; | ||
2596 | } | ||
2597 | set_current_state(TASK_INTERRUPTIBLE); | ||
2598 | } | ||
2599 | remove_wait_queue(&fs_info->devfsd_wait_queue, &wait); | ||
2600 | __set_current_state(TASK_RUNNING); | ||
2601 | /* Now play with the data */ | ||
2602 | ival = atomic_read(&fs_info->devfsd_overrun_count); | ||
2603 | info->overrun_count = ival; | ||
2604 | entry = fs_info->devfsd_first_event; | ||
2605 | info->type = entry->type; | ||
2606 | info->mode = entry->mode; | ||
2607 | info->uid = entry->uid; | ||
2608 | info->gid = entry->gid; | ||
2609 | de = entry->de; | ||
2610 | if (S_ISCHR(de->mode) || S_ISBLK(de->mode)) { | ||
2611 | info->major = MAJOR(de->u.dev); | ||
2612 | info->minor = MINOR(de->u.dev); | ||
2613 | } | ||
2614 | pos = devfs_generate_path(de, info->devname, DEVFS_PATHLEN); | ||
2615 | if (pos < 0) | ||
2616 | return pos; | ||
2617 | info->namelen = DEVFS_PATHLEN - pos - 1; | ||
2618 | if (info->mode == 0) | ||
2619 | info->mode = de->mode; | ||
2620 | devname_offset = info->devname - (char *)info; | ||
2621 | rpos = *ppos; | ||
2622 | if (rpos < devname_offset) { | ||
2623 | /* Copy parts of the header */ | ||
2624 | tlen = devname_offset - rpos; | ||
2625 | if (tlen > len) | ||
2626 | tlen = len; | ||
2627 | if (copy_to_user(buf, (char *)info + rpos, tlen)) { | ||
2628 | return -EFAULT; | ||
2629 | } | ||
2630 | rpos += tlen; | ||
2631 | buf += tlen; | ||
2632 | len -= tlen; | ||
2633 | } | ||
2634 | if ((rpos >= devname_offset) && (len > 0)) { | ||
2635 | /* Copy the name */ | ||
2636 | tlen = info->namelen + 1; | ||
2637 | if (tlen > len) | ||
2638 | tlen = len; | ||
2639 | else | ||
2640 | done = TRUE; | ||
2641 | if (copy_to_user | ||
2642 | (buf, info->devname + pos + rpos - devname_offset, tlen)) { | ||
2643 | return -EFAULT; | ||
2644 | } | ||
2645 | rpos += tlen; | ||
2646 | } | ||
2647 | tlen = rpos - *ppos; | ||
2648 | if (done) { | ||
2649 | devfs_handle_t parent; | ||
2650 | |||
2651 | spin_lock(&fs_info->devfsd_buffer_lock); | ||
2652 | fs_info->devfsd_first_event = entry->next; | ||
2653 | if (entry->next == NULL) | ||
2654 | fs_info->devfsd_last_event = NULL; | ||
2655 | spin_unlock(&fs_info->devfsd_buffer_lock); | ||
2656 | for (; de != NULL; de = parent) { | ||
2657 | parent = de->parent; | ||
2658 | devfs_put(de); | ||
2659 | } | ||
2660 | kmem_cache_free(devfsd_buf_cache, entry); | ||
2661 | if (ival > 0) | ||
2662 | atomic_sub(ival, &fs_info->devfsd_overrun_count); | ||
2663 | *ppos = 0; | ||
2664 | } else | ||
2665 | *ppos = rpos; | ||
2666 | return tlen; | ||
2667 | } /* End Function devfsd_read */ | ||
2668 | |||
2669 | static int devfsd_ioctl(struct inode *inode, struct file *file, | ||
2670 | unsigned int cmd, unsigned long arg) | ||
2671 | { | ||
2672 | int ival; | ||
2673 | struct fs_info *fs_info = inode->i_sb->s_fs_info; | ||
2674 | |||
2675 | switch (cmd) { | ||
2676 | case DEVFSDIOC_GET_PROTO_REV: | ||
2677 | ival = DEVFSD_PROTOCOL_REVISION_KERNEL; | ||
2678 | if (copy_to_user((void __user *)arg, &ival, sizeof ival)) | ||
2679 | return -EFAULT; | ||
2680 | break; | ||
2681 | case DEVFSDIOC_SET_EVENT_MASK: | ||
2682 | /* Ensure only one reader has access to the queue. This scheme will | ||
2683 | work even if the global kernel lock were to be removed, because it | ||
2684 | doesn't matter who gets in first, as long as only one gets it */ | ||
2685 | if (fs_info->devfsd_task == NULL) { | ||
2686 | static DEFINE_SPINLOCK(lock); | ||
2687 | |||
2688 | if (!spin_trylock(&lock)) | ||
2689 | return -EBUSY; | ||
2690 | if (fs_info->devfsd_task != NULL) { /* We lost the race... */ | ||
2691 | spin_unlock(&lock); | ||
2692 | return -EBUSY; | ||
2693 | } | ||
2694 | fs_info->devfsd_task = current; | ||
2695 | spin_unlock(&lock); | ||
2696 | fs_info->devfsd_pgrp = | ||
2697 | (process_group(current) == | ||
2698 | current->pid) ? process_group(current) : 0; | ||
2699 | fs_info->devfsd_file = file; | ||
2700 | fs_info->devfsd_info = | ||
2701 | kmalloc(sizeof *fs_info->devfsd_info, GFP_KERNEL); | ||
2702 | if (!fs_info->devfsd_info) { | ||
2703 | devfsd_close(inode, file); | ||
2704 | return -ENOMEM; | ||
2705 | } | ||
2706 | } else if (fs_info->devfsd_task != current) | ||
2707 | return -EBUSY; | ||
2708 | fs_info->devfsd_event_mask = arg; /* Let the masses come forth */ | ||
2709 | break; | ||
2710 | case DEVFSDIOC_RELEASE_EVENT_QUEUE: | ||
2711 | if (fs_info->devfsd_file != file) | ||
2712 | return -EPERM; | ||
2713 | return devfsd_close(inode, file); | ||
2714 | /*break; */ | ||
2715 | #ifdef CONFIG_DEVFS_DEBUG | ||
2716 | case DEVFSDIOC_SET_DEBUG_MASK: | ||
2717 | if (copy_from_user(&ival, (void __user *)arg, sizeof ival)) | ||
2718 | return -EFAULT; | ||
2719 | devfs_debug = ival; | ||
2720 | break; | ||
2721 | #endif | ||
2722 | default: | ||
2723 | return -ENOIOCTLCMD; | ||
2724 | } | ||
2725 | return 0; | ||
2726 | } /* End Function devfsd_ioctl */ | ||
2727 | |||
2728 | static int devfsd_close(struct inode *inode, struct file *file) | ||
2729 | { | ||
2730 | struct devfsd_buf_entry *entry, *next; | ||
2731 | struct fs_info *fs_info = inode->i_sb->s_fs_info; | ||
2732 | |||
2733 | if (fs_info->devfsd_file != file) | ||
2734 | return 0; | ||
2735 | fs_info->devfsd_event_mask = 0; | ||
2736 | fs_info->devfsd_file = NULL; | ||
2737 | spin_lock(&fs_info->devfsd_buffer_lock); | ||
2738 | entry = fs_info->devfsd_first_event; | ||
2739 | fs_info->devfsd_first_event = NULL; | ||
2740 | fs_info->devfsd_last_event = NULL; | ||
2741 | kfree(fs_info->devfsd_info); | ||
2742 | fs_info->devfsd_info = NULL; | ||
2743 | spin_unlock(&fs_info->devfsd_buffer_lock); | ||
2744 | fs_info->devfsd_pgrp = 0; | ||
2745 | fs_info->devfsd_task = NULL; | ||
2746 | wake_up(&fs_info->revalidate_wait_queue); | ||
2747 | for (; entry; entry = next) { | ||
2748 | next = entry->next; | ||
2749 | kmem_cache_free(devfsd_buf_cache, entry); | ||
2750 | } | ||
2751 | return 0; | ||
2752 | } /* End Function devfsd_close */ | ||
2753 | |||
2754 | #ifdef CONFIG_DEVFS_DEBUG | ||
2755 | static ssize_t stat_read(struct file *file, char __user *buf, size_t len, | ||
2756 | loff_t * ppos) | ||
2757 | { | ||
2758 | ssize_t num; | ||
2759 | char txt[80]; | ||
2760 | |||
2761 | num = sprintf(txt, "Number of entries: %u number of bytes: %u\n", | ||
2762 | stat_num_entries, stat_num_bytes) + 1; | ||
2763 | if (*ppos >= num) | ||
2764 | return 0; | ||
2765 | if (*ppos + len > num) | ||
2766 | len = num - *ppos; | ||
2767 | if (copy_to_user(buf, txt + *ppos, len)) | ||
2768 | return -EFAULT; | ||
2769 | *ppos += len; | ||
2770 | return len; | ||
2771 | } /* End Function stat_read */ | ||
2772 | #endif | ||
2773 | |||
2774 | static int __init init_devfs_fs(void) | ||
2775 | { | ||
2776 | int err; | ||
2777 | int major; | ||
2778 | struct devfs_entry *devfsd; | ||
2779 | #ifdef CONFIG_DEVFS_DEBUG | ||
2780 | struct devfs_entry *stat; | ||
2781 | #endif | ||
2782 | |||
2783 | if (_devfs_get_root_entry() == NULL) | ||
2784 | return -ENOMEM; | ||
2785 | |||
2786 | printk(KERN_INFO "%s: %s Richard Gooch (rgooch@atnf.csiro.au)\n", | ||
2787 | DEVFS_NAME, DEVFS_VERSION); | ||
2788 | devfsd_buf_cache = kmem_cache_create("devfsd_event", | ||
2789 | sizeof(struct devfsd_buf_entry), | ||
2790 | 0, 0, NULL, NULL); | ||
2791 | if (!devfsd_buf_cache) | ||
2792 | OOPS("(): unable to allocate event slab\n"); | ||
2793 | #ifdef CONFIG_DEVFS_DEBUG | ||
2794 | devfs_debug = devfs_debug_init; | ||
2795 | printk(KERN_INFO "%s: devfs_debug: 0x%0x\n", DEVFS_NAME, devfs_debug); | ||
2796 | #endif | ||
2797 | printk(KERN_INFO "%s: boot_options: 0x%0x\n", DEVFS_NAME, boot_options); | ||
2798 | |||
2799 | /* register special device for devfsd communication */ | ||
2800 | major = register_chrdev(0, "devfs", &devfs_fops); | ||
2801 | if (major < 0) | ||
2802 | return major; | ||
2803 | |||
2804 | /* And create the entry for ".devfsd" */ | ||
2805 | devfsd = _devfs_alloc_entry(".devfsd", 0, S_IFCHR | S_IRUSR | S_IWUSR); | ||
2806 | if (devfsd == NULL) | ||
2807 | return -ENOMEM; | ||
2808 | devfsd->u.dev = MKDEV(major, 0); | ||
2809 | _devfs_append_entry(root_entry, devfsd, NULL); | ||
2810 | |||
2811 | #ifdef CONFIG_DEVFS_DEBUG | ||
2812 | stat = _devfs_alloc_entry(".stat", 0, S_IFCHR | S_IRUGO); | ||
2813 | if (stat == NULL) | ||
2814 | return -ENOMEM; | ||
2815 | stat->u.dev = MKDEV(major, 1); | ||
2816 | _devfs_append_entry(root_entry, stat, NULL); | ||
2817 | #endif | ||
2818 | |||
2819 | err = register_filesystem(&devfs_fs_type); | ||
2820 | return err; | ||
2821 | } /* End Function init_devfs_fs */ | ||
2822 | |||
2823 | void __init mount_devfs_fs(void) | ||
2824 | { | ||
2825 | int err; | ||
2826 | |||
2827 | if (!(boot_options & OPTION_MOUNT)) | ||
2828 | return; | ||
2829 | err = do_mount("none", "/dev", "devfs", 0, NULL); | ||
2830 | if (err == 0) | ||
2831 | printk(KERN_INFO "Mounted devfs on /dev\n"); | ||
2832 | else | ||
2833 | PRINTK("(): unable to mount devfs, err: %d\n", err); | ||
2834 | } /* End Function mount_devfs_fs */ | ||
2835 | |||
2836 | module_init(init_devfs_fs) | ||
diff --git a/fs/devfs/util.c b/fs/devfs/util.c deleted file mode 100644 index db06d388c9ac..000000000000 --- a/fs/devfs/util.c +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | /* devfs (Device FileSystem) utilities. | ||
2 | |||
3 | Copyright (C) 1999-2002 Richard Gooch | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Library General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public | ||
16 | License along with this library; if not, write to the Free | ||
17 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | |||
19 | Richard Gooch may be reached by email at rgooch@atnf.csiro.au | ||
20 | The postal address is: | ||
21 | Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. | ||
22 | |||
23 | ChangeLog | ||
24 | |||
25 | 19991031 Richard Gooch <rgooch@atnf.csiro.au> | ||
26 | Created. | ||
27 | 19991103 Richard Gooch <rgooch@atnf.csiro.au> | ||
28 | Created <_devfs_convert_name> and supported SCSI and IDE CD-ROMs | ||
29 | 20000203 Richard Gooch <rgooch@atnf.csiro.au> | ||
30 | Changed operations pointer type to void *. | ||
31 | 20000621 Richard Gooch <rgooch@atnf.csiro.au> | ||
32 | Changed interface to <devfs_register_series>. | ||
33 | 20000622 Richard Gooch <rgooch@atnf.csiro.au> | ||
34 | Took account of interface change to <devfs_mk_symlink>. | ||
35 | Took account of interface change to <devfs_mk_dir>. | ||
36 | 20010519 Richard Gooch <rgooch@atnf.csiro.au> | ||
37 | Documentation cleanup. | ||
38 | 20010709 Richard Gooch <rgooch@atnf.csiro.au> | ||
39 | Created <devfs_*alloc_major> and <devfs_*alloc_devnum>. | ||
40 | 20010710 Richard Gooch <rgooch@atnf.csiro.au> | ||
41 | Created <devfs_*alloc_unique_number>. | ||
42 | 20010730 Richard Gooch <rgooch@atnf.csiro.au> | ||
43 | Documentation typo fix. | ||
44 | 20010806 Richard Gooch <rgooch@atnf.csiro.au> | ||
45 | Made <block_semaphore> and <char_semaphore> private. | ||
46 | 20010813 Richard Gooch <rgooch@atnf.csiro.au> | ||
47 | Fixed bug in <devfs_alloc_unique_number>: limited to 128 numbers | ||
48 | 20010818 Richard Gooch <rgooch@atnf.csiro.au> | ||
49 | Updated major masks up to Linus' "no new majors" proclamation. | ||
50 | Block: were 126 now 122 free, char: were 26 now 19 free. | ||
51 | 20020324 Richard Gooch <rgooch@atnf.csiro.au> | ||
52 | Fixed bug in <devfs_alloc_unique_number>: was clearing beyond | ||
53 | bitfield. | ||
54 | 20020326 Richard Gooch <rgooch@atnf.csiro.au> | ||
55 | Fixed bitfield data type for <devfs_*alloc_devnum>. | ||
56 | Made major bitfield type and initialiser 64 bit safe. | ||
57 | 20020413 Richard Gooch <rgooch@atnf.csiro.au> | ||
58 | Fixed shift warning on 64 bit machines. | ||
59 | 20020428 Richard Gooch <rgooch@atnf.csiro.au> | ||
60 | Copied and used macro for error messages from fs/devfs/base.c | ||
61 | 20021013 Richard Gooch <rgooch@atnf.csiro.au> | ||
62 | Documentation fix. | ||
63 | 20030101 Adam J. Richter <adam@yggdrasil.com> | ||
64 | Eliminate DEVFS_SPECIAL_{CHR,BLK}. Use mode_t instead. | ||
65 | 20030106 Christoph Hellwig <hch@infradead.org> | ||
66 | Rewrite devfs_{,de}alloc_devnum to look like C code. | ||
67 | */ | ||
68 | #include <linux/module.h> | ||
69 | #include <linux/init.h> | ||
70 | #include <linux/devfs_fs_kernel.h> | ||
71 | #include <linux/slab.h> | ||
72 | #include <linux/vmalloc.h> | ||
73 | #include <linux/genhd.h> | ||
74 | #include <linux/bitops.h> | ||
75 | |||
76 | int devfs_register_tape(const char *name) | ||
77 | { | ||
78 | char tname[32], dest[64]; | ||
79 | static unsigned int tape_counter; | ||
80 | unsigned int n = tape_counter++; | ||
81 | |||
82 | sprintf(dest, "../%s", name); | ||
83 | sprintf(tname, "tapes/tape%u", n); | ||
84 | devfs_mk_symlink(tname, dest); | ||
85 | |||
86 | return n; | ||
87 | } | ||
88 | |||
89 | EXPORT_SYMBOL(devfs_register_tape); | ||
90 | |||
91 | void devfs_unregister_tape(int num) | ||
92 | { | ||
93 | if (num >= 0) | ||
94 | devfs_remove("tapes/tape%u", num); | ||
95 | } | ||
96 | |||
97 | EXPORT_SYMBOL(devfs_unregister_tape); | ||
@@ -22,7 +22,6 @@ | |||
22 | * formats. | 22 | * formats. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/config.h> | ||
26 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
27 | #include <linux/file.h> | 26 | #include <linux/file.h> |
28 | #include <linux/mman.h> | 27 | #include <linux/mman.h> |
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 433a213a8bd9..d4870432ecfc 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 11 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include "ext2.h" | 14 | #include "ext2.h" |
16 | #include <linux/quotaops.h> | 15 | #include <linux/quotaops.h> |
17 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 308c252568c6..de85c61c58c5 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 12 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/quotaops.h> | 15 | #include <linux/quotaops.h> |
17 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
18 | #include <linux/backing-dev.h> | 17 | #include <linux/backing-dev.h> |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index d4233b2e6436..9f43879d6d68 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 16 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/string.h> | 20 | #include <linux/string.h> |
22 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h index 67cfeb66e897..bf8175b2ced9 100644 --- a/fs/ext2/xattr.h +++ b/fs/ext2/xattr.h | |||
@@ -6,7 +6,6 @@ | |||
6 | (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> | 6 | (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/init.h> | 9 | #include <linux/init.h> |
11 | #include <linux/xattr.h> | 10 | #include <linux/xattr.h> |
12 | 11 | ||
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 96172e89ddc3..a504a40d6d29 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 11 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/time.h> | 14 | #include <linux/time.h> |
16 | #include <linux/capability.h> | 15 | #include <linux/capability.h> |
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index dfd811895d8f..5e1337fd878a 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * This could probably be made into a module, because it is not often in use. | 8 | * This could probably be made into a module, because it is not often in use. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | 11 | ||
13 | #define EXT3FS_DEBUG | 12 | #define EXT3FS_DEBUG |
14 | 13 | ||
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index b7483360a2db..f2dd71336612 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 16 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/string.h> | 20 | #include <linux/string.h> |
22 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
diff --git a/fs/ext3/xattr.h b/fs/ext3/xattr.h index 2ceae38f3d49..6b1ae1c6182c 100644 --- a/fs/ext3/xattr.h +++ b/fs/ext3/xattr.h | |||
@@ -6,7 +6,6 @@ | |||
6 | (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> | 6 | (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/xattr.h> | 9 | #include <linux/xattr.h> |
11 | 10 | ||
12 | /* Magic value in attribute blocks */ | 11 | /* Magic value in attribute blocks */ |
diff --git a/fs/file_table.c b/fs/file_table.c index 506d5307108d..0131ba06e1ee 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) | 5 | * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/config.h> | ||
9 | #include <linux/string.h> | 8 | #include <linux/string.h> |
10 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
11 | #include <linux/file.h> | 10 | #include <linux/file.h> |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 031b27a4bc9a..892643dc9af1 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -464,8 +464,8 @@ void sync_inodes_sb(struct super_block *sb, int wait) | |||
464 | .range_start = 0, | 464 | .range_start = 0, |
465 | .range_end = LLONG_MAX, | 465 | .range_end = LLONG_MAX, |
466 | }; | 466 | }; |
467 | unsigned long nr_dirty = read_page_state(nr_dirty); | 467 | unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY); |
468 | unsigned long nr_unstable = read_page_state(nr_unstable); | 468 | unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS); |
469 | 469 | ||
470 | wbc.nr_to_write = nr_dirty + nr_unstable + | 470 | wbc.nr_to_write = nr_dirty + nr_unstable + |
471 | (inodes_stat.nr_inodes - inodes_stat.nr_unused) + | 471 | (inodes_stat.nr_inodes - inodes_stat.nr_unused) + |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index d9227bf14e86..34937ee83ab1 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * Based on the minix file system code, (C) 1991, 1992 by Linus Torvalds | 12 | * Based on the minix file system code, (C) 1991, 1992 by Linus Torvalds |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/blkdev.h> | 16 | #include <linux/blkdev.h> |
18 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 0a92fa2336a2..d279d5924f28 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/config.h> | ||
11 | #include <linux/module.h> | 10 | #include <linux/module.h> |
12 | #include <linux/init.h> | 11 | #include <linux/init.h> |
13 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
diff --git a/fs/inode.c b/fs/inode.c index f42961eb983b..0bf9f0444a96 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -4,7 +4,6 @@ | |||
4 | * (C) 1997 Linus Torvalds | 4 | * (C) 1997 Linus Torvalds |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/fs.h> | 7 | #include <linux/fs.h> |
9 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
10 | #include <linux/dcache.h> | 9 | #include <linux/dcache.h> |
@@ -452,15 +451,14 @@ static void prune_icache(int nr_to_scan) | |||
452 | nr_pruned++; | 451 | nr_pruned++; |
453 | } | 452 | } |
454 | inodes_stat.nr_unused -= nr_pruned; | 453 | inodes_stat.nr_unused -= nr_pruned; |
454 | if (current_is_kswapd()) | ||
455 | __count_vm_events(KSWAPD_INODESTEAL, reap); | ||
456 | else | ||
457 | __count_vm_events(PGINODESTEAL, reap); | ||
455 | spin_unlock(&inode_lock); | 458 | spin_unlock(&inode_lock); |
456 | 459 | ||
457 | dispose_list(&freeable); | 460 | dispose_list(&freeable); |
458 | mutex_unlock(&iprune_mutex); | 461 | mutex_unlock(&iprune_mutex); |
459 | |||
460 | if (current_is_kswapd()) | ||
461 | mod_page_state(kswapd_inodesteal, reap); | ||
462 | else | ||
463 | mod_page_state(pginodesteal, reap); | ||
464 | } | 462 | } |
465 | 463 | ||
466 | /* | 464 | /* |
diff --git a/fs/ioctl.c b/fs/ioctl.c index f8aeec3ca10c..4b7660b09ac0 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -4,7 +4,6 @@ | |||
4 | * Copyright (C) 1991, 1992 Linus Torvalds | 4 | * Copyright (C) 1991, 1992 Linus Torvalds |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/syscalls.h> | 7 | #include <linux/syscalls.h> |
9 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
10 | #include <linux/smp_lock.h> | 9 | #include <linux/smp_lock.h> |
diff --git a/fs/ioprio.c b/fs/ioprio.c index 7fa76ed53c10..93aa5715f224 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c | |||
@@ -125,11 +125,24 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio) | |||
125 | return ret; | 125 | return ret; |
126 | } | 126 | } |
127 | 127 | ||
128 | static int get_task_ioprio(struct task_struct *p) | ||
129 | { | ||
130 | int ret; | ||
131 | |||
132 | ret = security_task_getioprio(p); | ||
133 | if (ret) | ||
134 | goto out; | ||
135 | ret = p->ioprio; | ||
136 | out: | ||
137 | return ret; | ||
138 | } | ||
139 | |||
128 | asmlinkage long sys_ioprio_get(int which, int who) | 140 | asmlinkage long sys_ioprio_get(int which, int who) |
129 | { | 141 | { |
130 | struct task_struct *g, *p; | 142 | struct task_struct *g, *p; |
131 | struct user_struct *user; | 143 | struct user_struct *user; |
132 | int ret = -ESRCH; | 144 | int ret = -ESRCH; |
145 | int tmpio; | ||
133 | 146 | ||
134 | read_lock_irq(&tasklist_lock); | 147 | read_lock_irq(&tasklist_lock); |
135 | switch (which) { | 148 | switch (which) { |
@@ -139,16 +152,19 @@ asmlinkage long sys_ioprio_get(int which, int who) | |||
139 | else | 152 | else |
140 | p = find_task_by_pid(who); | 153 | p = find_task_by_pid(who); |
141 | if (p) | 154 | if (p) |
142 | ret = p->ioprio; | 155 | ret = get_task_ioprio(p); |
143 | break; | 156 | break; |
144 | case IOPRIO_WHO_PGRP: | 157 | case IOPRIO_WHO_PGRP: |
145 | if (!who) | 158 | if (!who) |
146 | who = process_group(current); | 159 | who = process_group(current); |
147 | do_each_task_pid(who, PIDTYPE_PGID, p) { | 160 | do_each_task_pid(who, PIDTYPE_PGID, p) { |
161 | tmpio = get_task_ioprio(p); | ||
162 | if (tmpio < 0) | ||
163 | continue; | ||
148 | if (ret == -ESRCH) | 164 | if (ret == -ESRCH) |
149 | ret = p->ioprio; | 165 | ret = tmpio; |
150 | else | 166 | else |
151 | ret = ioprio_best(ret, p->ioprio); | 167 | ret = ioprio_best(ret, tmpio); |
152 | } while_each_task_pid(who, PIDTYPE_PGID, p); | 168 | } while_each_task_pid(who, PIDTYPE_PGID, p); |
153 | break; | 169 | break; |
154 | case IOPRIO_WHO_USER: | 170 | case IOPRIO_WHO_USER: |
@@ -163,10 +179,13 @@ asmlinkage long sys_ioprio_get(int which, int who) | |||
163 | do_each_thread(g, p) { | 179 | do_each_thread(g, p) { |
164 | if (p->uid != user->uid) | 180 | if (p->uid != user->uid) |
165 | continue; | 181 | continue; |
182 | tmpio = get_task_ioprio(p); | ||
183 | if (tmpio < 0) | ||
184 | continue; | ||
166 | if (ret == -ESRCH) | 185 | if (ret == -ESRCH) |
167 | ret = p->ioprio; | 186 | ret = tmpio; |
168 | else | 187 | else |
169 | ret = ioprio_best(ret, p->ioprio); | 188 | ret = ioprio_best(ret, tmpio); |
170 | } while_each_thread(g, p); | 189 | } while_each_thread(g, p); |
171 | 190 | ||
172 | if (who) | 191 | if (who) |
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c index 3a39158cca96..731816332b12 100644 --- a/fs/isofs/compress.c +++ b/fs/isofs/compress.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * Transparent decompression of files on an iso9660 filesystem | 16 | * Transparent decompression of files on an iso9660 filesystem |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/init.h> | 20 | #include <linux/init.h> |
22 | 21 | ||
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 5440ea292c69..27e276987fd2 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * | 10 | * |
11 | * isofs directory handling functions | 11 | * isofs directory handling functions |
12 | */ | 12 | */ |
13 | #include <linux/config.h> | ||
14 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
15 | #include "isofs.h" | 14 | #include "isofs.h" |
16 | 15 | ||
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index bb11c7fb4019..14391361c886 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * 2004 Paul Serice - NFS Export Operations | 11 | * 2004 Paul Serice - NFS Export Operations |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/init.h> | 14 | #include <linux/init.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | 16 | ||
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c index 5371a403130a..9000f1effedf 100644 --- a/fs/jffs/intrep.c +++ b/fs/jffs/intrep.c | |||
@@ -55,7 +55,6 @@ | |||
55 | * | 55 | * |
56 | */ | 56 | */ |
57 | 57 | ||
58 | #include <linux/config.h> | ||
59 | #include <linux/types.h> | 58 | #include <linux/types.h> |
60 | #include <linux/slab.h> | 59 | #include <linux/slab.h> |
61 | #include <linux/jffs.h> | 60 | #include <linux/jffs.h> |
diff --git a/fs/jffs/jffs_fm.h b/fs/jffs/jffs_fm.h index c794d923df2a..9ee6ad29eff5 100644 --- a/fs/jffs/jffs_fm.h +++ b/fs/jffs/jffs_fm.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #ifndef __LINUX_JFFS_FM_H__ | 20 | #ifndef __LINUX_JFFS_FM_H__ |
21 | #define __LINUX_JFFS_FM_H__ | 21 | #define __LINUX_JFFS_FM_H__ |
22 | 22 | ||
23 | #include <linux/config.h> | ||
24 | #include <linux/types.h> | 23 | #include <linux/types.h> |
25 | #include <linux/jffs.h> | 24 | #include <linux/jffs.h> |
26 | #include <linux/mtd/mtd.h> | 25 | #include <linux/mtd/mtd.h> |
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c index 5c63e0cdcf4c..3681d0728ac7 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #error "The userspace support got too messy and was removed. Update your mkfs.jffs2" | 15 | #error "The userspace support got too messy and was removed. Update your mkfs.jffs2" |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
20 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h index 5fa494a792b2..3daf3bca0376 100644 --- a/fs/jffs2/debug.h +++ b/fs/jffs2/debug.h | |||
@@ -13,7 +13,6 @@ | |||
13 | #ifndef _JFFS2_DEBUG_H_ | 13 | #ifndef _JFFS2_DEBUG_H_ |
14 | #define _JFFS2_DEBUG_H_ | 14 | #define _JFFS2_DEBUG_H_ |
15 | 15 | ||
16 | #include <linux/config.h> | ||
17 | 16 | ||
18 | #ifndef CONFIG_JFFS2_FS_DEBUG | 17 | #ifndef CONFIG_JFFS2_FS_DEBUG |
19 | #define CONFIG_JFFS2_FS_DEBUG 0 | 18 | #define CONFIG_JFFS2_FS_DEBUG 0 |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 97caa77d60cf..4780f82825d6 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -12,7 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/capability.h> | 14 | #include <linux/capability.h> |
15 | #include <linux/config.h> | ||
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
17 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
18 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index b16c60bbcf6e..f752baa8d399 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #ifndef __JFFS2_NODELIST_H__ | 14 | #ifndef __JFFS2_NODELIST_H__ |
15 | #define __JFFS2_NODELIST_H__ | 15 | #define __JFFS2_NODELIST_H__ |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
19 | #include <linux/types.h> | 18 | #include <linux/types.h> |
20 | #include <linux/jffs2.h> | 19 | #include <linux/jffs2.h> |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 2378a662c256..68e3953419b4 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index ac3d66948e8c..10c46231ce15 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
@@ -842,7 +842,7 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, | |||
842 | TXN_UNLOCK(); | 842 | TXN_UNLOCK(); |
843 | release_metapage(mp); | 843 | release_metapage(mp); |
844 | TXN_LOCK(); | 844 | TXN_LOCK(); |
845 | xtid = tlck->tid; /* reaquire after dropping TXN_LOCK */ | 845 | xtid = tlck->tid; /* reacquire after dropping TXN_LOCK */ |
846 | 846 | ||
847 | jfs_info("txLock: in waitLock, tid = %d, xtid = %d, lid = %d", | 847 | jfs_info("txLock: in waitLock, tid = %d, xtid = %d, lid = %d", |
848 | tid, xtid, lid); | 848 | tid, xtid, lid); |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 73d2aba084c6..4f6cfebc82db 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -18,7 +18,6 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/config.h> | ||
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/parser.h> | 22 | #include <linux/parser.h> |
24 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 4db62098d3f4..5980c45998cc 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | 6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/module.h> | 9 | #include <linux/module.h> |
11 | #include <linux/types.h> | 10 | #include <linux/types.h> |
12 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index fd56c8872f34..9a991b52c647 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 12 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
18 | #include <linux/sysctl.h> | 17 | #include <linux/sysctl.h> |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 3ef739120dff..baf5ae513481 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | 20 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/config.h> | ||
24 | #include <linux/types.h> | 23 | #include <linux/types.h> |
25 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
26 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index d210cf304e92..dbb66a3b5cd9 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | 7 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/config.h> | ||
11 | #include <linux/types.h> | 10 | #include <linux/types.h> |
12 | #include <linux/time.h> | 11 | #include <linux/time.h> |
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index a570e5c8a930..2a4df9b3779a 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | 6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/types.h> | 9 | #include <linux/types.h> |
11 | #include <linux/string.h> | 10 | #include <linux/string.h> |
12 | #include <linux/time.h> | 11 | #include <linux/time.h> |
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index f22a3764461a..033ea4ac2c30 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 6 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/types.h> | 9 | #include <linux/types.h> |
11 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
12 | #include <linux/utsname.h> | 11 | #include <linux/utsname.h> |
diff --git a/fs/namespace.c b/fs/namespace.c index b3ed212ea416..fa7ed6a9fc2d 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * Heavily rewritten. | 8 | * Heavily rewritten. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | #include <linux/syscalls.h> | 11 | #include <linux/syscalls.h> |
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
14 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index f0860c602d8b..b4ee89250e95 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | 13 | ||
15 | #include <linux/time.h> | 14 | #include <linux/time.h> |
16 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 6c51c1198464..1ddf77b0b825 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/module.h> | 12 | #include <linux/module.h> |
14 | 13 | ||
15 | #include <asm/system.h> | 14 | #include <asm/system.h> |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index eb3813ad136f..42039fe0653c 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/config.h> | ||
11 | 10 | ||
12 | #include <asm/uaccess.h> | 11 | #include <asm/uaccess.h> |
13 | #include <linux/capability.h> | 12 | #include <linux/capability.h> |
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c index 52d60c3d8996..e7d5a3097fe6 100644 --- a/fs/ncpfs/mmap.c +++ b/fs/ncpfs/mmap.c | |||
@@ -93,7 +93,7 @@ static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area, | |||
93 | */ | 93 | */ |
94 | if (type) | 94 | if (type) |
95 | *type = VM_FAULT_MAJOR; | 95 | *type = VM_FAULT_MAJOR; |
96 | inc_page_state(pgmajfault); | 96 | count_vm_event(PGMAJFAULT); |
97 | return page; | 97 | return page; |
98 | } | 98 | } |
99 | 99 | ||
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c index d9ebf6439f59..551e0bac7aac 100644 --- a/fs/ncpfs/ncplib_kernel.c +++ b/fs/ncpfs/ncplib_kernel.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | 13 | ||
15 | #include "ncplib_kernel.h" | 14 | #include "ncplib_kernel.h" |
16 | 15 | ||
diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h index 799e5c2bec55..2441d1ab57dc 100644 --- a/fs/ncpfs/ncplib_kernel.h +++ b/fs/ncpfs/ncplib_kernel.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #ifndef _NCPLIB_H | 12 | #ifndef _NCPLIB_H |
13 | #define _NCPLIB_H | 13 | #define _NCPLIB_H |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | 15 | ||
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/types.h> | 17 | #include <linux/types.h> |
diff --git a/fs/ncpfs/ncpsign_kernel.c b/fs/ncpfs/ncpsign_kernel.c index a6ec90cd8894..749a18d33599 100644 --- a/fs/ncpfs/ncpsign_kernel.c +++ b/fs/ncpfs/ncpsign_kernel.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/config.h> | ||
9 | 8 | ||
10 | #ifdef CONFIG_NCPFS_PACKET_SIGNING | 9 | #ifdef CONFIG_NCPFS_PACKET_SIGNING |
11 | 10 | ||
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c index 8783eb7ec641..11c2b252ebed 100644 --- a/fs/ncpfs/sock.c +++ b/fs/ncpfs/sock.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | 11 | ||
13 | #include <linux/time.h> | 12 | #include <linux/time.h> |
14 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c index f76b1392a012..ca92c2406635 100644 --- a/fs/ncpfs/symlink.c +++ b/fs/ncpfs/symlink.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/config.h> | ||
24 | 23 | ||
25 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
26 | 25 | ||
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index d53f8c6a9ecb..fe0a6b8ac149 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * NFSv4 callback handling | 6 | * NFSv4 callback handling |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/completion.h> | 9 | #include <linux/completion.h> |
11 | #include <linux/ip.h> | 10 | #include <linux/ip.h> |
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 462cfceb50c5..7719483ecdfc 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * | 5 | * |
6 | * NFSv4 callback procedures | 6 | * NFSv4 callback procedures |
7 | */ | 7 | */ |
8 | #include <linux/config.h> | ||
9 | #include <linux/nfs4.h> | 8 | #include <linux/nfs4.h> |
10 | #include <linux/nfs_fs.h> | 9 | #include <linux/nfs_fs.h> |
11 | #include "nfs4_fs.h" | 10 | #include "nfs4_fs.h" |
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index c92991328d9a..29f932192054 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * | 5 | * |
6 | * NFSv4 callback encode/decode procedures | 6 | * NFSv4 callback encode/decode procedures |
7 | */ | 7 | */ |
8 | #include <linux/config.h> | ||
9 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
10 | #include <linux/sunrpc/svc.h> | 9 | #include <linux/sunrpc/svc.h> |
11 | #include <linux/nfs4.h> | 10 | #include <linux/nfs4.h> |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index d3be923d4e43..9540a316c05e 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * NFS file delegation management | 6 | * NFS file delegation management |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | #include <linux/config.h> | ||
10 | #include <linux/completion.h> | 9 | #include <linux/completion.h> |
11 | #include <linux/kthread.h> | 10 | #include <linux/kthread.h> |
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 9ae7b6f6bf30..fecd3b095deb 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -38,7 +38,6 @@ | |||
38 | * | 38 | * |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include <linux/config.h> | ||
42 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
43 | #include <linux/sched.h> | 42 | #include <linux/sched.h> |
44 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index c5b916605fb0..d349fb2245da 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -13,7 +13,6 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/config.h> | ||
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
19 | 18 | ||
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 4fe51c1292bb..e4f4e5def0fc 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -81,9 +81,9 @@ extern struct file_system_type clone_nfs_fs_type; | |||
81 | #ifdef CONFIG_NFS_V4 | 81 | #ifdef CONFIG_NFS_V4 |
82 | extern struct file_system_type clone_nfs4_fs_type; | 82 | extern struct file_system_type clone_nfs4_fs_type; |
83 | #endif | 83 | #endif |
84 | #ifdef CONFIG_PROC_FS | 84 | |
85 | extern struct rpc_stat nfs_rpcstat; | 85 | extern struct rpc_stat nfs_rpcstat; |
86 | #endif | 86 | |
87 | extern int __init register_nfs_fs(void); | 87 | extern int __init register_nfs_fs(void); |
88 | extern void __exit unregister_nfs_fs(void); | 88 | extern void __exit unregister_nfs_fs(void); |
89 | 89 | ||
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 96e5b82c153b..090a36b07a22 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -38,7 +38,6 @@ | |||
38 | * subsequent patch. | 38 | * subsequent patch. |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include <linux/config.h> | ||
42 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
43 | #include <linux/smp_lock.h> | 42 | #include <linux/smp_lock.h> |
44 | #include <linux/nfs_fs.h> | 43 | #include <linux/nfs_fs.h> |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index d89f6fb3b3a3..36e902a88ca1 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
14 | #include <linux/file.h> | 13 | #include <linux/file.h> |
15 | #include <linux/sunrpc/clnt.h> | 14 | #include <linux/sunrpc/clnt.h> |
@@ -315,6 +314,7 @@ nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst, | |||
315 | req->wb_index, NFS_PAGE_TAG_DIRTY); | 314 | req->wb_index, NFS_PAGE_TAG_DIRTY); |
316 | nfs_list_remove_request(req); | 315 | nfs_list_remove_request(req); |
317 | nfs_list_add_request(req, dst); | 316 | nfs_list_add_request(req, dst); |
317 | dec_zone_page_state(req->wb_page, NR_FILE_DIRTY); | ||
318 | res++; | 318 | res++; |
319 | } | 319 | } |
320 | } | 320 | } |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 32cf3773af0c..52bf634260a1 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * within the RPC code when root squashing is suspected. | 15 | * within the RPC code when root squashing is suspected. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/time.h> | 18 | #include <linux/time.h> |
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c index db61e51bb154..2fe3403c2409 100644 --- a/fs/nfs/sysctl.c +++ b/fs/nfs/sysctl.c | |||
@@ -3,7 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Sysctl interface to NFS parameters | 4 | * Sysctl interface to NFS parameters |
5 | */ | 5 | */ |
6 | #include <linux/config.h> | ||
7 | #include <linux/types.h> | 6 | #include <linux/types.h> |
8 | #include <linux/linkage.h> | 7 | #include <linux/linkage.h> |
9 | #include <linux/ctype.h> | 8 | #include <linux/ctype.h> |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 8fccb9cb173b..bca5734ca9fb 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -46,7 +46,6 @@ | |||
46 | * Copyright (C) 1996, 1997, Olaf Kirch <okir@monad.swb.de> | 46 | * Copyright (C) 1996, 1997, Olaf Kirch <okir@monad.swb.de> |
47 | */ | 47 | */ |
48 | 48 | ||
49 | #include <linux/config.h> | ||
50 | #include <linux/types.h> | 49 | #include <linux/types.h> |
51 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
52 | #include <linux/mm.h> | 51 | #include <linux/mm.h> |
@@ -497,7 +496,7 @@ nfs_mark_request_dirty(struct nfs_page *req) | |||
497 | nfs_list_add_request(req, &nfsi->dirty); | 496 | nfs_list_add_request(req, &nfsi->dirty); |
498 | nfsi->ndirty++; | 497 | nfsi->ndirty++; |
499 | spin_unlock(&nfsi->req_lock); | 498 | spin_unlock(&nfsi->req_lock); |
500 | inc_page_state(nr_dirty); | 499 | inc_zone_page_state(req->wb_page, NR_FILE_DIRTY); |
501 | mark_inode_dirty(inode); | 500 | mark_inode_dirty(inode); |
502 | } | 501 | } |
503 | 502 | ||
@@ -525,7 +524,7 @@ nfs_mark_request_commit(struct nfs_page *req) | |||
525 | nfs_list_add_request(req, &nfsi->commit); | 524 | nfs_list_add_request(req, &nfsi->commit); |
526 | nfsi->ncommit++; | 525 | nfsi->ncommit++; |
527 | spin_unlock(&nfsi->req_lock); | 526 | spin_unlock(&nfsi->req_lock); |
528 | inc_page_state(nr_unstable); | 527 | inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); |
529 | mark_inode_dirty(inode); | 528 | mark_inode_dirty(inode); |
530 | } | 529 | } |
531 | #endif | 530 | #endif |
@@ -609,7 +608,6 @@ nfs_scan_dirty(struct inode *inode, struct list_head *dst, unsigned long idx_sta | |||
609 | if (nfsi->ndirty != 0) { | 608 | if (nfsi->ndirty != 0) { |
610 | res = nfs_scan_lock_dirty(nfsi, dst, idx_start, npages); | 609 | res = nfs_scan_lock_dirty(nfsi, dst, idx_start, npages); |
611 | nfsi->ndirty -= res; | 610 | nfsi->ndirty -= res; |
612 | sub_page_state(nr_dirty,res); | ||
613 | if ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty)) | 611 | if ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty)) |
614 | printk(KERN_ERR "NFS: desynchronized value of nfs_i.ndirty.\n"); | 612 | printk(KERN_ERR "NFS: desynchronized value of nfs_i.ndirty.\n"); |
615 | } | 613 | } |
@@ -1394,7 +1392,6 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1394 | { | 1392 | { |
1395 | struct nfs_write_data *data = calldata; | 1393 | struct nfs_write_data *data = calldata; |
1396 | struct nfs_page *req; | 1394 | struct nfs_page *req; |
1397 | int res = 0; | ||
1398 | 1395 | ||
1399 | dprintk("NFS: %4d nfs_commit_done (status %d)\n", | 1396 | dprintk("NFS: %4d nfs_commit_done (status %d)\n", |
1400 | task->tk_pid, task->tk_status); | 1397 | task->tk_pid, task->tk_status); |
@@ -1406,6 +1403,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1406 | while (!list_empty(&data->pages)) { | 1403 | while (!list_empty(&data->pages)) { |
1407 | req = nfs_list_entry(data->pages.next); | 1404 | req = nfs_list_entry(data->pages.next); |
1408 | nfs_list_remove_request(req); | 1405 | nfs_list_remove_request(req); |
1406 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | ||
1409 | 1407 | ||
1410 | dprintk("NFS: commit (%s/%Ld %d@%Ld)", | 1408 | dprintk("NFS: commit (%s/%Ld %d@%Ld)", |
1411 | req->wb_context->dentry->d_inode->i_sb->s_id, | 1409 | req->wb_context->dentry->d_inode->i_sb->s_id, |
@@ -1432,9 +1430,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1432 | nfs_mark_request_dirty(req); | 1430 | nfs_mark_request_dirty(req); |
1433 | next: | 1431 | next: |
1434 | nfs_clear_page_writeback(req); | 1432 | nfs_clear_page_writeback(req); |
1435 | res++; | ||
1436 | } | 1433 | } |
1437 | sub_page_state(nr_unstable,res); | ||
1438 | } | 1434 | } |
1439 | 1435 | ||
1440 | static const struct rpc_call_ops nfs_commit_ops = { | 1436 | static const struct rpc_call_ops nfs_commit_ops = { |
diff --git a/fs/nfsctl.c b/fs/nfsctl.c index a5a18d4aca40..c043136a82ca 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c | |||
@@ -4,7 +4,6 @@ | |||
4 | * This should eventually move to userland. | 4 | * This should eventually move to userland. |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | #include <linux/config.h> | ||
8 | #include <linux/types.h> | 7 | #include <linux/types.h> |
9 | #include <linux/file.h> | 8 | #include <linux/file.h> |
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 3eec30000f3f..01bc68c628ad 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -126,7 +126,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
126 | if (*ep) | 126 | if (*ep) |
127 | goto out; | 127 | goto out; |
128 | dprintk("found fsidtype %d\n", fsidtype); | 128 | dprintk("found fsidtype %d\n", fsidtype); |
129 | if (fsidtype > 2) | 129 | if (key_len(fsidtype)==0) /* invalid type */ |
130 | goto out; | 130 | goto out; |
131 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) | 131 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) |
132 | goto out; | 132 | goto out; |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index dbaf3f93f328..54b37b1d2e3a 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -33,7 +33,6 @@ | |||
33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/config.h> | ||
37 | #include <linux/module.h> | 36 | #include <linux/module.h> |
38 | #include <linux/list.h> | 37 | #include <linux/list.h> |
39 | #include <linux/inet.h> | 38 | #include <linux/inet.h> |
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index 4b6aa60dfceb..bea6b9478114 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -34,7 +34,6 @@ | |||
34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/config.h> | ||
38 | #include <linux/module.h> | 37 | #include <linux/module.h> |
39 | #include <linux/init.h> | 38 | #include <linux/init.h> |
40 | 39 | ||
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 7c7d01672d35..9daa0b9feb8d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1237,8 +1237,15 @@ find_file(struct inode *ino) | |||
1237 | return NULL; | 1237 | return NULL; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | #define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0) | 1240 | static int access_valid(u32 x) |
1241 | #define TEST_DENY(x) ((x >= 0 || x < 5)?1:0) | 1241 | { |
1242 | return (x > 0 && x < 4); | ||
1243 | } | ||
1244 | |||
1245 | static int deny_valid(u32 x) | ||
1246 | { | ||
1247 | return (x >= 0 && x < 5); | ||
1248 | } | ||
1242 | 1249 | ||
1243 | static void | 1250 | static void |
1244 | set_access(unsigned int *access, unsigned long bmap) { | 1251 | set_access(unsigned int *access, unsigned long bmap) { |
@@ -1745,7 +1752,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
1745 | int status; | 1752 | int status; |
1746 | 1753 | ||
1747 | status = nfserr_inval; | 1754 | status = nfserr_inval; |
1748 | if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny)) | 1755 | if (!access_valid(open->op_share_access) |
1756 | || !deny_valid(open->op_share_deny)) | ||
1749 | goto out; | 1757 | goto out; |
1750 | /* | 1758 | /* |
1751 | * Lookup file; if found, lookup stateid and check open request, | 1759 | * Lookup file; if found, lookup stateid and check open request, |
@@ -1782,10 +1790,10 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
1782 | } else { | 1790 | } else { |
1783 | /* Stateid was not found, this is a new OPEN */ | 1791 | /* Stateid was not found, this is a new OPEN */ |
1784 | int flags = 0; | 1792 | int flags = 0; |
1793 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) | ||
1794 | flags |= MAY_READ; | ||
1785 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) | 1795 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) |
1786 | flags = MAY_WRITE; | 1796 | flags |= MAY_WRITE; |
1787 | else | ||
1788 | flags = MAY_READ; | ||
1789 | status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags); | 1797 | status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags); |
1790 | if (status) | 1798 | if (status) |
1791 | goto out; | 1799 | goto out; |
@@ -2070,16 +2078,12 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl | |||
2070 | if (!stateid->si_fileid) { /* delegation stateid */ | 2078 | if (!stateid->si_fileid) { /* delegation stateid */ |
2071 | if(!(dp = find_delegation_stateid(ino, stateid))) { | 2079 | if(!(dp = find_delegation_stateid(ino, stateid))) { |
2072 | dprintk("NFSD: delegation stateid not found\n"); | 2080 | dprintk("NFSD: delegation stateid not found\n"); |
2073 | if (nfs4_in_grace()) | ||
2074 | status = nfserr_grace; | ||
2075 | goto out; | 2081 | goto out; |
2076 | } | 2082 | } |
2077 | stidp = &dp->dl_stateid; | 2083 | stidp = &dp->dl_stateid; |
2078 | } else { /* open or lock stateid */ | 2084 | } else { /* open or lock stateid */ |
2079 | if (!(stp = find_stateid(stateid, flags))) { | 2085 | if (!(stp = find_stateid(stateid, flags))) { |
2080 | dprintk("NFSD: open or lock stateid not found\n"); | 2086 | dprintk("NFSD: open or lock stateid not found\n"); |
2081 | if (nfs4_in_grace()) | ||
2082 | status = nfserr_grace; | ||
2083 | goto out; | 2087 | goto out; |
2084 | } | 2088 | } |
2085 | if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) | 2089 | if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) |
@@ -2252,8 +2256,9 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs | |||
2252 | (int)current_fh->fh_dentry->d_name.len, | 2256 | (int)current_fh->fh_dentry->d_name.len, |
2253 | current_fh->fh_dentry->d_name.name); | 2257 | current_fh->fh_dentry->d_name.name); |
2254 | 2258 | ||
2255 | if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0))) | 2259 | status = fh_verify(rqstp, current_fh, S_IFREG, 0); |
2256 | goto out; | 2260 | if (status) |
2261 | return status; | ||
2257 | 2262 | ||
2258 | nfs4_lock_state(); | 2263 | nfs4_lock_state(); |
2259 | 2264 | ||
@@ -2320,7 +2325,8 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n | |||
2320 | (int)current_fh->fh_dentry->d_name.len, | 2325 | (int)current_fh->fh_dentry->d_name.len, |
2321 | current_fh->fh_dentry->d_name.name); | 2326 | current_fh->fh_dentry->d_name.name); |
2322 | 2327 | ||
2323 | if (!TEST_ACCESS(od->od_share_access) || !TEST_DENY(od->od_share_deny)) | 2328 | if (!access_valid(od->od_share_access) |
2329 | || !deny_valid(od->od_share_deny)) | ||
2324 | return nfserr_inval; | 2330 | return nfserr_inval; |
2325 | 2331 | ||
2326 | nfs4_lock_state(); | 2332 | nfs4_lock_state(); |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index a1810e6a93e5..7046ac9cf97f 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 6 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/module.h> | 9 | #include <linux/module.h> |
11 | 10 | ||
12 | #include <linux/linkage.h> | 11 | #include <linux/linkage.h> |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 3f2ec2e6d06c..ecc439d2565f 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -187,13 +187,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
187 | goto out; | 187 | goto out; |
188 | } | 188 | } |
189 | 189 | ||
190 | /* Set user creds for this exportpoint */ | ||
191 | error = nfsd_setuser(rqstp, exp); | ||
192 | if (error) { | ||
193 | error = nfserrno(error); | ||
194 | goto out; | ||
195 | } | ||
196 | |||
197 | /* | 190 | /* |
198 | * Look up the dentry using the NFS file handle. | 191 | * Look up the dentry using the NFS file handle. |
199 | */ | 192 | */ |
@@ -251,6 +244,14 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
251 | } | 244 | } |
252 | cache_get(&exp->h); | 245 | cache_get(&exp->h); |
253 | 246 | ||
247 | /* Set user creds for this exportpoint; necessary even in the "just | ||
248 | * checking" case because this may be a filehandle that was created by | ||
249 | * fh_compose, and that is about to be used in another nfsv4 compound | ||
250 | * operation */ | ||
251 | error = nfserrno(nfsd_setuser(rqstp, exp)); | ||
252 | if (error) | ||
253 | goto out; | ||
254 | |||
254 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); | 255 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); |
255 | if (error) | 256 | if (error) |
256 | goto out; | 257 | goto out; |
@@ -312,8 +313,8 @@ int | |||
312 | fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) | 313 | fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) |
313 | { | 314 | { |
314 | /* ref_fh is a reference file handle. | 315 | /* ref_fh is a reference file handle. |
315 | * if it is non-null, then we should compose a filehandle which is | 316 | * if it is non-null and for the same filesystem, then we should compose |
316 | * of the same version, where possible. | 317 | * a filehandle which is of the same version, where possible. |
317 | * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca | 318 | * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca |
318 | * Then create a 32byte filehandle using nfs_fhbase_old | 319 | * Then create a 32byte filehandle using nfs_fhbase_old |
319 | * | 320 | * |
@@ -332,7 +333,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st | |||
332 | parent->d_name.name, dentry->d_name.name, | 333 | parent->d_name.name, dentry->d_name.name, |
333 | (inode ? inode->i_ino : 0)); | 334 | (inode ? inode->i_ino : 0)); |
334 | 335 | ||
335 | if (ref_fh) { | 336 | if (ref_fh && ref_fh->fh_export == exp) { |
336 | ref_fh_version = ref_fh->fh_handle.fh_version; | 337 | ref_fh_version = ref_fh->fh_handle.fh_version; |
337 | if (ref_fh_version == 0xca) | 338 | if (ref_fh_version == 0xca) |
338 | ref_fh_fsid_type = 0; | 339 | ref_fh_fsid_type = 0; |
@@ -461,7 +462,7 @@ fh_update(struct svc_fh *fhp) | |||
461 | } else { | 462 | } else { |
462 | int size; | 463 | int size; |
463 | if (fhp->fh_handle.fh_fileid_type != 0) | 464 | if (fhp->fh_handle.fh_fileid_type != 0) |
464 | goto out_uptodate; | 465 | goto out; |
465 | datap = fhp->fh_handle.fh_auth+ | 466 | datap = fhp->fh_handle.fh_auth+ |
466 | fhp->fh_handle.fh_size/4 -1; | 467 | fhp->fh_handle.fh_size/4 -1; |
467 | size = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; | 468 | size = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; |
@@ -481,10 +482,6 @@ out_negative: | |||
481 | printk(KERN_ERR "fh_update: %s/%s still negative!\n", | 482 | printk(KERN_ERR "fh_update: %s/%s still negative!\n", |
482 | dentry->d_parent->d_name.name, dentry->d_name.name); | 483 | dentry->d_parent->d_name.name, dentry->d_name.name); |
483 | goto out; | 484 | goto out; |
484 | out_uptodate: | ||
485 | printk(KERN_ERR "fh_update: %s/%s already up-to-date!\n", | ||
486 | dentry->d_parent->d_name.name, dentry->d_name.name); | ||
487 | goto out; | ||
488 | } | 485 | } |
489 | 486 | ||
490 | /* | 487 | /* |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 3790727e5dfd..ec1decf29bab 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> | 8 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
13 | 12 | ||
14 | #include <linux/time.h> | 13 | #include <linux/time.h> |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 245eaa1fb59b..c9e3b5a8fe07 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * Zerocpy NFS support (C) 2002 Hirokazu Takahashi <taka@valinux.co.jp> | 16 | * Zerocpy NFS support (C) 2002 Hirokazu Takahashi <taka@valinux.co.jp> |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/string.h> | 19 | #include <linux/string.h> |
21 | #include <linux/time.h> | 20 | #include <linux/time.h> |
22 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
@@ -673,7 +672,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
673 | goto out_nfserr; | 672 | goto out_nfserr; |
674 | 673 | ||
675 | if (access & MAY_WRITE) { | 674 | if (access & MAY_WRITE) { |
676 | flags = O_WRONLY|O_LARGEFILE; | 675 | if (access & MAY_READ) |
676 | flags = O_RDWR|O_LARGEFILE; | ||
677 | else | ||
678 | flags = O_WRONLY|O_LARGEFILE; | ||
677 | 679 | ||
678 | DQUOT_INIT(inode); | 680 | DQUOT_INIT(inode); |
679 | } | 681 | } |
@@ -834,7 +836,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
834 | if (ra && ra->p_set) | 836 | if (ra && ra->p_set) |
835 | file->f_ra = ra->p_ra; | 837 | file->f_ra = ra->p_ra; |
836 | 838 | ||
837 | if (file->f_op->sendfile) { | 839 | if (file->f_op->sendfile && rqstp->rq_sendfile_ok) { |
838 | svc_pushback_unused_pages(rqstp); | 840 | svc_pushback_unused_pages(rqstp); |
839 | err = file->f_op->sendfile(file, &offset, *count, | 841 | err = file->f_op->sendfile(file, &offset, *count, |
840 | nfsd_read_actor, rqstp); | 842 | nfsd_read_actor, rqstp); |
@@ -1517,14 +1519,15 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | |||
1517 | err = nfserrno(err); | 1519 | err = nfserrno(err); |
1518 | } | 1520 | } |
1519 | 1521 | ||
1520 | fh_unlock(ffhp); | ||
1521 | dput(dnew); | 1522 | dput(dnew); |
1523 | out_unlock: | ||
1524 | fh_unlock(ffhp); | ||
1522 | out: | 1525 | out: |
1523 | return err; | 1526 | return err; |
1524 | 1527 | ||
1525 | out_nfserr: | 1528 | out_nfserr: |
1526 | err = nfserrno(err); | 1529 | err = nfserrno(err); |
1527 | goto out; | 1530 | goto out_unlock; |
1528 | } | 1531 | } |
1529 | 1532 | ||
1530 | /* | 1533 | /* |
@@ -1553,7 +1556,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1553 | tdir = tdentry->d_inode; | 1556 | tdir = tdentry->d_inode; |
1554 | 1557 | ||
1555 | err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; | 1558 | err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; |
1556 | if (fdir->i_sb != tdir->i_sb) | 1559 | if (ffhp->fh_export != tfhp->fh_export) |
1557 | goto out; | 1560 | goto out; |
1558 | 1561 | ||
1559 | err = nfserr_perm; | 1562 | err = nfserr_perm; |
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index a912debcd20b..9de6b495f112 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/config.h> | ||
14 | #include <linux/nls.h> | 13 | #include <linux/nls.h> |
15 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
16 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
diff --git a/fs/ntfs/sysctl.h b/fs/ntfs/sysctl.h index c8064cae8f17..beda5bf96405 100644 --- a/fs/ntfs/sysctl.h +++ b/fs/ntfs/sysctl.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifndef _LINUX_NTFS_SYSCTL_H | 24 | #ifndef _LINUX_NTFS_SYSCTL_H |
25 | #define _LINUX_NTFS_SYSCTL_H | 25 | #define _LINUX_NTFS_SYSCTL_H |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | 27 | ||
29 | #if defined(DEBUG) && defined(CONFIG_SYSCTL) | 28 | #if defined(DEBUG) && defined(CONFIG_SYSCTL) |
30 | 29 | ||
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index cca71317b6d6..f1d1c342ce01 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -558,16 +558,9 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock, | |||
558 | u64 vbo_max; /* file offset, max_blocks from iblock */ | 558 | u64 vbo_max; /* file offset, max_blocks from iblock */ |
559 | u64 p_blkno; | 559 | u64 p_blkno; |
560 | int contig_blocks; | 560 | int contig_blocks; |
561 | unsigned char blocksize_bits; | 561 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; |
562 | unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits; | 562 | unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits; |
563 | 563 | ||
564 | if (!inode || !bh_result) { | ||
565 | mlog(ML_ERROR, "inode or bh_result is null\n"); | ||
566 | return -EIO; | ||
567 | } | ||
568 | |||
569 | blocksize_bits = inode->i_sb->s_blocksize_bits; | ||
570 | |||
571 | /* This function won't even be called if the request isn't all | 564 | /* This function won't even be called if the request isn't all |
572 | * nicely aligned and of the right size, so there's no need | 565 | * nicely aligned and of the right size, so there's no need |
573 | * for us to check any of that. */ | 566 | * for us to check any of that. */ |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 1d26cfcd9f84..504595d6cf65 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -517,6 +517,7 @@ static inline void o2hb_prepare_block(struct o2hb_region *reg, | |||
517 | hb_block->hb_seq = cpu_to_le64(cputime); | 517 | hb_block->hb_seq = cpu_to_le64(cputime); |
518 | hb_block->hb_node = node_num; | 518 | hb_block->hb_node = node_num; |
519 | hb_block->hb_generation = cpu_to_le64(generation); | 519 | hb_block->hb_generation = cpu_to_le64(generation); |
520 | hb_block->hb_dead_ms = cpu_to_le32(o2hb_dead_threshold * O2HB_REGION_TIMEOUT_MS); | ||
520 | 521 | ||
521 | /* This step must always happen last! */ | 522 | /* This step must always happen last! */ |
522 | hb_block->hb_cksum = cpu_to_le32(o2hb_compute_block_crc_le(reg, | 523 | hb_block->hb_cksum = cpu_to_le32(o2hb_compute_block_crc_le(reg, |
@@ -645,6 +646,8 @@ static int o2hb_check_slot(struct o2hb_region *reg, | |||
645 | struct o2nm_node *node; | 646 | struct o2nm_node *node; |
646 | struct o2hb_disk_heartbeat_block *hb_block = reg->hr_tmp_block; | 647 | struct o2hb_disk_heartbeat_block *hb_block = reg->hr_tmp_block; |
647 | u64 cputime; | 648 | u64 cputime; |
649 | unsigned int dead_ms = o2hb_dead_threshold * O2HB_REGION_TIMEOUT_MS; | ||
650 | unsigned int slot_dead_ms; | ||
648 | 651 | ||
649 | memcpy(hb_block, slot->ds_raw_block, reg->hr_block_bytes); | 652 | memcpy(hb_block, slot->ds_raw_block, reg->hr_block_bytes); |
650 | 653 | ||
@@ -733,6 +736,23 @@ fire_callbacks: | |||
733 | &o2hb_live_slots[slot->ds_node_num]); | 736 | &o2hb_live_slots[slot->ds_node_num]); |
734 | 737 | ||
735 | slot->ds_equal_samples = 0; | 738 | slot->ds_equal_samples = 0; |
739 | |||
740 | /* We want to be sure that all nodes agree on the | ||
741 | * number of milliseconds before a node will be | ||
742 | * considered dead. The self-fencing timeout is | ||
743 | * computed from this value, and a discrepancy might | ||
744 | * result in heartbeat calling a node dead when it | ||
745 | * hasn't self-fenced yet. */ | ||
746 | slot_dead_ms = le32_to_cpu(hb_block->hb_dead_ms); | ||
747 | if (slot_dead_ms && slot_dead_ms != dead_ms) { | ||
748 | /* TODO: Perhaps we can fail the region here. */ | ||
749 | mlog(ML_ERROR, "Node %d on device %s has a dead count " | ||
750 | "of %u ms, but our count is %u ms.\n" | ||
751 | "Please double check your configuration values " | ||
752 | "for 'O2CB_HEARTBEAT_THRESHOLD'\n", | ||
753 | slot->ds_node_num, reg->hr_dev_name, slot_dead_ms, | ||
754 | dead_ms); | ||
755 | } | ||
736 | goto out; | 756 | goto out; |
737 | } | 757 | } |
738 | 758 | ||
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index 73edad782537..a42628ba9ddf 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
@@ -123,6 +123,17 @@ | |||
123 | #define MLOG_MASK_PREFIX 0 | 123 | #define MLOG_MASK_PREFIX 0 |
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | /* | ||
127 | * When logging is disabled, force the bit test to 0 for anything other | ||
128 | * than errors and notices, allowing gcc to remove the code completely. | ||
129 | * When enabled, allow all masks. | ||
130 | */ | ||
131 | #if defined(CONFIG_OCFS2_DEBUG_MASKLOG) | ||
132 | #define ML_ALLOWED_BITS ~0 | ||
133 | #else | ||
134 | #define ML_ALLOWED_BITS (ML_ERROR|ML_NOTICE) | ||
135 | #endif | ||
136 | |||
126 | #define MLOG_MAX_BITS 64 | 137 | #define MLOG_MAX_BITS 64 |
127 | 138 | ||
128 | struct mlog_bits { | 139 | struct mlog_bits { |
@@ -187,7 +198,8 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
187 | 198 | ||
188 | #define mlog(mask, fmt, args...) do { \ | 199 | #define mlog(mask, fmt, args...) do { \ |
189 | u64 __m = MLOG_MASK_PREFIX | (mask); \ | 200 | u64 __m = MLOG_MASK_PREFIX | (mask); \ |
190 | if (__mlog_test_u64(__m, mlog_and_bits) && \ | 201 | if ((__m & ML_ALLOWED_BITS) && \ |
202 | __mlog_test_u64(__m, mlog_and_bits) && \ | ||
191 | !__mlog_test_u64(__m, mlog_not_bits)) { \ | 203 | !__mlog_test_u64(__m, mlog_not_bits)) { \ |
192 | if (__m & ML_ERROR) \ | 204 | if (__m & ML_ERROR) \ |
193 | __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ | 205 | __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ |
@@ -204,6 +216,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
204 | mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ | 216 | mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ |
205 | } while (0) | 217 | } while (0) |
206 | 218 | ||
219 | #if defined(CONFIG_OCFS2_DEBUG_MASKLOG) | ||
207 | #define mlog_entry(fmt, args...) do { \ | 220 | #define mlog_entry(fmt, args...) do { \ |
208 | mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ | 221 | mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ |
209 | } while (0) | 222 | } while (0) |
@@ -247,6 +260,13 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
247 | #define mlog_exit_void() do { \ | 260 | #define mlog_exit_void() do { \ |
248 | mlog(ML_EXIT, "EXIT\n"); \ | 261 | mlog(ML_EXIT, "EXIT\n"); \ |
249 | } while (0) | 262 | } while (0) |
263 | #else | ||
264 | #define mlog_entry(...) do { } while (0) | ||
265 | #define mlog_entry_void(...) do { } while (0) | ||
266 | #define mlog_exit(...) do { } while (0) | ||
267 | #define mlog_exit_ptr(...) do { } while (0) | ||
268 | #define mlog_exit_void(...) do { } while (0) | ||
269 | #endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */ | ||
250 | 270 | ||
251 | #define mlog_bug_on_msg(cond, fmt, args...) do { \ | 271 | #define mlog_bug_on_msg(cond, fmt, args...) do { \ |
252 | if (cond) { \ | 272 | if (cond) { \ |
diff --git a/fs/ocfs2/cluster/ocfs2_heartbeat.h b/fs/ocfs2/cluster/ocfs2_heartbeat.h index 94096069cb43..3f4151da9709 100644 --- a/fs/ocfs2/cluster/ocfs2_heartbeat.h +++ b/fs/ocfs2/cluster/ocfs2_heartbeat.h | |||
@@ -32,6 +32,7 @@ struct o2hb_disk_heartbeat_block { | |||
32 | __u8 hb_pad1[3]; | 32 | __u8 hb_pad1[3]; |
33 | __le32 hb_cksum; | 33 | __le32 hb_cksum; |
34 | __le64 hb_generation; | 34 | __le64 hb_generation; |
35 | __le32 hb_dead_ms; | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | #endif /* _OCFS2_HEARTBEAT_H */ | 38 | #endif /* _OCFS2_HEARTBEAT_H */ |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 1591eb37a723..b650efa8c8be 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -396,8 +396,8 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
396 | } | 396 | } |
397 | 397 | ||
398 | if (was_valid && !valid) { | 398 | if (was_valid && !valid) { |
399 | mlog(ML_NOTICE, "no longer connected to " SC_NODEF_FMT "\n", | 399 | printk(KERN_INFO "o2net: no longer connected to " |
400 | SC_NODEF_ARGS(old_sc)); | 400 | SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); |
401 | o2net_complete_nodes_nsw(nn); | 401 | o2net_complete_nodes_nsw(nn); |
402 | } | 402 | } |
403 | 403 | ||
@@ -409,10 +409,10 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
409 | * the only way to start connecting again is to down | 409 | * the only way to start connecting again is to down |
410 | * heartbeat and bring it back up. */ | 410 | * heartbeat and bring it back up. */ |
411 | cancel_delayed_work(&nn->nn_connect_expired); | 411 | cancel_delayed_work(&nn->nn_connect_expired); |
412 | mlog(ML_NOTICE, "%s " SC_NODEF_FMT "\n", | 412 | printk(KERN_INFO "o2net: %s " SC_NODEF_FMT "\n", |
413 | o2nm_this_node() > sc->sc_node->nd_num ? | 413 | o2nm_this_node() > sc->sc_node->nd_num ? |
414 | "connected to" : "accepted connection from", | 414 | "connected to" : "accepted connection from", |
415 | SC_NODEF_ARGS(sc)); | 415 | SC_NODEF_ARGS(sc)); |
416 | } | 416 | } |
417 | 417 | ||
418 | /* trigger the connecting worker func as long as we're not valid, | 418 | /* trigger the connecting worker func as long as we're not valid, |
@@ -1280,7 +1280,7 @@ static void o2net_idle_timer(unsigned long data) | |||
1280 | 1280 | ||
1281 | do_gettimeofday(&now); | 1281 | do_gettimeofday(&now); |
1282 | 1282 | ||
1283 | mlog(ML_NOTICE, "connection to " SC_NODEF_FMT " has been idle for 10 " | 1283 | printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for 10 " |
1284 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc)); | 1284 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc)); |
1285 | mlog(ML_NOTICE, "here are some times that might help debug the " | 1285 | mlog(ML_NOTICE, "here are some times that might help debug the " |
1286 | "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " | 1286 | "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index ae47f450792f..3d494d1a5f36 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -213,11 +213,9 @@ int ocfs2_find_files_on_disk(const char *name, | |||
213 | struct ocfs2_dir_entry **dirent) | 213 | struct ocfs2_dir_entry **dirent) |
214 | { | 214 | { |
215 | int status = -ENOENT; | 215 | int status = -ENOENT; |
216 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
217 | 216 | ||
218 | mlog_entry("(osb=%p, parent=%llu, name='%.*s', blkno=%p, inode=%p)\n", | 217 | mlog_entry("(name=%.*s, blkno=%p, inode=%p, dirent_bh=%p, dirent=%p)\n", |
219 | osb, (unsigned long long)OCFS2_I(inode)->ip_blkno, | 218 | namelen, name, blkno, inode, dirent_bh, dirent); |
220 | namelen, name, blkno, inode); | ||
221 | 219 | ||
222 | *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); | 220 | *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); |
223 | if (!*dirent_bh || !*dirent) { | 221 | if (!*dirent_bh || !*dirent) { |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 9bdc9cf65991..14530ee7e11d 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -822,8 +822,6 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data); | |||
822 | int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data); | 822 | int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data); |
823 | int dlm_do_master_requery(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | 823 | int dlm_do_master_requery(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, |
824 | u8 nodenum, u8 *real_master); | 824 | u8 nodenum, u8 *real_master); |
825 | int dlm_lockres_master_requery(struct dlm_ctxt *dlm, | ||
826 | struct dlm_lock_resource *res, u8 *real_master); | ||
827 | 825 | ||
828 | 826 | ||
829 | int dlm_dispatch_assert_master(struct dlm_ctxt *dlm, | 827 | int dlm_dispatch_assert_master(struct dlm_ctxt *dlm, |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index b8c23f7ba67e..8d1065f8b3bd 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -408,12 +408,13 @@ static void __dlm_print_nodes(struct dlm_ctxt *dlm) | |||
408 | 408 | ||
409 | assert_spin_locked(&dlm->spinlock); | 409 | assert_spin_locked(&dlm->spinlock); |
410 | 410 | ||
411 | mlog(ML_NOTICE, "Nodes in my domain (\"%s\"):\n", dlm->name); | 411 | printk(KERN_INFO "ocfs2_dlm: Nodes in domain (\"%s\"): ", dlm->name); |
412 | 412 | ||
413 | while ((node = find_next_bit(dlm->domain_map, O2NM_MAX_NODES, | 413 | while ((node = find_next_bit(dlm->domain_map, O2NM_MAX_NODES, |
414 | node + 1)) < O2NM_MAX_NODES) { | 414 | node + 1)) < O2NM_MAX_NODES) { |
415 | mlog(ML_NOTICE, " node %d\n", node); | 415 | printk("%d ", node); |
416 | } | 416 | } |
417 | printk("\n"); | ||
417 | } | 418 | } |
418 | 419 | ||
419 | static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data) | 420 | static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data) |
@@ -429,7 +430,7 @@ static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data) | |||
429 | 430 | ||
430 | node = exit_msg->node_idx; | 431 | node = exit_msg->node_idx; |
431 | 432 | ||
432 | mlog(0, "Node %u leaves domain %s\n", node, dlm->name); | 433 | printk(KERN_INFO "ocfs2_dlm: Node %u leaves domain %s\n", node, dlm->name); |
433 | 434 | ||
434 | spin_lock(&dlm->spinlock); | 435 | spin_lock(&dlm->spinlock); |
435 | clear_bit(node, dlm->domain_map); | 436 | clear_bit(node, dlm->domain_map); |
@@ -678,6 +679,8 @@ static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data) | |||
678 | set_bit(assert->node_idx, dlm->domain_map); | 679 | set_bit(assert->node_idx, dlm->domain_map); |
679 | __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); | 680 | __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); |
680 | 681 | ||
682 | printk(KERN_INFO "ocfs2_dlm: Node %u joins domain %s\n", | ||
683 | assert->node_idx, dlm->name); | ||
681 | __dlm_print_nodes(dlm); | 684 | __dlm_print_nodes(dlm); |
682 | 685 | ||
683 | /* notify anything attached to the heartbeat events */ | 686 | /* notify anything attached to the heartbeat events */ |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 29b2845f370d..594745fab0b5 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -95,6 +95,9 @@ static void dlm_reco_unlock_ast(void *astdata, enum dlm_status st); | |||
95 | static void dlm_request_all_locks_worker(struct dlm_work_item *item, | 95 | static void dlm_request_all_locks_worker(struct dlm_work_item *item, |
96 | void *data); | 96 | void *data); |
97 | static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data); | 97 | static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data); |
98 | static int dlm_lockres_master_requery(struct dlm_ctxt *dlm, | ||
99 | struct dlm_lock_resource *res, | ||
100 | u8 *real_master); | ||
98 | 101 | ||
99 | static u64 dlm_get_next_mig_cookie(void); | 102 | static u64 dlm_get_next_mig_cookie(void); |
100 | 103 | ||
@@ -1484,8 +1487,9 @@ leave: | |||
1484 | 1487 | ||
1485 | 1488 | ||
1486 | 1489 | ||
1487 | int dlm_lockres_master_requery(struct dlm_ctxt *dlm, | 1490 | static int dlm_lockres_master_requery(struct dlm_ctxt *dlm, |
1488 | struct dlm_lock_resource *res, u8 *real_master) | 1491 | struct dlm_lock_resource *res, |
1492 | u8 *real_master) | ||
1489 | { | 1493 | { |
1490 | struct dlm_node_iter iter; | 1494 | struct dlm_node_iter iter; |
1491 | int nodenum; | 1495 | int nodenum; |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 4acd37286bdd..762eb1fbb34d 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -2071,8 +2071,7 @@ int ocfs2_dlm_init(struct ocfs2_super *osb) | |||
2071 | } | 2071 | } |
2072 | 2072 | ||
2073 | /* launch vote thread */ | 2073 | /* launch vote thread */ |
2074 | osb->vote_task = kthread_run(ocfs2_vote_thread, osb, "ocfs2vote-%d", | 2074 | osb->vote_task = kthread_run(ocfs2_vote_thread, osb, "ocfs2vote"); |
2075 | osb->osb_id); | ||
2076 | if (IS_ERR(osb->vote_task)) { | 2075 | if (IS_ERR(osb->vote_task)) { |
2077 | status = PTR_ERR(osb->vote_task); | 2076 | status = PTR_ERR(osb->vote_task); |
2078 | osb->vote_task = NULL; | 2077 | osb->vote_task = NULL; |
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index 1a5c69071df6..fcd4475d1f89 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -298,7 +298,7 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode, | |||
298 | 298 | ||
299 | ret = ocfs2_extent_map_insert(inode, rec, | 299 | ret = ocfs2_extent_map_insert(inode, rec, |
300 | le16_to_cpu(el->l_tree_depth)); | 300 | le16_to_cpu(el->l_tree_depth)); |
301 | if (ret) { | 301 | if (ret && (ret != -EEXIST)) { |
302 | mlog_errno(ret); | 302 | mlog_errno(ret); |
303 | goto out_free; | 303 | goto out_free; |
304 | } | 304 | } |
@@ -427,6 +427,11 @@ static int ocfs2_extent_map_insert_entry(struct ocfs2_extent_map *em, | |||
427 | /* | 427 | /* |
428 | * Simple rule: on any return code other than -EAGAIN, anything left | 428 | * Simple rule: on any return code other than -EAGAIN, anything left |
429 | * in the insert_context will be freed. | 429 | * in the insert_context will be freed. |
430 | * | ||
431 | * Simple rule #2: A return code of -EEXIST from this function or | ||
432 | * its calls to ocfs2_extent_map_insert_entry() signifies that another | ||
433 | * thread beat us to the insert. It is not an actual error, but it | ||
434 | * tells the caller we have no more work to do. | ||
430 | */ | 435 | */ |
431 | static int ocfs2_extent_map_try_insert(struct inode *inode, | 436 | static int ocfs2_extent_map_try_insert(struct inode *inode, |
432 | struct ocfs2_extent_rec *rec, | 437 | struct ocfs2_extent_rec *rec, |
@@ -448,22 +453,32 @@ static int ocfs2_extent_map_try_insert(struct inode *inode, | |||
448 | goto out_unlock; | 453 | goto out_unlock; |
449 | } | 454 | } |
450 | 455 | ||
456 | /* Since insert_entry failed, the map MUST have old_ent */ | ||
451 | old_ent = ocfs2_extent_map_lookup(em, le32_to_cpu(rec->e_cpos), | 457 | old_ent = ocfs2_extent_map_lookup(em, le32_to_cpu(rec->e_cpos), |
452 | le32_to_cpu(rec->e_clusters), NULL, | 458 | le32_to_cpu(rec->e_clusters), |
453 | NULL); | 459 | NULL, NULL); |
454 | 460 | ||
455 | BUG_ON(!old_ent); | 461 | BUG_ON(!old_ent); |
456 | 462 | ||
457 | ret = -EEXIST; | 463 | if (old_ent->e_tree_depth < tree_depth) { |
458 | if (old_ent->e_tree_depth < tree_depth) | 464 | /* Another thread beat us to the lower tree_depth */ |
465 | ret = -EEXIST; | ||
459 | goto out_unlock; | 466 | goto out_unlock; |
467 | } | ||
460 | 468 | ||
461 | if (old_ent->e_tree_depth == tree_depth) { | 469 | if (old_ent->e_tree_depth == tree_depth) { |
470 | /* | ||
471 | * Another thread beat us to this tree_depth. | ||
472 | * Let's make sure we agree with that thread (the | ||
473 | * extent_rec should be identical). | ||
474 | */ | ||
462 | if (!memcmp(rec, &old_ent->e_rec, | 475 | if (!memcmp(rec, &old_ent->e_rec, |
463 | sizeof(struct ocfs2_extent_rec))) | 476 | sizeof(struct ocfs2_extent_rec))) |
464 | ret = 0; | 477 | ret = 0; |
478 | else | ||
479 | /* FIXME: Should this be ESRCH/EBADR??? */ | ||
480 | ret = -EEXIST; | ||
465 | 481 | ||
466 | /* FIXME: Should this be ESRCH/EBADR??? */ | ||
467 | goto out_unlock; | 482 | goto out_unlock; |
468 | } | 483 | } |
469 | 484 | ||
@@ -599,7 +614,7 @@ static int ocfs2_extent_map_insert(struct inode *inode, | |||
599 | tree_depth, &ctxt); | 614 | tree_depth, &ctxt); |
600 | } while (ret == -EAGAIN); | 615 | } while (ret == -EAGAIN); |
601 | 616 | ||
602 | if (ret < 0) | 617 | if ((ret < 0) && (ret != -EEXIST)) |
603 | mlog_errno(ret); | 618 | mlog_errno(ret); |
604 | 619 | ||
605 | if (ctxt.left_ent) | 620 | if (ctxt.left_ent) |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 910a601b2e98..f92bf1dd379a 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -784,8 +784,7 @@ int ocfs2_journal_load(struct ocfs2_journal *journal) | |||
784 | } | 784 | } |
785 | 785 | ||
786 | /* Launch the commit thread */ | 786 | /* Launch the commit thread */ |
787 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt-%d", | 787 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt"); |
788 | osb->osb_id); | ||
789 | if (IS_ERR(osb->commit_task)) { | 788 | if (IS_ERR(osb->commit_task)) { |
790 | status = PTR_ERR(osb->commit_task); | 789 | status = PTR_ERR(osb->commit_task); |
791 | osb->commit_task = NULL; | 790 | osb->commit_task = NULL; |
@@ -1118,7 +1117,7 @@ void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) | |||
1118 | goto out; | 1117 | goto out; |
1119 | 1118 | ||
1120 | osb->recovery_thread_task = kthread_run(__ocfs2_recovery_thread, osb, | 1119 | osb->recovery_thread_task = kthread_run(__ocfs2_recovery_thread, osb, |
1121 | "ocfs2rec-%d", osb->osb_id); | 1120 | "ocfs2rec"); |
1122 | if (IS_ERR(osb->recovery_thread_task)) { | 1121 | if (IS_ERR(osb->recovery_thread_task)) { |
1123 | mlog_errno((int)PTR_ERR(osb->recovery_thread_task)); | 1122 | mlog_errno((int)PTR_ERR(osb->recovery_thread_task)); |
1124 | osb->recovery_thread_task = NULL; | 1123 | osb->recovery_thread_task = NULL; |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 843cf9ddefe8..83934e33e5b0 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -46,12 +46,12 @@ static struct page *ocfs2_nopage(struct vm_area_struct * area, | |||
46 | unsigned long address, | 46 | unsigned long address, |
47 | int *type) | 47 | int *type) |
48 | { | 48 | { |
49 | struct inode *inode = area->vm_file->f_dentry->d_inode; | ||
50 | struct page *page = NOPAGE_SIGBUS; | 49 | struct page *page = NOPAGE_SIGBUS; |
51 | sigset_t blocked, oldset; | 50 | sigset_t blocked, oldset; |
52 | int ret; | 51 | int ret; |
53 | 52 | ||
54 | mlog_entry("(inode %lu, address %lu)\n", inode->i_ino, address); | 53 | mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address, |
54 | type); | ||
55 | 55 | ||
56 | /* The best way to deal with signals in this path is | 56 | /* The best way to deal with signals in this path is |
57 | * to block them upfront, rather than allowing the | 57 | * to block them upfront, rather than allowing the |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index da1093039c01..cd4a6f253d13 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -184,7 +184,6 @@ struct ocfs2_journal; | |||
184 | struct ocfs2_journal_handle; | 184 | struct ocfs2_journal_handle; |
185 | struct ocfs2_super | 185 | struct ocfs2_super |
186 | { | 186 | { |
187 | u32 osb_id; /* id used by the proc interface */ | ||
188 | struct task_struct *commit_task; | 187 | struct task_struct *commit_task; |
189 | struct super_block *sb; | 188 | struct super_block *sb; |
190 | struct inode *root_inode; | 189 | struct inode *root_inode; |
@@ -222,13 +221,11 @@ struct ocfs2_super | |||
222 | unsigned long s_mount_opt; | 221 | unsigned long s_mount_opt; |
223 | 222 | ||
224 | u16 max_slots; | 223 | u16 max_slots; |
225 | u16 num_nodes; | ||
226 | s16 node_num; | 224 | s16 node_num; |
227 | s16 slot_num; | 225 | s16 slot_num; |
228 | int s_sectsize_bits; | 226 | int s_sectsize_bits; |
229 | int s_clustersize; | 227 | int s_clustersize; |
230 | int s_clustersize_bits; | 228 | int s_clustersize_bits; |
231 | struct proc_dir_entry *proc_sub_dir; /* points to /proc/fs/ocfs2/<maj_min> */ | ||
232 | 229 | ||
233 | atomic_t vol_state; | 230 | atomic_t vol_state; |
234 | struct mutex recovery_lock; | 231 | struct mutex recovery_lock; |
@@ -294,7 +291,6 @@ struct ocfs2_super | |||
294 | }; | 291 | }; |
295 | 292 | ||
296 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) | 293 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) |
297 | #define OCFS2_MAX_OSB_ID 65536 | ||
298 | 294 | ||
299 | static inline int ocfs2_should_order_data(struct inode *inode) | 295 | static inline int ocfs2_should_order_data(struct inode *inode) |
300 | { | 296 | { |
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c index 871627961d6d..aa6f5aadedc4 100644 --- a/fs/ocfs2/slot_map.c +++ b/fs/ocfs2/slot_map.c | |||
@@ -264,7 +264,7 @@ int ocfs2_find_slot(struct ocfs2_super *osb) | |||
264 | osb->slot_num = slot; | 264 | osb->slot_num = slot; |
265 | spin_unlock(&si->si_lock); | 265 | spin_unlock(&si->si_lock); |
266 | 266 | ||
267 | mlog(ML_NOTICE, "taking node slot %d\n", osb->slot_num); | 267 | mlog(0, "taking node slot %d\n", osb->slot_num); |
268 | 268 | ||
269 | status = ocfs2_update_disk_slots(osb, si); | 269 | status = ocfs2_update_disk_slots(osb, si); |
270 | if (status < 0) | 270 | if (status < 0) |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index cdf73393f094..382706a67ffd 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -68,13 +68,6 @@ | |||
68 | 68 | ||
69 | #include "buffer_head_io.h" | 69 | #include "buffer_head_io.h" |
70 | 70 | ||
71 | /* | ||
72 | * Globals | ||
73 | */ | ||
74 | static spinlock_t ocfs2_globals_lock = SPIN_LOCK_UNLOCKED; | ||
75 | |||
76 | static u32 osb_id; /* Keeps track of next available OSB Id */ | ||
77 | |||
78 | static kmem_cache_t *ocfs2_inode_cachep = NULL; | 71 | static kmem_cache_t *ocfs2_inode_cachep = NULL; |
79 | 72 | ||
80 | kmem_cache_t *ocfs2_lock_cache = NULL; | 73 | kmem_cache_t *ocfs2_lock_cache = NULL; |
@@ -642,10 +635,9 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
642 | 635 | ||
643 | ocfs2_complete_mount_recovery(osb); | 636 | ocfs2_complete_mount_recovery(osb); |
644 | 637 | ||
645 | printk("ocfs2: Mounting device (%u,%u) on (node %d, slot %d) with %s " | 638 | printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %d, slot %d) " |
646 | "data mode.\n", | 639 | "with %s data mode.\n", |
647 | MAJOR(sb->s_dev), MINOR(sb->s_dev), osb->node_num, | 640 | osb->dev_str, osb->node_num, osb->slot_num, |
648 | osb->slot_num, | ||
649 | osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : | 641 | osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : |
650 | "ordered"); | 642 | "ordered"); |
651 | 643 | ||
@@ -800,10 +792,6 @@ static int __init ocfs2_init(void) | |||
800 | goto leave; | 792 | goto leave; |
801 | } | 793 | } |
802 | 794 | ||
803 | spin_lock(&ocfs2_globals_lock); | ||
804 | osb_id = 0; | ||
805 | spin_unlock(&ocfs2_globals_lock); | ||
806 | |||
807 | ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); | 795 | ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); |
808 | if (!ocfs2_debugfs_root) { | 796 | if (!ocfs2_debugfs_root) { |
809 | status = -EFAULT; | 797 | status = -EFAULT; |
@@ -1020,7 +1008,7 @@ static int ocfs2_fill_local_node_info(struct ocfs2_super *osb) | |||
1020 | goto bail; | 1008 | goto bail; |
1021 | } | 1009 | } |
1022 | 1010 | ||
1023 | mlog(ML_NOTICE, "I am node %d\n", osb->node_num); | 1011 | mlog(0, "I am node %d\n", osb->node_num); |
1024 | 1012 | ||
1025 | status = 0; | 1013 | status = 0; |
1026 | bail: | 1014 | bail: |
@@ -1191,8 +1179,8 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1191 | 1179 | ||
1192 | atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); | 1180 | atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); |
1193 | 1181 | ||
1194 | printk("ocfs2: Unmounting device (%u,%u) on (node %d)\n", | 1182 | printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %d)\n", |
1195 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev), osb->node_num); | 1183 | osb->dev_str, osb->node_num); |
1196 | 1184 | ||
1197 | ocfs2_delete_osb(osb); | 1185 | ocfs2_delete_osb(osb); |
1198 | kfree(osb); | 1186 | kfree(osb); |
@@ -1212,8 +1200,6 @@ static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uu | |||
1212 | if (osb->uuid_str == NULL) | 1200 | if (osb->uuid_str == NULL) |
1213 | return -ENOMEM; | 1201 | return -ENOMEM; |
1214 | 1202 | ||
1215 | memcpy(osb->uuid, uuid, OCFS2_VOL_UUID_LEN); | ||
1216 | |||
1217 | for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) { | 1203 | for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) { |
1218 | /* print with null */ | 1204 | /* print with null */ |
1219 | ret = snprintf(ptr, 3, "%02X", uuid[i]); | 1205 | ret = snprintf(ptr, 3, "%02X", uuid[i]); |
@@ -1311,13 +1297,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1311 | goto bail; | 1297 | goto bail; |
1312 | } | 1298 | } |
1313 | 1299 | ||
1314 | osb->uuid = kmalloc(OCFS2_VOL_UUID_LEN, GFP_KERNEL); | ||
1315 | if (!osb->uuid) { | ||
1316 | mlog(ML_ERROR, "unable to alloc uuid\n"); | ||
1317 | status = -ENOMEM; | ||
1318 | goto bail; | ||
1319 | } | ||
1320 | |||
1321 | di = (struct ocfs2_dinode *)bh->b_data; | 1300 | di = (struct ocfs2_dinode *)bh->b_data; |
1322 | 1301 | ||
1323 | osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); | 1302 | osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); |
@@ -1327,7 +1306,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1327 | status = -EINVAL; | 1306 | status = -EINVAL; |
1328 | goto bail; | 1307 | goto bail; |
1329 | } | 1308 | } |
1330 | mlog(ML_NOTICE, "max_slots for this device: %u\n", osb->max_slots); | 1309 | mlog(0, "max_slots for this device: %u\n", osb->max_slots); |
1331 | 1310 | ||
1332 | init_waitqueue_head(&osb->osb_wipe_event); | 1311 | init_waitqueue_head(&osb->osb_wipe_event); |
1333 | osb->osb_orphan_wipes = kcalloc(osb->max_slots, | 1312 | osb->osb_orphan_wipes = kcalloc(osb->max_slots, |
@@ -1418,7 +1397,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1418 | goto bail; | 1397 | goto bail; |
1419 | } | 1398 | } |
1420 | 1399 | ||
1421 | memcpy(&uuid_net_key, &osb->uuid[i], sizeof(osb->net_key)); | 1400 | memcpy(&uuid_net_key, di->id2.i_super.s_uuid, sizeof(uuid_net_key)); |
1422 | osb->net_key = le32_to_cpu(uuid_net_key); | 1401 | osb->net_key = le32_to_cpu(uuid_net_key); |
1423 | 1402 | ||
1424 | strncpy(osb->vol_label, di->id2.i_super.s_label, 63); | 1403 | strncpy(osb->vol_label, di->id2.i_super.s_label, 63); |
@@ -1484,18 +1463,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1484 | goto bail; | 1463 | goto bail; |
1485 | } | 1464 | } |
1486 | 1465 | ||
1487 | /* Link this osb onto the global linked list of all osb structures. */ | ||
1488 | /* The Global Link List is mainted for the whole driver . */ | ||
1489 | spin_lock(&ocfs2_globals_lock); | ||
1490 | osb->osb_id = osb_id; | ||
1491 | if (osb_id < OCFS2_MAX_OSB_ID) | ||
1492 | osb_id++; | ||
1493 | else { | ||
1494 | mlog(ML_ERROR, "Too many volumes mounted\n"); | ||
1495 | status = -ENOMEM; | ||
1496 | } | ||
1497 | spin_unlock(&ocfs2_globals_lock); | ||
1498 | |||
1499 | bail: | 1466 | bail: |
1500 | mlog_exit(status); | 1467 | mlog_exit(status); |
1501 | return status; | 1468 | return status; |
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index 0c8a1294ec96..c0f68aa6c175 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c | |||
@@ -154,7 +154,7 @@ static void *ocfs2_follow_link(struct dentry *dentry, | |||
154 | } | 154 | } |
155 | 155 | ||
156 | status = vfs_follow_link(nd, link); | 156 | status = vfs_follow_link(nd, link); |
157 | if (status) | 157 | if (status && status != -ENOENT) |
158 | mlog_errno(status); | 158 | mlog_errno(status); |
159 | bail: | 159 | bail: |
160 | if (page) { | 160 | if (page) { |
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile index 42c7d3878ed0..d713ce6b3e12 100644 --- a/fs/partitions/Makefile +++ b/fs/partitions/Makefile | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | obj-y := check.o | 5 | obj-y := check.o |
6 | 6 | ||
7 | obj-$(CONFIG_DEVFS_FS) += devfs.o | ||
8 | obj-$(CONFIG_ACORN_PARTITION) += acorn.o | 7 | obj-$(CONFIG_ACORN_PARTITION) += acorn.o |
9 | obj-$(CONFIG_AMIGA_PARTITION) += amiga.o | 8 | obj-$(CONFIG_AMIGA_PARTITION) += amiga.o |
10 | obj-$(CONFIG_ATARI_PARTITION) += atari.o | 9 | obj-$(CONFIG_ATARI_PARTITION) += atari.o |
diff --git a/fs/partitions/acorn.c b/fs/partitions/acorn.c index c05085710fce..1bc9f372c7d4 100644 --- a/fs/partitions/acorn.c +++ b/fs/partitions/acorn.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * every single manufacturer of SCSI and IDE cards created their own | 12 | * every single manufacturer of SCSI and IDE cards created their own |
13 | * method. | 13 | * method. |
14 | */ | 14 | */ |
15 | #include <linux/config.h> | ||
16 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
17 | #include <linux/adfs_fs.h> | 16 | #include <linux/adfs_fs.h> |
18 | 17 | ||
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 2ef313a96b66..839634026eb5 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -18,10 +18,8 @@ | |||
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/kmod.h> | 19 | #include <linux/kmod.h> |
20 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
21 | #include <linux/devfs_fs_kernel.h> | ||
22 | 21 | ||
23 | #include "check.h" | 22 | #include "check.h" |
24 | #include "devfs.h" | ||
25 | 23 | ||
26 | #include "acorn.h" | 24 | #include "acorn.h" |
27 | #include "amiga.h" | 25 | #include "amiga.h" |
@@ -161,18 +159,11 @@ check_partition(struct gendisk *hd, struct block_device *bdev) | |||
161 | if (!state) | 159 | if (!state) |
162 | return NULL; | 160 | return NULL; |
163 | 161 | ||
164 | #ifdef CONFIG_DEVFS_FS | 162 | disk_name(hd, 0, state->name); |
165 | if (hd->devfs_name[0] != '\0') { | 163 | printk(KERN_INFO " %s:", state->name); |
166 | printk(KERN_INFO " /dev/%s:", hd->devfs_name); | 164 | if (isdigit(state->name[strlen(state->name)-1])) |
167 | sprintf(state->name, "p"); | 165 | sprintf(state->name, "p"); |
168 | } | 166 | |
169 | #endif | ||
170 | else { | ||
171 | disk_name(hd, 0, state->name); | ||
172 | printk(KERN_INFO " %s:", state->name); | ||
173 | if (isdigit(state->name[strlen(state->name)-1])) | ||
174 | sprintf(state->name, "p"); | ||
175 | } | ||
176 | state->limit = hd->minors; | 167 | state->limit = hd->minors; |
177 | i = res = 0; | 168 | i = res = 0; |
178 | while (!res && check_part[i]) { | 169 | while (!res && check_part[i]) { |
@@ -328,7 +319,6 @@ void delete_partition(struct gendisk *disk, int part) | |||
328 | p->nr_sects = 0; | 319 | p->nr_sects = 0; |
329 | p->ios[0] = p->ios[1] = 0; | 320 | p->ios[0] = p->ios[1] = 0; |
330 | p->sectors[0] = p->sectors[1] = 0; | 321 | p->sectors[0] = p->sectors[1] = 0; |
331 | devfs_remove("%s/part%d", disk->devfs_name, part); | ||
332 | sysfs_remove_link(&p->kobj, "subsystem"); | 322 | sysfs_remove_link(&p->kobj, "subsystem"); |
333 | if (p->holder_dir) | 323 | if (p->holder_dir) |
334 | kobject_unregister(p->holder_dir); | 324 | kobject_unregister(p->holder_dir); |
@@ -350,10 +340,6 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) | |||
350 | p->nr_sects = len; | 340 | p->nr_sects = len; |
351 | p->partno = part; | 341 | p->partno = part; |
352 | 342 | ||
353 | devfs_mk_bdev(MKDEV(disk->major, disk->first_minor + part), | ||
354 | S_IFBLK|S_IRUSR|S_IWUSR, | ||
355 | "%s/part%d", disk->devfs_name, part); | ||
356 | |||
357 | if (isdigit(disk->kobj.name[strlen(disk->kobj.name)-1])) | 343 | if (isdigit(disk->kobj.name[strlen(disk->kobj.name)-1])) |
358 | snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part); | 344 | snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part); |
359 | else | 345 | else |
@@ -423,14 +409,8 @@ void register_disk(struct gendisk *disk) | |||
423 | disk_sysfs_add_subdirs(disk); | 409 | disk_sysfs_add_subdirs(disk); |
424 | 410 | ||
425 | /* No minors to use for partitions */ | 411 | /* No minors to use for partitions */ |
426 | if (disk->minors == 1) { | 412 | if (disk->minors == 1) |
427 | if (disk->devfs_name[0] != '\0') | ||
428 | devfs_add_disk(disk); | ||
429 | goto exit; | 413 | goto exit; |
430 | } | ||
431 | |||
432 | /* always add handle for the whole disk */ | ||
433 | devfs_add_partitioned(disk); | ||
434 | 414 | ||
435 | /* No such device (e.g., media were just removed) */ | 415 | /* No such device (e.g., media were just removed) */ |
436 | if (!get_capacity(disk)) | 416 | if (!get_capacity(disk)) |
@@ -538,8 +518,6 @@ void del_gendisk(struct gendisk *disk) | |||
538 | disk_stat_set_all(disk, 0); | 518 | disk_stat_set_all(disk, 0); |
539 | disk->stamp = 0; | 519 | disk->stamp = 0; |
540 | 520 | ||
541 | devfs_remove_disk(disk); | ||
542 | |||
543 | kobject_uevent(&disk->kobj, KOBJ_REMOVE); | 521 | kobject_uevent(&disk->kobj, KOBJ_REMOVE); |
544 | if (disk->holder_dir) | 522 | if (disk->holder_dir) |
545 | kobject_unregister(disk->holder_dir); | 523 | kobject_unregister(disk->holder_dir); |
diff --git a/fs/partitions/devfs.c b/fs/partitions/devfs.c deleted file mode 100644 index 3f0a780c9cec..000000000000 --- a/fs/partitions/devfs.c +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | /* | ||
2 | * This tries to keep block devices away from devfs as much as possible. | ||
3 | */ | ||
4 | #include <linux/fs.h> | ||
5 | #include <linux/devfs_fs_kernel.h> | ||
6 | #include <linux/vmalloc.h> | ||
7 | #include <linux/genhd.h> | ||
8 | #include <linux/bitops.h> | ||
9 | #include <linux/mutex.h> | ||
10 | |||
11 | |||
12 | struct unique_numspace { | ||
13 | u32 num_free; /* Num free in bits */ | ||
14 | u32 length; /* Array length in bytes */ | ||
15 | unsigned long *bits; | ||
16 | struct semaphore mutex; | ||
17 | }; | ||
18 | |||
19 | static DEFINE_MUTEX(numspace_mutex); | ||
20 | |||
21 | static int expand_numspace(struct unique_numspace *s) | ||
22 | { | ||
23 | u32 length; | ||
24 | void *bits; | ||
25 | |||
26 | if (s->length < 16) | ||
27 | length = 16; | ||
28 | else | ||
29 | length = s->length << 1; | ||
30 | |||
31 | bits = vmalloc(length); | ||
32 | if (!bits) | ||
33 | return -ENOMEM; | ||
34 | if (s->bits) { | ||
35 | memcpy(bits, s->bits, s->length); | ||
36 | vfree(s->bits); | ||
37 | } | ||
38 | |||
39 | s->num_free = (length - s->length) << 3; | ||
40 | s->bits = bits; | ||
41 | memset(bits + s->length, 0, length - s->length); | ||
42 | s->length = length; | ||
43 | |||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | static int alloc_unique_number(struct unique_numspace *s) | ||
48 | { | ||
49 | int rval = 0; | ||
50 | |||
51 | mutex_lock(&numspace_mutex); | ||
52 | if (s->num_free < 1) | ||
53 | rval = expand_numspace(s); | ||
54 | if (!rval) { | ||
55 | rval = find_first_zero_bit(s->bits, s->length << 3); | ||
56 | --s->num_free; | ||
57 | __set_bit(rval, s->bits); | ||
58 | } | ||
59 | mutex_unlock(&numspace_mutex); | ||
60 | |||
61 | return rval; | ||
62 | } | ||
63 | |||
64 | static void dealloc_unique_number(struct unique_numspace *s, int number) | ||
65 | { | ||
66 | int old_val; | ||
67 | |||
68 | if (number >= 0) { | ||
69 | mutex_lock(&numspace_mutex); | ||
70 | old_val = __test_and_clear_bit(number, s->bits); | ||
71 | if (old_val) | ||
72 | ++s->num_free; | ||
73 | mutex_unlock(&numspace_mutex); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | static struct unique_numspace disc_numspace; | ||
78 | static struct unique_numspace cdrom_numspace; | ||
79 | |||
80 | void devfs_add_partitioned(struct gendisk *disk) | ||
81 | { | ||
82 | char dirname[64], symlink[16]; | ||
83 | |||
84 | devfs_mk_dir(disk->devfs_name); | ||
85 | devfs_mk_bdev(MKDEV(disk->major, disk->first_minor), | ||
86 | S_IFBLK|S_IRUSR|S_IWUSR, | ||
87 | "%s/disc", disk->devfs_name); | ||
88 | |||
89 | disk->number = alloc_unique_number(&disc_numspace); | ||
90 | |||
91 | sprintf(symlink, "discs/disc%d", disk->number); | ||
92 | sprintf(dirname, "../%s", disk->devfs_name); | ||
93 | devfs_mk_symlink(symlink, dirname); | ||
94 | |||
95 | } | ||
96 | |||
97 | void devfs_add_disk(struct gendisk *disk) | ||
98 | { | ||
99 | devfs_mk_bdev(MKDEV(disk->major, disk->first_minor), | ||
100 | (disk->flags & GENHD_FL_CD) ? | ||
101 | S_IFBLK|S_IRUGO|S_IWUGO : | ||
102 | S_IFBLK|S_IRUSR|S_IWUSR, | ||
103 | "%s", disk->devfs_name); | ||
104 | |||
105 | if (disk->flags & GENHD_FL_CD) { | ||
106 | char dirname[64], symlink[16]; | ||
107 | |||
108 | disk->number = alloc_unique_number(&cdrom_numspace); | ||
109 | |||
110 | sprintf(symlink, "cdroms/cdrom%d", disk->number); | ||
111 | sprintf(dirname, "../%s", disk->devfs_name); | ||
112 | devfs_mk_symlink(symlink, dirname); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | void devfs_remove_disk(struct gendisk *disk) | ||
117 | { | ||
118 | if (disk->minors != 1) { | ||
119 | devfs_remove("discs/disc%d", disk->number); | ||
120 | dealloc_unique_number(&disc_numspace, disk->number); | ||
121 | devfs_remove("%s/disc", disk->devfs_name); | ||
122 | } | ||
123 | if (disk->flags & GENHD_FL_CD) { | ||
124 | devfs_remove("cdroms/cdrom%d", disk->number); | ||
125 | dealloc_unique_number(&cdrom_numspace, disk->number); | ||
126 | } | ||
127 | devfs_remove(disk->devfs_name); | ||
128 | } | ||
129 | |||
130 | |||
diff --git a/fs/partitions/devfs.h b/fs/partitions/devfs.h deleted file mode 100644 index 176118b4e492..000000000000 --- a/fs/partitions/devfs.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | |||
2 | #ifdef CONFIG_DEVFS_FS | ||
3 | void devfs_add_disk(struct gendisk *dev); | ||
4 | void devfs_add_partitioned(struct gendisk *dev); | ||
5 | void devfs_remove_disk(struct gendisk *dev); | ||
6 | #else | ||
7 | # define devfs_add_disk(disk) do { } while (0) | ||
8 | # define devfs_add_partitioned(disk) do { } while (0) | ||
9 | # define devfs_remove_disk(disk) do { } while (0) | ||
10 | #endif | ||
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index 0f5b017aebad..63730282ad81 100644 --- a/fs/partitions/efi.c +++ b/fs/partitions/efi.c | |||
@@ -91,7 +91,6 @@ | |||
91 | * - Code works, detects all the partitions. | 91 | * - Code works, detects all the partitions. |
92 | * | 92 | * |
93 | ************************************************************/ | 93 | ************************************************************/ |
94 | #include <linux/config.h> | ||
95 | #include <linux/crc32.h> | 94 | #include <linux/crc32.h> |
96 | #include "check.h" | 95 | #include "check.h" |
97 | #include "efi.h" | 96 | #include "efi.h" |
diff --git a/fs/partitions/efi.h b/fs/partitions/efi.h index c44fb0561448..2cc89d0475bf 100644 --- a/fs/partitions/efi.h +++ b/fs/partitions/efi.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #define FS_PART_EFI_H_INCLUDED | 26 | #define FS_PART_EFI_H_INCLUDED |
27 | 27 | ||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/config.h> | ||
30 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
31 | #include <linux/genhd.h> | 30 | #include <linux/genhd.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c index 830c55d86ab1..d352a7381fed 100644 --- a/fs/partitions/ibm.c +++ b/fs/partitions/ibm.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 | 6 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/buffer_head.h> | 9 | #include <linux/buffer_head.h> |
11 | #include <linux/hdreg.h> | 10 | #include <linux/hdreg.h> |
12 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
diff --git a/fs/partitions/mac.c b/fs/partitions/mac.c index 813292f21210..c0871002d00d 100644 --- a/fs/partitions/mac.c +++ b/fs/partitions/mac.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * Re-organised Feb 1998 Russell King | 6 | * Re-organised Feb 1998 Russell King |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <linux/ctype.h> | 9 | #include <linux/ctype.h> |
11 | #include "check.h" | 10 | #include "check.h" |
12 | #include "mac.h" | 11 | #include "mac.h" |
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 9935d254186e..8f12587c3129 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c | |||
@@ -19,7 +19,6 @@ | |||
19 | * Re-organised Feb 1998 Russell King | 19 | * Re-organised Feb 1998 Russell King |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/config.h> | ||
23 | 22 | ||
24 | #include "check.h" | 23 | #include "check.h" |
25 | #include "msdos.h" | 24 | #include "msdos.h" |
diff --git a/fs/proc/array.c b/fs/proc/array.c index 7a76ad570230..7495d3e20775 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -52,7 +52,6 @@ | |||
52 | * : base.c too. | 52 | * : base.c too. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #include <linux/config.h> | ||
56 | #include <linux/types.h> | 55 | #include <linux/types.h> |
57 | #include <linux/errno.h> | 56 | #include <linux/errno.h> |
58 | #include <linux/time.h> | 57 | #include <linux/time.h> |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 6ba7785319de..243a94af0427 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -49,7 +49,6 @@ | |||
49 | 49 | ||
50 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
51 | 51 | ||
52 | #include <linux/config.h> | ||
53 | #include <linux/errno.h> | 52 | #include <linux/errno.h> |
54 | #include <linux/time.h> | 53 | #include <linux/time.h> |
55 | #include <linux/proc_fs.h> | 54 | #include <linux/proc_fs.h> |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 17f6e8fa1397..036d14d83627 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * Safe accesses to vmalloc/direct-mapped discontiguous areas, Kanoj Sarcar <kanoj@sgi.com> | 9 | * Safe accesses to vmalloc/direct-mapped discontiguous areas, Kanoj Sarcar <kanoj@sgi.com> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
14 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
15 | #include <linux/user.h> | 14 | #include <linux/user.h> |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 5c10ea157425..9f2cfc30f9cf 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/mman.h> | 26 | #include <linux/mman.h> |
27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/config.h> | ||
30 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
31 | #include <linux/mmzone.h> | 30 | #include <linux/mmzone.h> |
32 | #include <linux/pagemap.h> | 31 | #include <linux/pagemap.h> |
@@ -120,7 +119,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
120 | { | 119 | { |
121 | struct sysinfo i; | 120 | struct sysinfo i; |
122 | int len; | 121 | int len; |
123 | struct page_state ps; | ||
124 | unsigned long inactive; | 122 | unsigned long inactive; |
125 | unsigned long active; | 123 | unsigned long active; |
126 | unsigned long free; | 124 | unsigned long free; |
@@ -129,7 +127,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
129 | struct vmalloc_info vmi; | 127 | struct vmalloc_info vmi; |
130 | long cached; | 128 | long cached; |
131 | 129 | ||
132 | get_page_state(&ps); | ||
133 | get_zone_counts(&active, &inactive, &free); | 130 | get_zone_counts(&active, &inactive, &free); |
134 | 131 | ||
135 | /* | 132 | /* |
@@ -142,7 +139,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
142 | allowed = ((totalram_pages - hugetlb_total_pages()) | 139 | allowed = ((totalram_pages - hugetlb_total_pages()) |
143 | * sysctl_overcommit_ratio / 100) + total_swap_pages; | 140 | * sysctl_overcommit_ratio / 100) + total_swap_pages; |
144 | 141 | ||
145 | cached = get_page_cache_size() - total_swapcache_pages - i.bufferram; | 142 | cached = global_page_state(NR_FILE_PAGES) - |
143 | total_swapcache_pages - i.bufferram; | ||
146 | if (cached < 0) | 144 | if (cached < 0) |
147 | cached = 0; | 145 | cached = 0; |
148 | 146 | ||
@@ -167,11 +165,14 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
167 | "SwapFree: %8lu kB\n" | 165 | "SwapFree: %8lu kB\n" |
168 | "Dirty: %8lu kB\n" | 166 | "Dirty: %8lu kB\n" |
169 | "Writeback: %8lu kB\n" | 167 | "Writeback: %8lu kB\n" |
168 | "AnonPages: %8lu kB\n" | ||
170 | "Mapped: %8lu kB\n" | 169 | "Mapped: %8lu kB\n" |
171 | "Slab: %8lu kB\n" | 170 | "Slab: %8lu kB\n" |
171 | "PageTables: %8lu kB\n" | ||
172 | "NFS Unstable: %8lu kB\n" | ||
173 | "Bounce: %8lu kB\n" | ||
172 | "CommitLimit: %8lu kB\n" | 174 | "CommitLimit: %8lu kB\n" |
173 | "Committed_AS: %8lu kB\n" | 175 | "Committed_AS: %8lu kB\n" |
174 | "PageTables: %8lu kB\n" | ||
175 | "VmallocTotal: %8lu kB\n" | 176 | "VmallocTotal: %8lu kB\n" |
176 | "VmallocUsed: %8lu kB\n" | 177 | "VmallocUsed: %8lu kB\n" |
177 | "VmallocChunk: %8lu kB\n", | 178 | "VmallocChunk: %8lu kB\n", |
@@ -188,13 +189,16 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
188 | K(i.freeram-i.freehigh), | 189 | K(i.freeram-i.freehigh), |
189 | K(i.totalswap), | 190 | K(i.totalswap), |
190 | K(i.freeswap), | 191 | K(i.freeswap), |
191 | K(ps.nr_dirty), | 192 | K(global_page_state(NR_FILE_DIRTY)), |
192 | K(ps.nr_writeback), | 193 | K(global_page_state(NR_WRITEBACK)), |
193 | K(ps.nr_mapped), | 194 | K(global_page_state(NR_ANON_PAGES)), |
194 | K(ps.nr_slab), | 195 | K(global_page_state(NR_FILE_MAPPED)), |
196 | K(global_page_state(NR_SLAB)), | ||
197 | K(global_page_state(NR_PAGETABLE)), | ||
198 | K(global_page_state(NR_UNSTABLE_NFS)), | ||
199 | K(global_page_state(NR_BOUNCE)), | ||
195 | K(allowed), | 200 | K(allowed), |
196 | K(committed), | 201 | K(committed), |
197 | K(ps.nr_page_table_pages), | ||
198 | (unsigned long)VMALLOC_TOTAL >> 10, | 202 | (unsigned long)VMALLOC_TOTAL >> 10, |
199 | vmi.used >> 10, | 203 | vmi.used >> 10, |
200 | vmi.largest_chunk >> 10 | 204 | vmi.largest_chunk >> 10 |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 9995356ce73e..8901c65caca8 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/time.h> | 12 | #include <linux/time.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/stat.h> | 14 | #include <linux/stat.h> |
15 | #include <linux/config.h> | ||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 20d4b2237fce..d96050728c43 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/config.h> | ||
11 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
12 | #include <linux/proc_fs.h> | 11 | #include <linux/proc_fs.h> |
13 | #include <linux/user.h> | 12 | #include <linux/user.h> |
diff --git a/fs/qnx4/bitmap.c b/fs/qnx4/bitmap.c index 46efbf52cbec..8425cf6e9624 100644 --- a/fs/qnx4/bitmap.c +++ b/fs/qnx4/bitmap.c | |||
@@ -13,7 +13,6 @@ | |||
13 | * 28-06-1998 by Frank Denis : qnx4_free_inode (to be fixed) . | 13 | * 28-06-1998 by Frank Denis : qnx4_free_inode (to be fixed) . |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/config.h> | ||
17 | #include <linux/time.h> | 16 | #include <linux/time.h> |
18 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
19 | #include <linux/qnx4_fs.h> | 18 | #include <linux/qnx4_fs.h> |
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c index 9031948fefd0..0d7103fa0df5 100644 --- a/fs/qnx4/dir.c +++ b/fs/qnx4/dir.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * 20-06-1998 by Frank Denis : Linux 2.1.99+ & dcache support. | 11 | * 20-06-1998 by Frank Denis : Linux 2.1.99+ & dcache support. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/string.h> | 14 | #include <linux/string.h> |
16 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
diff --git a/fs/qnx4/fsync.c b/fs/qnx4/fsync.c index df5bc75d5414..aa3b19544bee 100644 --- a/fs/qnx4/fsync.c +++ b/fs/qnx4/fsync.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * 24-03-1998 by Richard Frowijn : first release. | 10 | * 24-03-1998 by Richard Frowijn : first release. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
15 | #include <linux/time.h> | 14 | #include <linux/time.h> |
16 | #include <linux/stat.h> | 15 | #include <linux/stat.h> |
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 8bc182a88748..5a903491e697 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * 30-06-1998 by Frank Denis : first step to write inodes. | 12 | * 30-06-1998 by Frank Denis : first step to write inodes. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/types.h> | 16 | #include <linux/types.h> |
18 | #include <linux/string.h> | 17 | #include <linux/string.h> |
diff --git a/fs/qnx4/namei.c b/fs/qnx4/namei.c index 4af4951d7f54..c3d83f67154a 100644 --- a/fs/qnx4/namei.c +++ b/fs/qnx4/namei.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * 04-07-1998 by Frank Denis : first step for rmdir/unlink. | 12 | * 04-07-1998 by Frank Denis : first step for rmdir/unlink. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/time.h> | 15 | #include <linux/time.h> |
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/qnx4_fs.h> | 17 | #include <linux/qnx4_fs.h> |
diff --git a/fs/qnx4/truncate.c b/fs/qnx4/truncate.c index 86563ec01b39..6437c1c3d1dd 100644 --- a/fs/qnx4/truncate.c +++ b/fs/qnx4/truncate.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * 30-06-1998 by Frank DENIS : ugly filler. | 10 | * 30-06-1998 by Frank DENIS : ugly filler. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/types.h> | 13 | #include <linux/types.h> |
15 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
16 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 909f71e9a30f..4a7dbdee1b6d 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -3,7 +3,6 @@ | |||
3 | */ | 3 | */ |
4 | /* Reiserfs block (de)allocator, bitmap-based. */ | 4 | /* Reiserfs block (de)allocator, bitmap-based. */ |
5 | 5 | ||
6 | #include <linux/config.h> | ||
7 | #include <linux/time.h> | 6 | #include <linux/time.h> |
8 | #include <linux/reiserfs_fs.h> | 7 | #include <linux/reiserfs_fs.h> |
9 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 973c819f8033..9aabcc0ccd2d 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <linux/string.h> | 5 | #include <linux/string.h> |
7 | #include <linux/errno.h> | 6 | #include <linux/errno.h> |
8 | #include <linux/fs.h> | 7 | #include <linux/fs.h> |
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c index b2264ba3cc56..fba304e64de8 100644 --- a/fs/reiserfs/do_balan.c +++ b/fs/reiserfs/do_balan.c | |||
@@ -15,7 +15,6 @@ | |||
15 | ** | 15 | ** |
16 | **/ | 16 | **/ |
17 | 17 | ||
18 | #include <linux/config.h> | ||
19 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
20 | #include <linux/time.h> | 19 | #include <linux/time.h> |
21 | #include <linux/reiserfs_fs.h> | 20 | #include <linux/reiserfs_fs.h> |
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c index 5600d3d60cf7..6d0e554daa9d 100644 --- a/fs/reiserfs/fix_node.c +++ b/fs/reiserfs/fix_node.c | |||
@@ -34,7 +34,6 @@ | |||
34 | ** | 34 | ** |
35 | **/ | 35 | **/ |
36 | 36 | ||
37 | #include <linux/config.h> | ||
38 | #include <linux/time.h> | 37 | #include <linux/time.h> |
39 | #include <linux/string.h> | 38 | #include <linux/string.h> |
40 | #include <linux/reiserfs_fs.h> | 39 | #include <linux/reiserfs_fs.h> |
diff --git a/fs/reiserfs/ibalance.c b/fs/reiserfs/ibalance.c index 6c5a726fd34b..de391a82b999 100644 --- a/fs/reiserfs/ibalance.c +++ b/fs/reiserfs/ibalance.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <asm/uaccess.h> | 5 | #include <asm/uaccess.h> |
7 | #include <linux/string.h> | 6 | #include <linux/string.h> |
8 | #include <linux/time.h> | 7 | #include <linux/time.h> |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index a24858a632fa..12dfdcfbee3d 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <linux/time.h> | 5 | #include <linux/time.h> |
7 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
8 | #include <linux/reiserfs_fs.h> | 7 | #include <linux/reiserfs_fs.h> |
@@ -2933,6 +2932,11 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
2933 | } | 2932 | } |
2934 | if (error) | 2933 | if (error) |
2935 | goto out; | 2934 | goto out; |
2935 | /* | ||
2936 | * file size is changed, ctime and mtime are | ||
2937 | * to be updated | ||
2938 | */ | ||
2939 | attr->ia_valid |= (ATTR_MTIME | ATTR_CTIME); | ||
2936 | } | 2940 | } |
2937 | } | 2941 | } |
2938 | 2942 | ||
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 49d1a53dbef0..9b3672d69367 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -34,7 +34,6 @@ | |||
34 | ** from within kupdate, it will ignore the immediate flag | 34 | ** from within kupdate, it will ignore the immediate flag |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/config.h> | ||
38 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
39 | #include <asm/system.h> | 38 | #include <asm/system.h> |
40 | 39 | ||
diff --git a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c index 2533c1f64aba..281f8061ac58 100644 --- a/fs/reiserfs/lbalance.c +++ b/fs/reiserfs/lbalance.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <asm/uaccess.h> | 5 | #include <asm/uaccess.h> |
7 | #include <linux/string.h> | 6 | #include <linux/string.h> |
8 | #include <linux/time.h> | 7 | #include <linux/time.h> |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 284f7852de8b..c61710e49c62 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * NO WARRANTY | 11 | * NO WARRANTY |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/time.h> | 14 | #include <linux/time.h> |
16 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
17 | #include <linux/reiserfs_fs.h> | 16 | #include <linux/reiserfs_fs.h> |
diff --git a/fs/reiserfs/objectid.c b/fs/reiserfs/objectid.c index f62590aa9c95..65feba4deb69 100644 --- a/fs/reiserfs/objectid.c +++ b/fs/reiserfs/objectid.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <linux/string.h> | 5 | #include <linux/string.h> |
7 | #include <linux/random.h> | 6 | #include <linux/random.h> |
8 | #include <linux/time.h> | 7 | #include <linux/time.h> |
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c index 27bd3a1df2ad..bc808a91eeaa 100644 --- a/fs/reiserfs/prints.c +++ b/fs/reiserfs/prints.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <linux/time.h> | 5 | #include <linux/time.h> |
7 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
8 | #include <linux/reiserfs_fs.h> | 7 | #include <linux/reiserfs_fs.h> |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index 731688e1cfe3..5d8a8cfebc70 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | /* $Id: procfs.c,v 1.1.8.2 2001/07/15 17:08:42 god Exp $ */ | 11 | /* $Id: procfs.c,v 1.1.8.2 2001/07/15 17:08:42 god Exp $ */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
15 | #include <linux/time.h> | 14 | #include <linux/time.h> |
16 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index d2b25e1ba6e9..8b9b13127136 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -49,7 +49,6 @@ | |||
49 | * reiserfs_insert_item | 49 | * reiserfs_insert_item |
50 | */ | 50 | */ |
51 | 51 | ||
52 | #include <linux/config.h> | ||
53 | #include <linux/time.h> | 52 | #include <linux/time.h> |
54 | #include <linux/string.h> | 53 | #include <linux/string.h> |
55 | #include <linux/pagemap.h> | 54 | #include <linux/pagemap.h> |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 00f1321e9209..28eb3c886034 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * NO WARRANTY | 11 | * NO WARRANTY |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
16 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
17 | #include <linux/time.h> | 16 | #include <linux/time.h> |
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c index 196e971c03c9..36f108fc1cf5 100644 --- a/fs/reiserfs/tail_conversion.c +++ b/fs/reiserfs/tail_conversion.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * Copyright 1999 Hans Reiser, see reiserfs/README for licensing and copyright details | 2 | * Copyright 1999 Hans Reiser, see reiserfs/README for licensing and copyright details |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <linux/time.h> | 5 | #include <linux/time.h> |
7 | #include <linux/pagemap.h> | 6 | #include <linux/pagemap.h> |
8 | #include <linux/buffer_head.h> | 7 | #include <linux/buffer_head.h> |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 506ff87c1d4b..a1ed657c3c84 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * Please add a note about your changes to smbfs in the ChangeLog file. | 7 | * Please add a note about your changes to smbfs in the ChangeLog file. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/config.h> | ||
11 | #include <linux/module.h> | 10 | #include <linux/module.h> |
12 | #include <linux/time.h> | 11 | #include <linux/time.h> |
13 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 24577e2c489b..e67540441288 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Copyright (C) 2001, Urban Widmark | 5 | * Copyright (C) 2001, Urban Widmark |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/config.h> | ||
9 | 8 | ||
10 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
11 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
@@ -4,7 +4,6 @@ | |||
4 | * Copyright (C) 1991, 1992 Linus Torvalds | 4 | * Copyright (C) 1991, 1992 Linus Torvalds |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/module.h> | 7 | #include <linux/module.h> |
9 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
10 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
diff --git a/fs/super.c b/fs/super.c index 8a669f6f3f52..9b780c42d845 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000 | 20 | * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000 |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/config.h> | ||
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
26 | #include <linux/init.h> | 25 | #include <linux/init.h> |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 44fe2cb0bbb2..4df822c881b6 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include "udfdecl.h" | 41 | #include "udfdecl.h" |
42 | 42 | ||
43 | #include <linux/config.h> | ||
44 | #include <linux/blkdev.h> | 43 | #include <linux/blkdev.h> |
45 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
46 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 2f992387cc9e..1033b7cf2939 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #include "osta_udf.h" | 6 | #include "osta_udf.h" |
7 | 7 | ||
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | #include <linux/config.h> | ||
10 | #include <linux/types.h> | 9 | #include <linux/types.h> |
11 | #include <linux/udf_fs_i.h> | 10 | #include <linux/udf_fs_i.h> |
12 | #include <linux/udf_fs_sb.h> | 11 | #include <linux/udf_fs_sb.h> |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 95b878e5c7a0..b01804baa120 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -217,48 +217,6 @@ failed: | |||
217 | return; | 217 | return; |
218 | } | 218 | } |
219 | 219 | ||
220 | static struct page *ufs_get_locked_page(struct address_space *mapping, | ||
221 | unsigned long index) | ||
222 | { | ||
223 | struct page *page; | ||
224 | |||
225 | try_again: | ||
226 | page = find_lock_page(mapping, index); | ||
227 | if (!page) { | ||
228 | page = read_cache_page(mapping, index, | ||
229 | (filler_t*)mapping->a_ops->readpage, | ||
230 | NULL); | ||
231 | if (IS_ERR(page)) { | ||
232 | printk(KERN_ERR "ufs_change_blocknr: " | ||
233 | "read_cache_page error: ino %lu, index: %lu\n", | ||
234 | mapping->host->i_ino, index); | ||
235 | goto out; | ||
236 | } | ||
237 | |||
238 | lock_page(page); | ||
239 | |||
240 | if (!PageUptodate(page) || PageError(page)) { | ||
241 | unlock_page(page); | ||
242 | page_cache_release(page); | ||
243 | |||
244 | printk(KERN_ERR "ufs_change_blocknr: " | ||
245 | "can not read page: ino %lu, index: %lu\n", | ||
246 | mapping->host->i_ino, index); | ||
247 | |||
248 | page = ERR_PTR(-EIO); | ||
249 | goto out; | ||
250 | } | ||
251 | } | ||
252 | |||
253 | if (unlikely(!page->mapping || !page_has_buffers(page))) { | ||
254 | unlock_page(page); | ||
255 | page_cache_release(page); | ||
256 | goto try_again;/*we really need these buffers*/ | ||
257 | } | ||
258 | out: | ||
259 | return page; | ||
260 | } | ||
261 | |||
262 | /* | 220 | /* |
263 | * Modify inode page cache in such way: | 221 | * Modify inode page cache in such way: |
264 | * have - blocks with b_blocknr equal to oldb...oldb+count-1 | 222 | * have - blocks with b_blocknr equal to oldb...oldb+count-1 |
@@ -311,10 +269,8 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk, | |||
311 | 269 | ||
312 | set_page_dirty(page); | 270 | set_page_dirty(page); |
313 | 271 | ||
314 | if (likely(cur_index != index)) { | 272 | if (likely(cur_index != index)) |
315 | unlock_page(page); | 273 | ufs_put_locked_page(page); |
316 | page_cache_release(page); | ||
317 | } | ||
318 | } | 274 | } |
319 | UFSD("EXIT\n"); | 275 | UFSD("EXIT\n"); |
320 | } | 276 | } |
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 0e5001512a9d..a9c6e5f04fae 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -60,7 +60,3 @@ const struct file_operations ufs_file_operations = { | |||
60 | .fsync = ufs_sync_file, | 60 | .fsync = ufs_sync_file, |
61 | .sendfile = generic_file_sendfile, | 61 | .sendfile = generic_file_sendfile, |
62 | }; | 62 | }; |
63 | |||
64 | struct inode_operations ufs_file_inode_operations = { | ||
65 | .truncate = ufs_truncate, | ||
66 | }; | ||
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 8e1f90e42040..e7c8615beb65 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -98,7 +98,9 @@ static u64 ufs_frag_map(struct inode *inode, sector_t frag) | |||
98 | u64 temp = 0L; | 98 | u64 temp = 0L; |
99 | 99 | ||
100 | UFSD(": frag = %llu depth = %d\n", (unsigned long long)frag, depth); | 100 | UFSD(": frag = %llu depth = %d\n", (unsigned long long)frag, depth); |
101 | UFSD(": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n",uspi->s_fpbshift,uspi->s_apbmask,mask); | 101 | UFSD(": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n", |
102 | uspi->s_fpbshift, uspi->s_apbmask, | ||
103 | (unsigned long long)mask); | ||
102 | 104 | ||
103 | if (depth == 0) | 105 | if (depth == 0) |
104 | return 0; | 106 | return 0; |
@@ -429,7 +431,7 @@ int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buffer_head | |||
429 | 431 | ||
430 | if (!create) { | 432 | if (!create) { |
431 | phys64 = ufs_frag_map(inode, fragment); | 433 | phys64 = ufs_frag_map(inode, fragment); |
432 | UFSD("phys64 = %llu \n",phys64); | 434 | UFSD("phys64 = %llu\n", (unsigned long long)phys64); |
433 | if (phys64) | 435 | if (phys64) |
434 | map_bh(bh_result, sb, phys64); | 436 | map_bh(bh_result, sb, phys64); |
435 | return 0; | 437 | return 0; |
@@ -841,14 +843,17 @@ int ufs_sync_inode (struct inode *inode) | |||
841 | 843 | ||
842 | void ufs_delete_inode (struct inode * inode) | 844 | void ufs_delete_inode (struct inode * inode) |
843 | { | 845 | { |
846 | loff_t old_i_size; | ||
847 | |||
844 | truncate_inode_pages(&inode->i_data, 0); | 848 | truncate_inode_pages(&inode->i_data, 0); |
845 | /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/ | 849 | /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/ |
846 | lock_kernel(); | 850 | lock_kernel(); |
847 | mark_inode_dirty(inode); | 851 | mark_inode_dirty(inode); |
848 | ufs_update_inode(inode, IS_SYNC(inode)); | 852 | ufs_update_inode(inode, IS_SYNC(inode)); |
853 | old_i_size = inode->i_size; | ||
849 | inode->i_size = 0; | 854 | inode->i_size = 0; |
850 | if (inode->i_blocks) | 855 | if (inode->i_blocks && ufs_truncate(inode, old_i_size)) |
851 | ufs_truncate (inode); | 856 | ufs_warning(inode->i_sb, __FUNCTION__, "ufs_truncate failed\n"); |
852 | ufs_free_inode (inode); | 857 | ufs_free_inode (inode); |
853 | unlock_kernel(); | 858 | unlock_kernel(); |
854 | } | 859 | } |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 74ef5e9bedff..19a99726e58d 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -64,7 +64,6 @@ | |||
64 | */ | 64 | */ |
65 | 65 | ||
66 | 66 | ||
67 | #include <linux/config.h> | ||
68 | #include <linux/module.h> | 67 | #include <linux/module.h> |
69 | #include <linux/bitops.h> | 68 | #include <linux/bitops.h> |
70 | 69 | ||
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 3c3b301f8701..c9b55872079b 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -369,24 +369,97 @@ static int ufs_trunc_tindirect (struct inode * inode) | |||
369 | UFSD("EXIT\n"); | 369 | UFSD("EXIT\n"); |
370 | return retry; | 370 | return retry; |
371 | } | 371 | } |
372 | 372 | ||
373 | void ufs_truncate (struct inode * inode) | 373 | static int ufs_alloc_lastblock(struct inode *inode) |
374 | { | 374 | { |
375 | int err = 0; | ||
376 | struct address_space *mapping = inode->i_mapping; | ||
377 | struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi; | ||
375 | struct ufs_inode_info *ufsi = UFS_I(inode); | 378 | struct ufs_inode_info *ufsi = UFS_I(inode); |
376 | struct super_block * sb; | 379 | unsigned lastfrag, i, end; |
377 | struct ufs_sb_private_info * uspi; | 380 | struct page *lastpage; |
378 | int retry; | 381 | struct buffer_head *bh; |
382 | |||
383 | lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift; | ||
384 | |||
385 | if (!lastfrag) { | ||
386 | ufsi->i_lastfrag = 0; | ||
387 | goto out; | ||
388 | } | ||
389 | lastfrag--; | ||
390 | |||
391 | lastpage = ufs_get_locked_page(mapping, lastfrag >> | ||
392 | (PAGE_CACHE_SHIFT - inode->i_blkbits)); | ||
393 | if (IS_ERR(lastpage)) { | ||
394 | err = -EIO; | ||
395 | goto out; | ||
396 | } | ||
397 | |||
398 | end = lastfrag & ((1 << (PAGE_CACHE_SHIFT - inode->i_blkbits)) - 1); | ||
399 | bh = page_buffers(lastpage); | ||
400 | for (i = 0; i < end; ++i) | ||
401 | bh = bh->b_this_page; | ||
402 | |||
403 | if (!buffer_mapped(bh)) { | ||
404 | err = ufs_getfrag_block(inode, lastfrag, bh, 1); | ||
405 | |||
406 | if (unlikely(err)) | ||
407 | goto out_unlock; | ||
408 | |||
409 | if (buffer_new(bh)) { | ||
410 | clear_buffer_new(bh); | ||
411 | unmap_underlying_metadata(bh->b_bdev, | ||
412 | bh->b_blocknr); | ||
413 | /* | ||
414 | * we do not zeroize fragment, because of | ||
415 | * if it maped to hole, it already contains zeroes | ||
416 | */ | ||
417 | set_buffer_uptodate(bh); | ||
418 | mark_buffer_dirty(bh); | ||
419 | set_page_dirty(lastpage); | ||
420 | } | ||
421 | } | ||
422 | out_unlock: | ||
423 | ufs_put_locked_page(lastpage); | ||
424 | out: | ||
425 | return err; | ||
426 | } | ||
427 | |||
428 | int ufs_truncate(struct inode *inode, loff_t old_i_size) | ||
429 | { | ||
430 | struct ufs_inode_info *ufsi = UFS_I(inode); | ||
431 | struct super_block *sb = inode->i_sb; | ||
432 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; | ||
433 | int retry, err = 0; | ||
379 | 434 | ||
380 | UFSD("ENTER\n"); | 435 | UFSD("ENTER\n"); |
381 | sb = inode->i_sb; | ||
382 | uspi = UFS_SB(sb)->s_uspi; | ||
383 | 436 | ||
384 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) | 437 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || |
385 | return; | 438 | S_ISLNK(inode->i_mode))) |
439 | return -EINVAL; | ||
386 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | 440 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) |
387 | return; | 441 | return -EPERM; |
442 | |||
443 | if (inode->i_size > old_i_size) { | ||
444 | /* | ||
445 | * if we expand file we should care about | ||
446 | * allocation of block for last byte first of all | ||
447 | */ | ||
448 | err = ufs_alloc_lastblock(inode); | ||
449 | |||
450 | if (err) { | ||
451 | i_size_write(inode, old_i_size); | ||
452 | goto out; | ||
453 | } | ||
454 | /* | ||
455 | * go away, because of we expand file, and we do not | ||
456 | * need free blocks, and zeroizes page | ||
457 | */ | ||
458 | lock_kernel(); | ||
459 | goto almost_end; | ||
460 | } | ||
388 | 461 | ||
389 | block_truncate_page(inode->i_mapping, inode->i_size, ufs_getfrag_block); | 462 | block_truncate_page(inode->i_mapping, inode->i_size, ufs_getfrag_block); |
390 | 463 | ||
391 | lock_kernel(); | 464 | lock_kernel(); |
392 | while (1) { | 465 | while (1) { |
@@ -404,9 +477,58 @@ void ufs_truncate (struct inode * inode) | |||
404 | yield(); | 477 | yield(); |
405 | } | 478 | } |
406 | 479 | ||
480 | if (inode->i_size < old_i_size) { | ||
481 | /* | ||
482 | * now we should have enough space | ||
483 | * to allocate block for last byte | ||
484 | */ | ||
485 | err = ufs_alloc_lastblock(inode); | ||
486 | if (err) | ||
487 | /* | ||
488 | * looks like all the same - we have no space, | ||
489 | * but we truncate file already | ||
490 | */ | ||
491 | inode->i_size = (ufsi->i_lastfrag - 1) * uspi->s_fsize; | ||
492 | } | ||
493 | almost_end: | ||
407 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | 494 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; |
408 | ufsi->i_lastfrag = DIRECT_FRAGMENT; | ||
409 | unlock_kernel(); | 495 | unlock_kernel(); |
410 | mark_inode_dirty(inode); | 496 | mark_inode_dirty(inode); |
411 | UFSD("EXIT\n"); | 497 | out: |
498 | UFSD("EXIT: err %d\n", err); | ||
499 | return err; | ||
412 | } | 500 | } |
501 | |||
502 | |||
503 | /* | ||
504 | * We don't define our `inode->i_op->truncate', and call it here, | ||
505 | * because of: | ||
506 | * - there is no way to know old size | ||
507 | * - there is no way inform user about error, if it happens in `truncate' | ||
508 | */ | ||
509 | static int ufs_setattr(struct dentry *dentry, struct iattr *attr) | ||
510 | { | ||
511 | struct inode *inode = dentry->d_inode; | ||
512 | unsigned int ia_valid = attr->ia_valid; | ||
513 | int error; | ||
514 | |||
515 | error = inode_change_ok(inode, attr); | ||
516 | if (error) | ||
517 | return error; | ||
518 | |||
519 | if (ia_valid & ATTR_SIZE && | ||
520 | attr->ia_size != i_size_read(inode)) { | ||
521 | loff_t old_i_size = inode->i_size; | ||
522 | error = vmtruncate(inode, attr->ia_size); | ||
523 | if (error) | ||
524 | return error; | ||
525 | error = ufs_truncate(inode, old_i_size); | ||
526 | if (error) | ||
527 | return error; | ||
528 | } | ||
529 | return inode_setattr(inode, attr); | ||
530 | } | ||
531 | |||
532 | struct inode_operations ufs_file_inode_operations = { | ||
533 | .setattr = ufs_setattr, | ||
534 | }; | ||
diff --git a/fs/ufs/util.c b/fs/ufs/util.c index a2f13f45708b..337cf2c46d10 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c | |||
@@ -233,3 +233,57 @@ ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev | |||
233 | else | 233 | else |
234 | ufsi->i_u1.i_data[0] = fs32; | 234 | ufsi->i_u1.i_data[0] = fs32; |
235 | } | 235 | } |
236 | |||
237 | /** | ||
238 | * ufs_get_locked_page() - locate, pin and lock a pagecache page, if not exist | ||
239 | * read it from disk. | ||
240 | * @mapping: the address_space to search | ||
241 | * @index: the page index | ||
242 | * | ||
243 | * Locates the desired pagecache page, if not exist we'll read it, | ||
244 | * locks it, increments its reference | ||
245 | * count and returns its address. | ||
246 | * | ||
247 | */ | ||
248 | |||
249 | struct page *ufs_get_locked_page(struct address_space *mapping, | ||
250 | pgoff_t index) | ||
251 | { | ||
252 | struct page *page; | ||
253 | |||
254 | try_again: | ||
255 | page = find_lock_page(mapping, index); | ||
256 | if (!page) { | ||
257 | page = read_cache_page(mapping, index, | ||
258 | (filler_t*)mapping->a_ops->readpage, | ||
259 | NULL); | ||
260 | if (IS_ERR(page)) { | ||
261 | printk(KERN_ERR "ufs_change_blocknr: " | ||
262 | "read_cache_page error: ino %lu, index: %lu\n", | ||
263 | mapping->host->i_ino, index); | ||
264 | goto out; | ||
265 | } | ||
266 | |||
267 | lock_page(page); | ||
268 | |||
269 | if (!PageUptodate(page) || PageError(page)) { | ||
270 | unlock_page(page); | ||
271 | page_cache_release(page); | ||
272 | |||
273 | printk(KERN_ERR "ufs_change_blocknr: " | ||
274 | "can not read page: ino %lu, index: %lu\n", | ||
275 | mapping->host->i_ino, index); | ||
276 | |||
277 | page = ERR_PTR(-EIO); | ||
278 | goto out; | ||
279 | } | ||
280 | } | ||
281 | |||
282 | if (unlikely(!page->mapping || !page_has_buffers(page))) { | ||
283 | unlock_page(page); | ||
284 | page_cache_release(page); | ||
285 | goto try_again;/*we really need these buffers*/ | ||
286 | } | ||
287 | out: | ||
288 | return page; | ||
289 | } | ||
diff --git a/fs/ufs/util.h b/fs/ufs/util.h index 406981fff5e7..28fce6c239b5 100644 --- a/fs/ufs/util.h +++ b/fs/ufs/util.h | |||
@@ -251,6 +251,14 @@ extern void _ubh_ubhcpymem_(struct ufs_sb_private_info *, unsigned char *, struc | |||
251 | #define ubh_memcpyubh(ubh,mem,size) _ubh_memcpyubh_(uspi,ubh,mem,size) | 251 | #define ubh_memcpyubh(ubh,mem,size) _ubh_memcpyubh_(uspi,ubh,mem,size) |
252 | extern void _ubh_memcpyubh_(struct ufs_sb_private_info *, struct ufs_buffer_head *, unsigned char *, unsigned); | 252 | extern void _ubh_memcpyubh_(struct ufs_sb_private_info *, struct ufs_buffer_head *, unsigned char *, unsigned); |
253 | 253 | ||
254 | /* This functions works with cache pages*/ | ||
255 | extern struct page *ufs_get_locked_page(struct address_space *mapping, | ||
256 | pgoff_t index); | ||
257 | static inline void ufs_put_locked_page(struct page *page) | ||
258 | { | ||
259 | unlock_page(page); | ||
260 | page_cache_release(page); | ||
261 | } | ||
254 | 262 | ||
255 | 263 | ||
256 | /* | 264 | /* |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 4dd6592d5a4c..ceda3a2859d2 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #ifndef __XFS_BUF_H__ | 18 | #ifndef __XFS_BUF_H__ |
19 | #define __XFS_BUF_H__ | 19 | #define __XFS_BUF_H__ |
20 | 20 | ||
21 | #include <linux/config.h> | ||
22 | #include <linux/list.h> | 21 | #include <linux/list.h> |
23 | #include <linux/types.h> | 22 | #include <linux/types.h> |
24 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 601f01c92f7f..270db0f3861d 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * along with this program; if not, write the Free Software Foundation, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | #include <linux/config.h> | ||
19 | #include <linux/compat.h> | 18 | #include <linux/compat.h> |
20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
21 | #include <linux/ioctl.h> | 20 | #include <linux/ioctl.h> |
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index 028eb17ec2ed..8c021dc57d1f 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #define __XFS_LINUX__ | 19 | #define __XFS_LINUX__ |
20 | 20 | ||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/config.h> | ||
23 | 22 | ||
24 | /* | 23 | /* |
25 | * Some types are conditional depending on the target system. | 24 | * Some types are conditional depending on the target system. |