diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/Kconfig | 50 | ||||
-rw-r--r-- | fs/coda/psdev.c | 18 | ||||
-rw-r--r-- | fs/debugfs/file.c | 67 | ||||
-rw-r--r-- | fs/jfs/acl.c | 6 | ||||
-rw-r--r-- | fs/jfs/file.c | 9 | ||||
-rw-r--r-- | fs/jfs/inode.c | 11 | ||||
-rw-r--r-- | fs/jfs/jfs_debug.c | 10 | ||||
-rw-r--r-- | fs/jfs/jfs_debug.h | 15 | ||||
-rw-r--r-- | fs/jfs/jfs_dmap.c | 9 | ||||
-rw-r--r-- | fs/jfs/jfs_dtree.c | 3 | ||||
-rw-r--r-- | fs/jfs/jfs_extent.c | 7 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.c | 6 | ||||
-rw-r--r-- | fs/jfs/jfs_inode.c | 1 | ||||
-rw-r--r-- | fs/jfs/jfs_inode.h | 19 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.c | 14 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.h | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_metapage.c | 6 | ||||
-rw-r--r-- | fs/jfs/jfs_metapage.h | 6 | ||||
-rw-r--r-- | fs/jfs/jfs_superblock.h | 11 | ||||
-rw-r--r-- | fs/jfs/jfs_txnmgr.c | 40 | ||||
-rw-r--r-- | fs/jfs/jfs_txnmgr.h | 52 | ||||
-rw-r--r-- | fs/jfs/namei.c | 28 | ||||
-rw-r--r-- | fs/jfs/super.c | 37 | ||||
-rw-r--r-- | fs/jfs/symlink.c | 3 | ||||
-rw-r--r-- | fs/jfs/xattr.c | 6 | ||||
-rw-r--r-- | fs/libfs.c | 100 | ||||
-rw-r--r-- | fs/sysfs/bin.c | 4 | ||||
-rw-r--r-- | fs/sysfs/dir.c | 26 | ||||
-rw-r--r-- | fs/sysfs/file.c | 6 | ||||
-rw-r--r-- | fs/sysfs/inode.c | 102 | ||||
-rw-r--r-- | fs/sysfs/mount.c | 4 | ||||
-rw-r--r-- | fs/sysfs/symlink.c | 8 | ||||
-rw-r--r-- | fs/sysfs/sysfs.h | 4 |
33 files changed, 365 insertions, 325 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index 6a4ad4bb7a54..178e27494b74 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -741,56 +741,6 @@ config SYSFS | |||
741 | 741 | ||
742 | Designers of embedded systems may wish to say N here to conserve space. | 742 | Designers of embedded systems may wish to say N here to conserve space. |
743 | 743 | ||
744 | config DEVFS_FS | ||
745 | bool "/dev file system support (OBSOLETE)" | ||
746 | depends on EXPERIMENTAL | ||
747 | help | ||
748 | This is support for devfs, a virtual file system (like /proc) which | ||
749 | provides the file system interface to device drivers, normally found | ||
750 | in /dev. Devfs does not depend on major and minor number | ||
751 | allocations. Device drivers register entries in /dev which then | ||
752 | appear automatically, which means that the system administrator does | ||
753 | not have to create character and block special device files in the | ||
754 | /dev directory using the mknod command (or MAKEDEV script) anymore. | ||
755 | |||
756 | This is work in progress. If you want to use this, you *must* read | ||
757 | the material in <file:Documentation/filesystems/devfs/>, especially | ||
758 | the file README there. | ||
759 | |||
760 | Note that devfs no longer manages /dev/pts! If you are using UNIX98 | ||
761 | ptys, you will also need to mount the /dev/pts filesystem (devpts). | ||
762 | |||
763 | Note that devfs has been obsoleted by udev, | ||
764 | <http://www.kernel.org/pub/linux/utils/kernel/hotplug/>. | ||
765 | It has been stripped down to a bare minimum and is only provided for | ||
766 | legacy installations that use its naming scheme which is | ||
767 | unfortunately different from the names normal Linux installations | ||
768 | use. | ||
769 | |||
770 | If unsure, say N. | ||
771 | |||
772 | config DEVFS_MOUNT | ||
773 | bool "Automatically mount at boot" | ||
774 | depends on DEVFS_FS | ||
775 | help | ||
776 | This option appears if you have CONFIG_DEVFS_FS enabled. Setting | ||
777 | this to 'Y' will make the kernel automatically mount devfs onto /dev | ||
778 | when the system is booted, before the init thread is started. | ||
779 | You can override this with the "devfs=nomount" boot option. | ||
780 | |||
781 | If unsure, say N. | ||
782 | |||
783 | config DEVFS_DEBUG | ||
784 | bool "Debug devfs" | ||
785 | depends on DEVFS_FS | ||
786 | help | ||
787 | If you say Y here, then the /dev file system code will generate | ||
788 | debugging messages. See the file | ||
789 | <file:Documentation/filesystems/devfs/boot-options> for more | ||
790 | details. | ||
791 | |||
792 | If unsure, say N. | ||
793 | |||
794 | config DEVPTS_FS_XATTR | 744 | config DEVPTS_FS_XATTR |
795 | bool "/dev/pts Extended Attributes" | 745 | bool "/dev/pts Extended Attributes" |
796 | depends on UNIX98_PTYS | 746 | depends on UNIX98_PTYS |
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index ef001a9313e6..3d1cce3653b8 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -61,7 +61,7 @@ unsigned long coda_timeout = 30; /* .. secs, then signals will dequeue */ | |||
61 | 61 | ||
62 | 62 | ||
63 | struct venus_comm coda_comms[MAX_CODADEVS]; | 63 | struct venus_comm coda_comms[MAX_CODADEVS]; |
64 | static struct class_simple *coda_psdev_class; | 64 | static struct class *coda_psdev_class; |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Device operations | 67 | * Device operations |
@@ -363,14 +363,14 @@ static int init_coda_psdev(void) | |||
363 | CODA_PSDEV_MAJOR); | 363 | CODA_PSDEV_MAJOR); |
364 | return -EIO; | 364 | return -EIO; |
365 | } | 365 | } |
366 | coda_psdev_class = class_simple_create(THIS_MODULE, "coda"); | 366 | coda_psdev_class = class_create(THIS_MODULE, "coda"); |
367 | if (IS_ERR(coda_psdev_class)) { | 367 | if (IS_ERR(coda_psdev_class)) { |
368 | err = PTR_ERR(coda_psdev_class); | 368 | err = PTR_ERR(coda_psdev_class); |
369 | goto out_chrdev; | 369 | goto out_chrdev; |
370 | } | 370 | } |
371 | devfs_mk_dir ("coda"); | 371 | devfs_mk_dir ("coda"); |
372 | for (i = 0; i < MAX_CODADEVS; i++) { | 372 | for (i = 0; i < MAX_CODADEVS; i++) { |
373 | class_simple_device_add(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i), | 373 | class_device_create(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i), |
374 | NULL, "cfs%d", i); | 374 | NULL, "cfs%d", i); |
375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), | 375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), |
376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); | 376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); |
@@ -382,8 +382,8 @@ static int init_coda_psdev(void) | |||
382 | 382 | ||
383 | out_class: | 383 | out_class: |
384 | for (i = 0; i < MAX_CODADEVS; i++) | 384 | for (i = 0; i < MAX_CODADEVS; i++) |
385 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 385 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
386 | class_simple_destroy(coda_psdev_class); | 386 | class_destroy(coda_psdev_class); |
387 | out_chrdev: | 387 | out_chrdev: |
388 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 388 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
389 | out: | 389 | out: |
@@ -425,10 +425,10 @@ static int __init init_coda(void) | |||
425 | return 0; | 425 | return 0; |
426 | out: | 426 | out: |
427 | for (i = 0; i < MAX_CODADEVS; i++) { | 427 | for (i = 0; i < MAX_CODADEVS; i++) { |
428 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 428 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
429 | devfs_remove("coda/%d", i); | 429 | devfs_remove("coda/%d", i); |
430 | } | 430 | } |
431 | class_simple_destroy(coda_psdev_class); | 431 | class_destroy(coda_psdev_class); |
432 | devfs_remove("coda"); | 432 | devfs_remove("coda"); |
433 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 433 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
434 | coda_sysctl_clean(); | 434 | coda_sysctl_clean(); |
@@ -447,10 +447,10 @@ static void __exit exit_coda(void) | |||
447 | printk("coda: failed to unregister filesystem\n"); | 447 | printk("coda: failed to unregister filesystem\n"); |
448 | } | 448 | } |
449 | for (i = 0; i < MAX_CODADEVS; i++) { | 449 | for (i = 0; i < MAX_CODADEVS; i++) { |
450 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 450 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
451 | devfs_remove("coda/%d", i); | 451 | devfs_remove("coda/%d", i); |
452 | } | 452 | } |
453 | class_simple_destroy(coda_psdev_class); | 453 | class_destroy(coda_psdev_class); |
454 | devfs_remove("coda"); | 454 | devfs_remove("coda"); |
455 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 455 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
456 | coda_sysctl_clean(); | 456 | coda_sysctl_clean(); |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 548556ff2506..efc97d9b7860 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -45,44 +45,15 @@ struct file_operations debugfs_file_operations = { | |||
45 | .open = default_open, | 45 | .open = default_open, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #define simple_type(type, format, temptype, strtolfn) \ | 48 | static void debugfs_u8_set(void *data, u64 val) |
49 | static ssize_t read_file_##type(struct file *file, char __user *user_buf, \ | 49 | { |
50 | size_t count, loff_t *ppos) \ | 50 | *(u8 *)data = val; |
51 | { \ | 51 | } |
52 | char buf[32]; \ | 52 | static u64 debugfs_u8_get(void *data) |
53 | type *val = file->private_data; \ | 53 | { |
54 | \ | 54 | return *(u8 *)data; |
55 | snprintf(buf, sizeof(buf), format "\n", *val); \ | 55 | } |
56 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));\ | 56 | DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); |
57 | } \ | ||
58 | static ssize_t write_file_##type(struct file *file, const char __user *user_buf,\ | ||
59 | size_t count, loff_t *ppos) \ | ||
60 | { \ | ||
61 | char *endp; \ | ||
62 | char buf[32]; \ | ||
63 | int buf_size; \ | ||
64 | type *val = file->private_data; \ | ||
65 | temptype tmp; \ | ||
66 | \ | ||
67 | memset(buf, 0x00, sizeof(buf)); \ | ||
68 | buf_size = min(count, (sizeof(buf)-1)); \ | ||
69 | if (copy_from_user(buf, user_buf, buf_size)) \ | ||
70 | return -EFAULT; \ | ||
71 | \ | ||
72 | tmp = strtolfn(buf, &endp, 0); \ | ||
73 | if ((endp == buf) || ((type)tmp != tmp)) \ | ||
74 | return -EINVAL; \ | ||
75 | *val = tmp; \ | ||
76 | return count; \ | ||
77 | } \ | ||
78 | static struct file_operations fops_##type = { \ | ||
79 | .read = read_file_##type, \ | ||
80 | .write = write_file_##type, \ | ||
81 | .open = default_open, \ | ||
82 | }; | ||
83 | simple_type(u8, "%c", unsigned long, simple_strtoul); | ||
84 | simple_type(u16, "%hi", unsigned long, simple_strtoul); | ||
85 | simple_type(u32, "%i", unsigned long, simple_strtoul); | ||
86 | 57 | ||
87 | /** | 58 | /** |
88 | * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 59 | * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
@@ -116,6 +87,16 @@ struct dentry *debugfs_create_u8(const char *name, mode_t mode, | |||
116 | } | 87 | } |
117 | EXPORT_SYMBOL_GPL(debugfs_create_u8); | 88 | EXPORT_SYMBOL_GPL(debugfs_create_u8); |
118 | 89 | ||
90 | static void debugfs_u16_set(void *data, u64 val) | ||
91 | { | ||
92 | *(u16 *)data = val; | ||
93 | } | ||
94 | static u64 debugfs_u16_get(void *data) | ||
95 | { | ||
96 | return *(u16 *)data; | ||
97 | } | ||
98 | DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); | ||
99 | |||
119 | /** | 100 | /** |
120 | * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 101 | * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
121 | * | 102 | * |
@@ -148,6 +129,16 @@ struct dentry *debugfs_create_u16(const char *name, mode_t mode, | |||
148 | } | 129 | } |
149 | EXPORT_SYMBOL_GPL(debugfs_create_u16); | 130 | EXPORT_SYMBOL_GPL(debugfs_create_u16); |
150 | 131 | ||
132 | static void debugfs_u32_set(void *data, u64 val) | ||
133 | { | ||
134 | *(u32 *)data = val; | ||
135 | } | ||
136 | static u64 debugfs_u32_get(void *data) | ||
137 | { | ||
138 | return *(u32 *)data; | ||
139 | } | ||
140 | DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); | ||
141 | |||
151 | /** | 142 | /** |
152 | * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 143 | * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
153 | * | 144 | * |
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c index 8d2a9ab981d4..30a2bf9eeda5 100644 --- a/fs/jfs/acl.c +++ b/fs/jfs/acl.c | |||
@@ -70,8 +70,7 @@ static struct posix_acl *jfs_get_acl(struct inode *inode, int type) | |||
70 | if (!IS_ERR(acl)) | 70 | if (!IS_ERR(acl)) |
71 | *p_acl = posix_acl_dup(acl); | 71 | *p_acl = posix_acl_dup(acl); |
72 | } | 72 | } |
73 | if (value) | 73 | kfree(value); |
74 | kfree(value); | ||
75 | return acl; | 74 | return acl; |
76 | } | 75 | } |
77 | 76 | ||
@@ -112,8 +111,7 @@ static int jfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
112 | } | 111 | } |
113 | rc = __jfs_setxattr(inode, ea_name, value, size, 0); | 112 | rc = __jfs_setxattr(inode, ea_name, value, size, 0); |
114 | out: | 113 | out: |
115 | if (value) | 114 | kfree(value); |
116 | kfree(value); | ||
117 | 115 | ||
118 | if (!rc) { | 116 | if (!rc) { |
119 | if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED)) | 117 | if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED)) |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index a87b06fa8ff8..c2c19c9ed9a4 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2002 | 2 | * Copyright (C) International Business Machines Corp., 2000-2002 |
3 | * Portions Copyright (c) Christoph Hellwig, 2001-2002 | 3 | * Portions Copyright (C) Christoph Hellwig, 2001-2002 |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -19,16 +19,13 @@ | |||
19 | 19 | ||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_dmap.h" | 23 | #include "jfs_dmap.h" |
23 | #include "jfs_txnmgr.h" | 24 | #include "jfs_txnmgr.h" |
24 | #include "jfs_xattr.h" | 25 | #include "jfs_xattr.h" |
25 | #include "jfs_acl.h" | 26 | #include "jfs_acl.h" |
26 | #include "jfs_debug.h" | 27 | #include "jfs_debug.h" |
27 | 28 | ||
28 | |||
29 | extern int jfs_commit_inode(struct inode *, int); | ||
30 | extern void jfs_truncate(struct inode *); | ||
31 | |||
32 | int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 29 | int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) |
33 | { | 30 | { |
34 | struct inode *inode = dentry->d_inode; | 31 | struct inode *inode = dentry->d_inode; |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 24a689179af2..2137138c59b0 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
24 | #include <linux/quotaops.h> | 24 | #include <linux/quotaops.h> |
25 | #include "jfs_incore.h" | 25 | #include "jfs_incore.h" |
26 | #include "jfs_inode.h" | ||
26 | #include "jfs_filsys.h" | 27 | #include "jfs_filsys.h" |
27 | #include "jfs_imap.h" | 28 | #include "jfs_imap.h" |
28 | #include "jfs_extent.h" | 29 | #include "jfs_extent.h" |
@@ -30,14 +31,6 @@ | |||
30 | #include "jfs_debug.h" | 31 | #include "jfs_debug.h" |
31 | 32 | ||
32 | 33 | ||
33 | extern struct inode_operations jfs_dir_inode_operations; | ||
34 | extern struct inode_operations jfs_file_inode_operations; | ||
35 | extern struct inode_operations jfs_symlink_inode_operations; | ||
36 | extern struct file_operations jfs_dir_operations; | ||
37 | extern struct file_operations jfs_file_operations; | ||
38 | struct address_space_operations jfs_aops; | ||
39 | extern int freeZeroLink(struct inode *); | ||
40 | |||
41 | void jfs_read_inode(struct inode *inode) | 34 | void jfs_read_inode(struct inode *inode) |
42 | { | 35 | { |
43 | if (diRead(inode)) { | 36 | if (diRead(inode)) { |
@@ -136,7 +129,7 @@ void jfs_delete_inode(struct inode *inode) | |||
136 | jfs_info("In jfs_delete_inode, inode = 0x%p", inode); | 129 | jfs_info("In jfs_delete_inode, inode = 0x%p", inode); |
137 | 130 | ||
138 | if (test_cflag(COMMIT_Freewmap, inode)) | 131 | if (test_cflag(COMMIT_Freewmap, inode)) |
139 | freeZeroLink(inode); | 132 | jfs_free_zero_link(inode); |
140 | 133 | ||
141 | diFree(inode); | 134 | diFree(inode); |
142 | 135 | ||
diff --git a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c index 91a0a889ebc5..4caea6b43b92 100644 --- a/fs/jfs/jfs_debug.c +++ b/fs/jfs/jfs_debug.c | |||
@@ -58,8 +58,6 @@ void dump_mem(char *label, void *data, int length) | |||
58 | 58 | ||
59 | static struct proc_dir_entry *base; | 59 | static struct proc_dir_entry *base; |
60 | #ifdef CONFIG_JFS_DEBUG | 60 | #ifdef CONFIG_JFS_DEBUG |
61 | extern read_proc_t jfs_txanchor_read; | ||
62 | |||
63 | static int loglevel_read(char *page, char **start, off_t off, | 61 | static int loglevel_read(char *page, char **start, off_t off, |
64 | int count, int *eof, void *data) | 62 | int count, int *eof, void *data) |
65 | { | 63 | { |
@@ -97,14 +95,6 @@ static int loglevel_write(struct file *file, const char __user *buffer, | |||
97 | } | 95 | } |
98 | #endif | 96 | #endif |
99 | 97 | ||
100 | |||
101 | #ifdef CONFIG_JFS_STATISTICS | ||
102 | extern read_proc_t jfs_lmstats_read; | ||
103 | extern read_proc_t jfs_txstats_read; | ||
104 | extern read_proc_t jfs_xtstat_read; | ||
105 | extern read_proc_t jfs_mpstat_read; | ||
106 | #endif | ||
107 | |||
108 | static struct { | 98 | static struct { |
109 | const char *name; | 99 | const char *name; |
110 | read_proc_t *read_fn; | 100 | read_proc_t *read_fn; |
diff --git a/fs/jfs/jfs_debug.h b/fs/jfs/jfs_debug.h index a38079ae1e00..ddffbbd4d955 100644 --- a/fs/jfs/jfs_debug.h +++ b/fs/jfs/jfs_debug.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2002 | 2 | * Copyright (C) International Business Machines Corp., 2000-2002 |
3 | * Portions Copyright (c) Christoph Hellwig, 2001-2002 | 3 | * Portions Copyright (C) Christoph Hellwig, 2001-2002 |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -31,7 +31,9 @@ | |||
31 | * CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined | 31 | * CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined |
32 | */ | 32 | */ |
33 | #if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS)) | 33 | #if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS)) |
34 | #define PROC_FS_JFS | 34 | #define PROC_FS_JFS |
35 | extern void jfs_proc_init(void); | ||
36 | extern void jfs_proc_clean(void); | ||
35 | #endif | 37 | #endif |
36 | 38 | ||
37 | /* | 39 | /* |
@@ -65,8 +67,8 @@ | |||
65 | 67 | ||
66 | extern int jfsloglevel; | 68 | extern int jfsloglevel; |
67 | 69 | ||
68 | /* dump memory contents */ | ||
69 | extern void dump_mem(char *label, void *data, int length); | 70 | extern void dump_mem(char *label, void *data, int length); |
71 | extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *); | ||
70 | 72 | ||
71 | /* information message: e.g., configuration, major event */ | 73 | /* information message: e.g., configuration, major event */ |
72 | #define jfs_info(fmt, arg...) do { \ | 74 | #define jfs_info(fmt, arg...) do { \ |
@@ -110,6 +112,11 @@ extern void dump_mem(char *label, void *data, int length); | |||
110 | * ---------- | 112 | * ---------- |
111 | */ | 113 | */ |
112 | #ifdef CONFIG_JFS_STATISTICS | 114 | #ifdef CONFIG_JFS_STATISTICS |
115 | extern int jfs_lmstats_read(char *, char **, off_t, int, int *, void *); | ||
116 | extern int jfs_txstats_read(char *, char **, off_t, int, int *, void *); | ||
117 | extern int jfs_mpstat_read(char *, char **, off_t, int, int *, void *); | ||
118 | extern int jfs_xtstat_read(char *, char **, off_t, int, int *, void *); | ||
119 | |||
113 | #define INCREMENT(x) ((x)++) | 120 | #define INCREMENT(x) ((x)++) |
114 | #define DECREMENT(x) ((x)--) | 121 | #define DECREMENT(x) ((x)--) |
115 | #define HIGHWATERMARK(x,y) ((x) = max((x), (y))) | 122 | #define HIGHWATERMARK(x,y) ((x) = max((x), (y))) |
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 69007fd546ef..cced2fed9d0f 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -272,7 +272,6 @@ int dbMount(struct inode *ipbmap) | |||
272 | int dbUnmount(struct inode *ipbmap, int mounterror) | 272 | int dbUnmount(struct inode *ipbmap, int mounterror) |
273 | { | 273 | { |
274 | struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap; | 274 | struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap; |
275 | int i; | ||
276 | 275 | ||
277 | if (!(mounterror || isReadOnly(ipbmap))) | 276 | if (!(mounterror || isReadOnly(ipbmap))) |
278 | dbSync(ipbmap); | 277 | dbSync(ipbmap); |
@@ -282,14 +281,6 @@ int dbUnmount(struct inode *ipbmap, int mounterror) | |||
282 | */ | 281 | */ |
283 | truncate_inode_pages(ipbmap->i_mapping, 0); | 282 | truncate_inode_pages(ipbmap->i_mapping, 0); |
284 | 283 | ||
285 | /* | ||
286 | * Sanity Check | ||
287 | */ | ||
288 | for (i = 0; i < bmp->db_numag; i++) | ||
289 | if (atomic_read(&bmp->db_active[i])) | ||
290 | printk(KERN_ERR "dbUnmount: db_active[%d] = %d\n", | ||
291 | i, atomic_read(&bmp->db_active[i])); | ||
292 | |||
293 | /* free the memory for the in-memory bmap. */ | 284 | /* free the memory for the in-memory bmap. */ |
294 | kfree(bmp); | 285 | kfree(bmp); |
295 | 286 | ||
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index ac41f72d6d50..8676aee3ae48 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -2931,6 +2931,9 @@ static void add_missing_indices(struct inode *inode, s64 bn) | |||
2931 | ASSERT(p->header.flag & BT_LEAF); | 2931 | ASSERT(p->header.flag & BT_LEAF); |
2932 | 2932 | ||
2933 | tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY); | 2933 | tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY); |
2934 | if (BT_IS_ROOT(mp)) | ||
2935 | tlck->type |= tlckBTROOT; | ||
2936 | |||
2934 | dtlck = (struct dt_lock *) &tlck->lock; | 2937 | dtlck = (struct dt_lock *) &tlck->lock; |
2935 | 2938 | ||
2936 | stbl = DT_GETSTBL(p); | 2939 | stbl = DT_GETSTBL(p); |
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c index 1953acb79266..4879603daa1c 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/quotaops.h> | 20 | #include <linux/quotaops.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_superblock.h" | 23 | #include "jfs_superblock.h" |
23 | #include "jfs_dmap.h" | 24 | #include "jfs_dmap.h" |
24 | #include "jfs_extent.h" | 25 | #include "jfs_extent.h" |
@@ -33,12 +34,6 @@ static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *); | |||
33 | #endif | 34 | #endif |
34 | static s64 extRoundDown(s64 nb); | 35 | static s64 extRoundDown(s64 nb); |
35 | 36 | ||
36 | /* | ||
37 | * external references | ||
38 | */ | ||
39 | extern int jfs_commit_inode(struct inode *, int); | ||
40 | |||
41 | |||
42 | #define DPD(a) (printk("(a): %d\n",(a))) | 37 | #define DPD(a) (printk("(a): %d\n",(a))) |
43 | #define DPC(a) (printk("(a): %c\n",(a))) | 38 | #define DPC(a) (printk("(a): %c\n",(a))) |
44 | #define DPL1(a) \ | 39 | #define DPL1(a) \ |
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 7acff2ce3c80..971af2977eff 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/quotaops.h> | 47 | #include <linux/quotaops.h> |
48 | 48 | ||
49 | #include "jfs_incore.h" | 49 | #include "jfs_incore.h" |
50 | #include "jfs_inode.h" | ||
50 | #include "jfs_filsys.h" | 51 | #include "jfs_filsys.h" |
51 | #include "jfs_dinode.h" | 52 | #include "jfs_dinode.h" |
52 | #include "jfs_dmap.h" | 53 | #include "jfs_dmap.h" |
@@ -69,11 +70,6 @@ | |||
69 | #define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) | 70 | #define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) |
70 | 71 | ||
71 | /* | 72 | /* |
72 | * external references | ||
73 | */ | ||
74 | extern struct address_space_operations jfs_aops; | ||
75 | |||
76 | /* | ||
77 | * forward references | 73 | * forward references |
78 | */ | 74 | */ |
79 | static int diAllocAG(struct inomap *, int, boolean_t, struct inode *); | 75 | static int diAllocAG(struct inomap *, int, boolean_t, struct inode *); |
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index 84f2459b2191..2af5efbfd06f 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/quotaops.h> | 20 | #include <linux/quotaops.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_filsys.h" | 23 | #include "jfs_filsys.h" |
23 | #include "jfs_imap.h" | 24 | #include "jfs_imap.h" |
24 | #include "jfs_dinode.h" | 25 | #include "jfs_dinode.h" |
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index 3df91fbfe781..b54bac576cb3 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2001 | 2 | * Copyright (C) International Business Machines Corp., 2000-2001 |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -19,5 +19,22 @@ | |||
19 | #define _H_JFS_INODE | 19 | #define _H_JFS_INODE |
20 | 20 | ||
21 | extern struct inode *ialloc(struct inode *, umode_t); | 21 | extern struct inode *ialloc(struct inode *, umode_t); |
22 | extern int jfs_fsync(struct file *, struct dentry *, int); | ||
23 | extern void jfs_read_inode(struct inode *); | ||
24 | extern int jfs_commit_inode(struct inode *, int); | ||
25 | extern int jfs_write_inode(struct inode*, int); | ||
26 | extern void jfs_delete_inode(struct inode *); | ||
27 | extern void jfs_dirty_inode(struct inode *); | ||
28 | extern void jfs_truncate(struct inode *); | ||
29 | extern void jfs_truncate_nolock(struct inode *, loff_t); | ||
30 | extern void jfs_free_zero_link(struct inode *); | ||
31 | extern struct dentry *jfs_get_parent(struct dentry *dentry); | ||
22 | 32 | ||
33 | extern struct address_space_operations jfs_aops; | ||
34 | extern struct inode_operations jfs_dir_inode_operations; | ||
35 | extern struct file_operations jfs_dir_operations; | ||
36 | extern struct inode_operations jfs_file_inode_operations; | ||
37 | extern struct file_operations jfs_file_operations; | ||
38 | extern struct inode_operations jfs_symlink_inode_operations; | ||
39 | extern struct dentry_operations jfs_ci_dentry_operations; | ||
23 | #endif /* _H_JFS_INODE */ | 40 | #endif /* _H_JFS_INODE */ |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index dfa1200daa61..7c8387ed4192 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -71,6 +71,7 @@ | |||
71 | #include "jfs_incore.h" | 71 | #include "jfs_incore.h" |
72 | #include "jfs_filsys.h" | 72 | #include "jfs_filsys.h" |
73 | #include "jfs_metapage.h" | 73 | #include "jfs_metapage.h" |
74 | #include "jfs_superblock.h" | ||
74 | #include "jfs_txnmgr.h" | 75 | #include "jfs_txnmgr.h" |
75 | #include "jfs_debug.h" | 76 | #include "jfs_debug.h" |
76 | 77 | ||
@@ -167,14 +168,6 @@ static struct jfs_log *dummy_log = NULL; | |||
167 | static DECLARE_MUTEX(jfs_log_sem); | 168 | static DECLARE_MUTEX(jfs_log_sem); |
168 | 169 | ||
169 | /* | 170 | /* |
170 | * external references | ||
171 | */ | ||
172 | extern void txLazyUnlock(struct tblock * tblk); | ||
173 | extern int jfs_stop_threads; | ||
174 | extern struct completion jfsIOwait; | ||
175 | extern int jfs_tlocks_low; | ||
176 | |||
177 | /* | ||
178 | * forward references | 171 | * forward references |
179 | */ | 172 | */ |
180 | static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk, | 173 | static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk, |
@@ -1624,6 +1617,8 @@ void jfs_flush_journal(struct jfs_log *log, int wait) | |||
1624 | } | 1617 | } |
1625 | } | 1618 | } |
1626 | assert(list_empty(&log->cqueue)); | 1619 | assert(list_empty(&log->cqueue)); |
1620 | |||
1621 | #ifdef CONFIG_JFS_DEBUG | ||
1627 | if (!list_empty(&log->synclist)) { | 1622 | if (!list_empty(&log->synclist)) { |
1628 | struct logsyncblk *lp; | 1623 | struct logsyncblk *lp; |
1629 | 1624 | ||
@@ -1638,9 +1633,8 @@ void jfs_flush_journal(struct jfs_log *log, int wait) | |||
1638 | dump_mem("orphan tblock", lp, | 1633 | dump_mem("orphan tblock", lp, |
1639 | sizeof(struct tblock)); | 1634 | sizeof(struct tblock)); |
1640 | } | 1635 | } |
1641 | // current->state = TASK_INTERRUPTIBLE; | ||
1642 | // schedule(); | ||
1643 | } | 1636 | } |
1637 | #endif | ||
1644 | //assert(list_empty(&log->synclist)); | 1638 | //assert(list_empty(&log->synclist)); |
1645 | clear_bit(log_FLUSH, &log->flag); | 1639 | clear_bit(log_FLUSH, &log->flag); |
1646 | } | 1640 | } |
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h index 51291fbc420c..747114cd38b8 100644 --- a/fs/jfs/jfs_logmgr.h +++ b/fs/jfs/jfs_logmgr.h | |||
@@ -507,6 +507,8 @@ extern int lmLogClose(struct super_block *sb); | |||
507 | extern int lmLogShutdown(struct jfs_log * log); | 507 | extern int lmLogShutdown(struct jfs_log * log); |
508 | extern int lmLogInit(struct jfs_log * log); | 508 | extern int lmLogInit(struct jfs_log * log); |
509 | extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); | 509 | extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); |
510 | extern int lmGroupCommit(struct jfs_log *, struct tblock *); | ||
511 | extern int jfsIOWait(void *); | ||
510 | extern void jfs_flush_journal(struct jfs_log * log, int wait); | 512 | extern void jfs_flush_journal(struct jfs_log * log, int wait); |
511 | extern void jfs_syncpt(struct jfs_log *log); | 513 | extern void jfs_syncpt(struct jfs_log *log); |
512 | 514 | ||
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 41bf078dce05..6c5485d16c39 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -198,7 +198,7 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags) | |||
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | static inline struct metapage *alloc_metapage(int gfp_mask) | 201 | static inline struct metapage *alloc_metapage(unsigned int gfp_mask) |
202 | { | 202 | { |
203 | return mempool_alloc(metapage_mempool, gfp_mask); | 203 | return mempool_alloc(metapage_mempool, gfp_mask); |
204 | } | 204 | } |
@@ -726,12 +726,12 @@ void force_metapage(struct metapage *mp) | |||
726 | page_cache_release(page); | 726 | page_cache_release(page); |
727 | } | 727 | } |
728 | 728 | ||
729 | extern void hold_metapage(struct metapage *mp) | 729 | void hold_metapage(struct metapage *mp) |
730 | { | 730 | { |
731 | lock_page(mp->page); | 731 | lock_page(mp->page); |
732 | } | 732 | } |
733 | 733 | ||
734 | extern void put_metapage(struct metapage *mp) | 734 | void put_metapage(struct metapage *mp) |
735 | { | 735 | { |
736 | if (mp->count || mp->nohomeok) { | 736 | if (mp->count || mp->nohomeok) { |
737 | /* Someone else will release this */ | 737 | /* Someone else will release this */ |
diff --git a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h index 991e9fb84c75..f0b7d3282b07 100644 --- a/fs/jfs/jfs_metapage.h +++ b/fs/jfs/jfs_metapage.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2002 | 2 | * Copyright (C) International Business Machines Corp., 2000-2002 |
3 | * Portions Copyright (c) Christoph Hellwig, 2001-2002 | 3 | * Portions Copyright (C) Christoph Hellwig, 2001-2002 |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -58,6 +58,8 @@ struct metapage { | |||
58 | #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag) | 58 | #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag) |
59 | 59 | ||
60 | /* function prototypes */ | 60 | /* function prototypes */ |
61 | extern int metapage_init(void); | ||
62 | extern void metapage_exit(void); | ||
61 | extern struct metapage *__get_metapage(struct inode *inode, | 63 | extern struct metapage *__get_metapage(struct inode *inode, |
62 | unsigned long lblock, unsigned int size, | 64 | unsigned long lblock, unsigned int size, |
63 | int absolute, unsigned long new); | 65 | int absolute, unsigned long new); |
diff --git a/fs/jfs/jfs_superblock.h b/fs/jfs/jfs_superblock.h index ab0566f70cfa..fcf781bf31cb 100644 --- a/fs/jfs/jfs_superblock.h +++ b/fs/jfs/jfs_superblock.h | |||
@@ -109,5 +109,16 @@ struct jfs_superblock { | |||
109 | extern int readSuper(struct super_block *, struct buffer_head **); | 109 | extern int readSuper(struct super_block *, struct buffer_head **); |
110 | extern int updateSuper(struct super_block *, uint); | 110 | extern int updateSuper(struct super_block *, uint); |
111 | extern void jfs_error(struct super_block *, const char *, ...); | 111 | extern void jfs_error(struct super_block *, const char *, ...); |
112 | extern int jfs_mount(struct super_block *); | ||
113 | extern int jfs_mount_rw(struct super_block *, int); | ||
114 | extern int jfs_umount(struct super_block *); | ||
115 | extern int jfs_umount_rw(struct super_block *); | ||
116 | |||
117 | extern int jfs_stop_threads; | ||
118 | extern struct completion jfsIOwait; | ||
119 | extern wait_queue_head_t jfs_IO_thread_wait; | ||
120 | extern wait_queue_head_t jfs_commit_thread_wait; | ||
121 | extern wait_queue_head_t jfs_sync_thread_wait; | ||
122 | extern int jfs_extendfs(struct super_block *, s64, int); | ||
112 | 123 | ||
113 | #endif /*_H_JFS_SUPERBLOCK */ | 124 | #endif /*_H_JFS_SUPERBLOCK */ |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index e93d01aa12c4..8cbaaff1d5fa 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * hold on to mp+lock thru update of maps | 42 | * hold on to mp+lock thru update of maps |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <linux/fs.h> | 45 | #include <linux/fs.h> |
47 | #include <linux/vmalloc.h> | 46 | #include <linux/vmalloc.h> |
48 | #include <linux/smp_lock.h> | 47 | #include <linux/smp_lock.h> |
@@ -51,6 +50,7 @@ | |||
51 | #include <linux/module.h> | 50 | #include <linux/module.h> |
52 | #include <linux/moduleparam.h> | 51 | #include <linux/moduleparam.h> |
53 | #include "jfs_incore.h" | 52 | #include "jfs_incore.h" |
53 | #include "jfs_inode.h" | ||
54 | #include "jfs_filsys.h" | 54 | #include "jfs_filsys.h" |
55 | #include "jfs_metapage.h" | 55 | #include "jfs_metapage.h" |
56 | #include "jfs_dinode.h" | 56 | #include "jfs_dinode.h" |
@@ -109,7 +109,6 @@ static int TxLockHWM; /* High water mark for number of txLocks used */ | |||
109 | static int TxLockVHWM; /* Very High water mark */ | 109 | static int TxLockVHWM; /* Very High water mark */ |
110 | struct tlock *TxLock; /* transaction lock table */ | 110 | struct tlock *TxLock; /* transaction lock table */ |
111 | 111 | ||
112 | |||
113 | /* | 112 | /* |
114 | * transaction management lock | 113 | * transaction management lock |
115 | */ | 114 | */ |
@@ -149,7 +148,6 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event) | |||
149 | 148 | ||
150 | #define TXN_WAKEUP(event) wake_up_all(event) | 149 | #define TXN_WAKEUP(event) wake_up_all(event) |
151 | 150 | ||
152 | |||
153 | /* | 151 | /* |
154 | * statistics | 152 | * statistics |
155 | */ | 153 | */ |
@@ -161,16 +159,6 @@ static struct { | |||
161 | int waitlock; /* 4: # of tlock wait */ | 159 | int waitlock; /* 4: # of tlock wait */ |
162 | } stattx; | 160 | } stattx; |
163 | 161 | ||
164 | |||
165 | /* | ||
166 | * external references | ||
167 | */ | ||
168 | extern int lmGroupCommit(struct jfs_log *, struct tblock *); | ||
169 | extern int jfs_commit_inode(struct inode *, int); | ||
170 | extern int jfs_stop_threads; | ||
171 | |||
172 | extern struct completion jfsIOwait; | ||
173 | |||
174 | /* | 162 | /* |
175 | * forward references | 163 | * forward references |
176 | */ | 164 | */ |
@@ -358,7 +346,6 @@ void txExit(void) | |||
358 | TxBlock = NULL; | 346 | TxBlock = NULL; |
359 | } | 347 | } |
360 | 348 | ||
361 | |||
362 | /* | 349 | /* |
363 | * NAME: txBegin() | 350 | * NAME: txBegin() |
364 | * | 351 | * |
@@ -460,7 +447,6 @@ tid_t txBegin(struct super_block *sb, int flag) | |||
460 | return t; | 447 | return t; |
461 | } | 448 | } |
462 | 449 | ||
463 | |||
464 | /* | 450 | /* |
465 | * NAME: txBeginAnon() | 451 | * NAME: txBeginAnon() |
466 | * | 452 | * |
@@ -503,7 +489,6 @@ void txBeginAnon(struct super_block *sb) | |||
503 | TXN_UNLOCK(); | 489 | TXN_UNLOCK(); |
504 | } | 490 | } |
505 | 491 | ||
506 | |||
507 | /* | 492 | /* |
508 | * txEnd() | 493 | * txEnd() |
509 | * | 494 | * |
@@ -592,7 +577,6 @@ wakeup: | |||
592 | TXN_WAKEUP(&TxAnchor.freewait); | 577 | TXN_WAKEUP(&TxAnchor.freewait); |
593 | } | 578 | } |
594 | 579 | ||
595 | |||
596 | /* | 580 | /* |
597 | * txLock() | 581 | * txLock() |
598 | * | 582 | * |
@@ -868,7 +852,6 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, | |||
868 | return NULL; | 852 | return NULL; |
869 | } | 853 | } |
870 | 854 | ||
871 | |||
872 | /* | 855 | /* |
873 | * NAME: txRelease() | 856 | * NAME: txRelease() |
874 | * | 857 | * |
@@ -908,7 +891,6 @@ static void txRelease(struct tblock * tblk) | |||
908 | TXN_UNLOCK(); | 891 | TXN_UNLOCK(); |
909 | } | 892 | } |
910 | 893 | ||
911 | |||
912 | /* | 894 | /* |
913 | * NAME: txUnlock() | 895 | * NAME: txUnlock() |
914 | * | 896 | * |
@@ -996,7 +978,6 @@ static void txUnlock(struct tblock * tblk) | |||
996 | } | 978 | } |
997 | } | 979 | } |
998 | 980 | ||
999 | |||
1000 | /* | 981 | /* |
1001 | * txMaplock() | 982 | * txMaplock() |
1002 | * | 983 | * |
@@ -1069,7 +1050,6 @@ struct tlock *txMaplock(tid_t tid, struct inode *ip, int type) | |||
1069 | return tlck; | 1050 | return tlck; |
1070 | } | 1051 | } |
1071 | 1052 | ||
1072 | |||
1073 | /* | 1053 | /* |
1074 | * txLinelock() | 1054 | * txLinelock() |
1075 | * | 1055 | * |
@@ -1103,8 +1083,6 @@ struct linelock *txLinelock(struct linelock * tlock) | |||
1103 | return linelock; | 1083 | return linelock; |
1104 | } | 1084 | } |
1105 | 1085 | ||
1106 | |||
1107 | |||
1108 | /* | 1086 | /* |
1109 | * transaction commit management | 1087 | * transaction commit management |
1110 | * ----------------------------- | 1088 | * ----------------------------- |
@@ -1373,7 +1351,6 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1373 | return rc; | 1351 | return rc; |
1374 | } | 1352 | } |
1375 | 1353 | ||
1376 | |||
1377 | /* | 1354 | /* |
1378 | * NAME: txLog() | 1355 | * NAME: txLog() |
1379 | * | 1356 | * |
@@ -1437,7 +1414,6 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd) | |||
1437 | return rc; | 1414 | return rc; |
1438 | } | 1415 | } |
1439 | 1416 | ||
1440 | |||
1441 | /* | 1417 | /* |
1442 | * diLog() | 1418 | * diLog() |
1443 | * | 1419 | * |
@@ -1465,7 +1441,6 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1465 | if (tlck->type & tlckENTRY) { | 1441 | if (tlck->type & tlckENTRY) { |
1466 | /* log after-image for logredo(): */ | 1442 | /* log after-image for logredo(): */ |
1467 | lrd->type = cpu_to_le16(LOG_REDOPAGE); | 1443 | lrd->type = cpu_to_le16(LOG_REDOPAGE); |
1468 | // *pxd = mp->cm_pxd; | ||
1469 | PXDaddress(pxd, mp->index); | 1444 | PXDaddress(pxd, mp->index); |
1470 | PXDlength(pxd, | 1445 | PXDlength(pxd, |
1471 | mp->logical_size >> tblk->sb->s_blocksize_bits); | 1446 | mp->logical_size >> tblk->sb->s_blocksize_bits); |
@@ -1552,7 +1527,6 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1552 | return rc; | 1527 | return rc; |
1553 | } | 1528 | } |
1554 | 1529 | ||
1555 | |||
1556 | /* | 1530 | /* |
1557 | * dataLog() | 1531 | * dataLog() |
1558 | * | 1532 | * |
@@ -1599,7 +1573,6 @@ static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1599 | return 0; | 1573 | return 0; |
1600 | } | 1574 | } |
1601 | 1575 | ||
1602 | |||
1603 | /* | 1576 | /* |
1604 | * dtLog() | 1577 | * dtLog() |
1605 | * | 1578 | * |
@@ -1639,7 +1612,6 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1639 | lrd->log.redopage.type |= cpu_to_le16(LOG_EXTEND); | 1612 | lrd->log.redopage.type |= cpu_to_le16(LOG_EXTEND); |
1640 | else | 1613 | else |
1641 | lrd->log.redopage.type |= cpu_to_le16(LOG_NEW); | 1614 | lrd->log.redopage.type |= cpu_to_le16(LOG_NEW); |
1642 | // *pxd = mp->cm_pxd; | ||
1643 | PXDaddress(pxd, mp->index); | 1615 | PXDaddress(pxd, mp->index); |
1644 | PXDlength(pxd, | 1616 | PXDlength(pxd, |
1645 | mp->logical_size >> tblk->sb->s_blocksize_bits); | 1617 | mp->logical_size >> tblk->sb->s_blocksize_bits); |
@@ -1704,7 +1676,6 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1704 | return; | 1676 | return; |
1705 | } | 1677 | } |
1706 | 1678 | ||
1707 | |||
1708 | /* | 1679 | /* |
1709 | * xtLog() | 1680 | * xtLog() |
1710 | * | 1681 | * |
@@ -1760,7 +1731,6 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1760 | * applying the after-image to the meta-data page. | 1731 | * applying the after-image to the meta-data page. |
1761 | */ | 1732 | */ |
1762 | lrd->type = cpu_to_le16(LOG_REDOPAGE); | 1733 | lrd->type = cpu_to_le16(LOG_REDOPAGE); |
1763 | // *page_pxd = mp->cm_pxd; | ||
1764 | PXDaddress(page_pxd, mp->index); | 1734 | PXDaddress(page_pxd, mp->index); |
1765 | PXDlength(page_pxd, | 1735 | PXDlength(page_pxd, |
1766 | mp->logical_size >> tblk->sb->s_blocksize_bits); | 1736 | mp->logical_size >> tblk->sb->s_blocksize_bits); |
@@ -2093,7 +2063,6 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
2093 | return; | 2063 | return; |
2094 | } | 2064 | } |
2095 | 2065 | ||
2096 | |||
2097 | /* | 2066 | /* |
2098 | * mapLog() | 2067 | * mapLog() |
2099 | * | 2068 | * |
@@ -2180,7 +2149,6 @@ void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
2180 | } | 2149 | } |
2181 | } | 2150 | } |
2182 | 2151 | ||
2183 | |||
2184 | /* | 2152 | /* |
2185 | * txEA() | 2153 | * txEA() |
2186 | * | 2154 | * |
@@ -2233,7 +2201,6 @@ void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea) | |||
2233 | } | 2201 | } |
2234 | } | 2202 | } |
2235 | 2203 | ||
2236 | |||
2237 | /* | 2204 | /* |
2238 | * txForce() | 2205 | * txForce() |
2239 | * | 2206 | * |
@@ -2300,7 +2267,6 @@ void txForce(struct tblock * tblk) | |||
2300 | } | 2267 | } |
2301 | } | 2268 | } |
2302 | 2269 | ||
2303 | |||
2304 | /* | 2270 | /* |
2305 | * txUpdateMap() | 2271 | * txUpdateMap() |
2306 | * | 2272 | * |
@@ -2437,7 +2403,6 @@ static void txUpdateMap(struct tblock * tblk) | |||
2437 | } | 2403 | } |
2438 | } | 2404 | } |
2439 | 2405 | ||
2440 | |||
2441 | /* | 2406 | /* |
2442 | * txAllocPMap() | 2407 | * txAllocPMap() |
2443 | * | 2408 | * |
@@ -2509,7 +2474,6 @@ static void txAllocPMap(struct inode *ip, struct maplock * maplock, | |||
2509 | } | 2474 | } |
2510 | } | 2475 | } |
2511 | 2476 | ||
2512 | |||
2513 | /* | 2477 | /* |
2514 | * txFreeMap() | 2478 | * txFreeMap() |
2515 | * | 2479 | * |
@@ -2611,7 +2575,6 @@ void txFreeMap(struct inode *ip, | |||
2611 | } | 2575 | } |
2612 | } | 2576 | } |
2613 | 2577 | ||
2614 | |||
2615 | /* | 2578 | /* |
2616 | * txFreelock() | 2579 | * txFreelock() |
2617 | * | 2580 | * |
@@ -2652,7 +2615,6 @@ void txFreelock(struct inode *ip) | |||
2652 | TXN_UNLOCK(); | 2615 | TXN_UNLOCK(); |
2653 | } | 2616 | } |
2654 | 2617 | ||
2655 | |||
2656 | /* | 2618 | /* |
2657 | * txAbort() | 2619 | * txAbort() |
2658 | * | 2620 | * |
diff --git a/fs/jfs/jfs_txnmgr.h b/fs/jfs/jfs_txnmgr.h index b71b82c2df04..59ad0f6b7231 100644 --- a/fs/jfs/jfs_txnmgr.h +++ b/fs/jfs/jfs_txnmgr.h | |||
@@ -285,34 +285,26 @@ struct commit { | |||
285 | /* | 285 | /* |
286 | * external declarations | 286 | * external declarations |
287 | */ | 287 | */ |
288 | extern struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage *mp, | 288 | extern int jfs_tlocks_low; |
289 | int flag); | 289 | |
290 | 290 | extern int txInit(void); | |
291 | extern struct tlock *txMaplock(tid_t tid, struct inode *ip, int flag); | 291 | extern void txExit(void); |
292 | 292 | extern struct tlock *txLock(tid_t, struct inode *, struct metapage *, int); | |
293 | extern int txCommit(tid_t tid, int nip, struct inode **iplist, int flag); | 293 | extern struct tlock *txMaplock(tid_t, struct inode *, int); |
294 | 294 | extern int txCommit(tid_t, int, struct inode **, int); | |
295 | extern tid_t txBegin(struct super_block *sb, int flag); | 295 | extern tid_t txBegin(struct super_block *, int); |
296 | 296 | extern void txBeginAnon(struct super_block *); | |
297 | extern void txBeginAnon(struct super_block *sb); | 297 | extern void txEnd(tid_t); |
298 | 298 | extern void txAbort(tid_t, int); | |
299 | extern void txEnd(tid_t tid); | 299 | extern struct linelock *txLinelock(struct linelock *); |
300 | 300 | extern void txFreeMap(struct inode *, struct maplock *, struct tblock *, int); | |
301 | extern void txAbort(tid_t tid, int dirty); | 301 | extern void txEA(tid_t, struct inode *, dxd_t *, dxd_t *); |
302 | 302 | extern void txFreelock(struct inode *); | |
303 | extern struct linelock *txLinelock(struct linelock * tlock); | 303 | extern int lmLog(struct jfs_log *, struct tblock *, struct lrd *, |
304 | 304 | struct tlock *); | |
305 | extern void txFreeMap(struct inode *ip, struct maplock * maplock, | 305 | extern void txQuiesce(struct super_block *); |
306 | struct tblock * tblk, int maptype); | 306 | extern void txResume(struct super_block *); |
307 | 307 | extern void txLazyUnlock(struct tblock *); | |
308 | extern void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea); | 308 | extern int jfs_lazycommit(void *); |
309 | 309 | extern int jfs_sync(void *); | |
310 | extern void txFreelock(struct inode *ip); | ||
311 | |||
312 | extern int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | ||
313 | struct tlock * tlck); | ||
314 | |||
315 | extern void txQuiesce(struct super_block *sb); | ||
316 | |||
317 | extern void txResume(struct super_block *sb); | ||
318 | #endif /* _H_JFS_TXNMGR */ | 310 | #endif /* _H_JFS_TXNMGR */ |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 8413a368f449..1cae14e741eb 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -31,20 +31,9 @@ | |||
31 | #include "jfs_acl.h" | 31 | #include "jfs_acl.h" |
32 | #include "jfs_debug.h" | 32 | #include "jfs_debug.h" |
33 | 33 | ||
34 | extern struct inode_operations jfs_file_inode_operations; | ||
35 | extern struct inode_operations jfs_symlink_inode_operations; | ||
36 | extern struct file_operations jfs_file_operations; | ||
37 | extern struct address_space_operations jfs_aops; | ||
38 | |||
39 | extern int jfs_fsync(struct file *, struct dentry *, int); | ||
40 | extern void jfs_truncate_nolock(struct inode *, loff_t); | ||
41 | extern int jfs_init_acl(struct inode *, struct inode *); | ||
42 | |||
43 | /* | 34 | /* |
44 | * forward references | 35 | * forward references |
45 | */ | 36 | */ |
46 | struct inode_operations jfs_dir_inode_operations; | ||
47 | struct file_operations jfs_dir_operations; | ||
48 | struct dentry_operations jfs_ci_dentry_operations; | 37 | struct dentry_operations jfs_ci_dentry_operations; |
49 | 38 | ||
50 | static s64 commitZeroLink(tid_t, struct inode *); | 39 | static s64 commitZeroLink(tid_t, struct inode *); |
@@ -655,7 +644,7 @@ static s64 commitZeroLink(tid_t tid, struct inode *ip) | |||
655 | 644 | ||
656 | 645 | ||
657 | /* | 646 | /* |
658 | * NAME: freeZeroLink() | 647 | * NAME: jfs_free_zero_link() |
659 | * | 648 | * |
660 | * FUNCTION: for non-directory, called by iClose(), | 649 | * FUNCTION: for non-directory, called by iClose(), |
661 | * free resources of a file from cache and WORKING map | 650 | * free resources of a file from cache and WORKING map |
@@ -663,15 +652,12 @@ static s64 commitZeroLink(tid_t tid, struct inode *ip) | |||
663 | * while associated with a pager object, | 652 | * while associated with a pager object, |
664 | * | 653 | * |
665 | * PARAMETER: ip - pointer to inode of file. | 654 | * PARAMETER: ip - pointer to inode of file. |
666 | * | ||
667 | * RETURN: 0 -ok | ||
668 | */ | 655 | */ |
669 | int freeZeroLink(struct inode *ip) | 656 | void jfs_free_zero_link(struct inode *ip) |
670 | { | 657 | { |
671 | int rc = 0; | ||
672 | int type; | 658 | int type; |
673 | 659 | ||
674 | jfs_info("freeZeroLink: ip = 0x%p", ip); | 660 | jfs_info("jfs_free_zero_link: ip = 0x%p", ip); |
675 | 661 | ||
676 | /* return if not reg or symbolic link or if size is | 662 | /* return if not reg or symbolic link or if size is |
677 | * already ok. | 663 | * already ok. |
@@ -684,10 +670,10 @@ int freeZeroLink(struct inode *ip) | |||
684 | case S_IFLNK: | 670 | case S_IFLNK: |
685 | /* if its contained in inode nothing to do */ | 671 | /* if its contained in inode nothing to do */ |
686 | if (ip->i_size < IDATASIZE) | 672 | if (ip->i_size < IDATASIZE) |
687 | return 0; | 673 | return; |
688 | break; | 674 | break; |
689 | default: | 675 | default: |
690 | return 0; | 676 | return; |
691 | } | 677 | } |
692 | 678 | ||
693 | /* | 679 | /* |
@@ -737,9 +723,7 @@ int freeZeroLink(struct inode *ip) | |||
737 | * free xtree/data blocks from working block map; | 723 | * free xtree/data blocks from working block map; |
738 | */ | 724 | */ |
739 | if (ip->i_size) | 725 | if (ip->i_size) |
740 | rc = xtTruncate(0, ip, 0, COMMIT_WMAP); | 726 | xtTruncate(0, ip, 0, COMMIT_WMAP); |
741 | |||
742 | return rc; | ||
743 | } | 727 | } |
744 | 728 | ||
745 | /* | 729 | /* |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 5e774ed7fb64..810a3653d8b3 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include "jfs_incore.h" | 29 | #include "jfs_incore.h" |
30 | #include "jfs_filsys.h" | 30 | #include "jfs_filsys.h" |
31 | #include "jfs_inode.h" | ||
31 | #include "jfs_metapage.h" | 32 | #include "jfs_metapage.h" |
32 | #include "jfs_superblock.h" | 33 | #include "jfs_superblock.h" |
33 | #include "jfs_dmap.h" | 34 | #include "jfs_dmap.h" |
@@ -62,37 +63,6 @@ module_param(jfsloglevel, int, 0644); | |||
62 | MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)"); | 63 | MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)"); |
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | /* | ||
66 | * External declarations | ||
67 | */ | ||
68 | extern int jfs_mount(struct super_block *); | ||
69 | extern int jfs_mount_rw(struct super_block *, int); | ||
70 | extern int jfs_umount(struct super_block *); | ||
71 | extern int jfs_umount_rw(struct super_block *); | ||
72 | |||
73 | extern int jfsIOWait(void *); | ||
74 | extern int jfs_lazycommit(void *); | ||
75 | extern int jfs_sync(void *); | ||
76 | |||
77 | extern void jfs_read_inode(struct inode *inode); | ||
78 | extern void jfs_dirty_inode(struct inode *inode); | ||
79 | extern void jfs_delete_inode(struct inode *inode); | ||
80 | extern int jfs_write_inode(struct inode *inode, int wait); | ||
81 | |||
82 | extern struct dentry *jfs_get_parent(struct dentry *dentry); | ||
83 | extern int jfs_extendfs(struct super_block *, s64, int); | ||
84 | |||
85 | extern struct dentry_operations jfs_ci_dentry_operations; | ||
86 | |||
87 | #ifdef PROC_FS_JFS /* see jfs_debug.h */ | ||
88 | extern void jfs_proc_init(void); | ||
89 | extern void jfs_proc_clean(void); | ||
90 | #endif | ||
91 | |||
92 | extern wait_queue_head_t jfs_IO_thread_wait; | ||
93 | extern wait_queue_head_t jfs_commit_thread_wait; | ||
94 | extern wait_queue_head_t jfs_sync_thread_wait; | ||
95 | |||
96 | static void jfs_handle_error(struct super_block *sb) | 66 | static void jfs_handle_error(struct super_block *sb) |
97 | { | 67 | { |
98 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 68 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
@@ -593,11 +563,6 @@ static struct file_system_type jfs_fs_type = { | |||
593 | .fs_flags = FS_REQUIRES_DEV, | 563 | .fs_flags = FS_REQUIRES_DEV, |
594 | }; | 564 | }; |
595 | 565 | ||
596 | extern int metapage_init(void); | ||
597 | extern int txInit(void); | ||
598 | extern void txExit(void); | ||
599 | extern void metapage_exit(void); | ||
600 | |||
601 | static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) | 566 | static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) |
602 | { | 567 | { |
603 | struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; | 568 | struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; |
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c index ef4c07ee92b2..287d8d6c3cfd 100644 --- a/fs/jfs/symlink.c +++ b/fs/jfs/symlink.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Christoph Hellwig, 2001-2002 | 2 | * Copyright (C) Christoph Hellwig, 2001-2002 |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/namei.h> | 20 | #include <linux/namei.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_xattr.h" | 23 | #include "jfs_xattr.h" |
23 | 24 | ||
24 | static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 25 | static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 7a9ffd5d03dc..6016373701a3 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -946,8 +946,7 @@ int __jfs_setxattr(struct inode *inode, const char *name, const void *value, | |||
946 | out: | 946 | out: |
947 | up_write(&JFS_IP(inode)->xattr_sem); | 947 | up_write(&JFS_IP(inode)->xattr_sem); |
948 | 948 | ||
949 | if (os2name) | 949 | kfree(os2name); |
950 | kfree(os2name); | ||
951 | 950 | ||
952 | return rc; | 951 | return rc; |
953 | } | 952 | } |
@@ -1042,8 +1041,7 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, | |||
1042 | out: | 1041 | out: |
1043 | up_read(&JFS_IP(inode)->xattr_sem); | 1042 | up_read(&JFS_IP(inode)->xattr_sem); |
1044 | 1043 | ||
1045 | if (os2name) | 1044 | kfree(os2name); |
1046 | kfree(os2name); | ||
1047 | 1045 | ||
1048 | return size; | 1046 | return size; |
1049 | } | 1047 | } |
diff --git a/fs/libfs.c b/fs/libfs.c index f90b29595927..5025563e7379 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -519,6 +519,102 @@ int simple_transaction_release(struct inode *inode, struct file *file) | |||
519 | return 0; | 519 | return 0; |
520 | } | 520 | } |
521 | 521 | ||
522 | /* Simple attribute files */ | ||
523 | |||
524 | struct simple_attr { | ||
525 | u64 (*get)(void *); | ||
526 | void (*set)(void *, u64); | ||
527 | char get_buf[24]; /* enough to store a u64 and "\n\0" */ | ||
528 | char set_buf[24]; | ||
529 | void *data; | ||
530 | const char *fmt; /* format for read operation */ | ||
531 | struct semaphore sem; /* protects access to these buffers */ | ||
532 | }; | ||
533 | |||
534 | /* simple_attr_open is called by an actual attribute open file operation | ||
535 | * to set the attribute specific access operations. */ | ||
536 | int simple_attr_open(struct inode *inode, struct file *file, | ||
537 | u64 (*get)(void *), void (*set)(void *, u64), | ||
538 | const char *fmt) | ||
539 | { | ||
540 | struct simple_attr *attr; | ||
541 | |||
542 | attr = kmalloc(sizeof(*attr), GFP_KERNEL); | ||
543 | if (!attr) | ||
544 | return -ENOMEM; | ||
545 | |||
546 | attr->get = get; | ||
547 | attr->set = set; | ||
548 | attr->data = inode->u.generic_ip; | ||
549 | attr->fmt = fmt; | ||
550 | init_MUTEX(&attr->sem); | ||
551 | |||
552 | file->private_data = attr; | ||
553 | |||
554 | return nonseekable_open(inode, file); | ||
555 | } | ||
556 | |||
557 | int simple_attr_close(struct inode *inode, struct file *file) | ||
558 | { | ||
559 | kfree(file->private_data); | ||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | /* read from the buffer that is filled with the get function */ | ||
564 | ssize_t simple_attr_read(struct file *file, char __user *buf, | ||
565 | size_t len, loff_t *ppos) | ||
566 | { | ||
567 | struct simple_attr *attr; | ||
568 | size_t size; | ||
569 | ssize_t ret; | ||
570 | |||
571 | attr = file->private_data; | ||
572 | |||
573 | if (!attr->get) | ||
574 | return -EACCES; | ||
575 | |||
576 | down(&attr->sem); | ||
577 | if (*ppos) /* continued read */ | ||
578 | size = strlen(attr->get_buf); | ||
579 | else /* first read */ | ||
580 | size = scnprintf(attr->get_buf, sizeof(attr->get_buf), | ||
581 | attr->fmt, | ||
582 | (unsigned long long)attr->get(attr->data)); | ||
583 | |||
584 | ret = simple_read_from_buffer(buf, len, ppos, attr->get_buf, size); | ||
585 | up(&attr->sem); | ||
586 | return ret; | ||
587 | } | ||
588 | |||
589 | /* interpret the buffer as a number to call the set function with */ | ||
590 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | ||
591 | size_t len, loff_t *ppos) | ||
592 | { | ||
593 | struct simple_attr *attr; | ||
594 | u64 val; | ||
595 | size_t size; | ||
596 | ssize_t ret; | ||
597 | |||
598 | attr = file->private_data; | ||
599 | |||
600 | if (!attr->set) | ||
601 | return -EACCES; | ||
602 | |||
603 | down(&attr->sem); | ||
604 | ret = -EFAULT; | ||
605 | size = min(sizeof(attr->set_buf) - 1, len); | ||
606 | if (copy_from_user(attr->set_buf, buf, size)) | ||
607 | goto out; | ||
608 | |||
609 | ret = len; /* claim we got the whole input */ | ||
610 | attr->set_buf[size] = '\0'; | ||
611 | val = simple_strtol(attr->set_buf, NULL, 0); | ||
612 | attr->set(attr->data, val); | ||
613 | out: | ||
614 | up(&attr->sem); | ||
615 | return ret; | ||
616 | } | ||
617 | |||
522 | EXPORT_SYMBOL(dcache_dir_close); | 618 | EXPORT_SYMBOL(dcache_dir_close); |
523 | EXPORT_SYMBOL(dcache_dir_lseek); | 619 | EXPORT_SYMBOL(dcache_dir_lseek); |
524 | EXPORT_SYMBOL(dcache_dir_open); | 620 | EXPORT_SYMBOL(dcache_dir_open); |
@@ -547,3 +643,7 @@ EXPORT_SYMBOL(simple_read_from_buffer); | |||
547 | EXPORT_SYMBOL(simple_transaction_get); | 643 | EXPORT_SYMBOL(simple_transaction_get); |
548 | EXPORT_SYMBOL(simple_transaction_read); | 644 | EXPORT_SYMBOL(simple_transaction_read); |
549 | EXPORT_SYMBOL(simple_transaction_release); | 645 | EXPORT_SYMBOL(simple_transaction_release); |
646 | EXPORT_SYMBOL_GPL(simple_attr_open); | ||
647 | EXPORT_SYMBOL_GPL(simple_attr_close); | ||
648 | EXPORT_SYMBOL_GPL(simple_attr_read); | ||
649 | EXPORT_SYMBOL_GPL(simple_attr_write); | ||
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index d4aaa88d0214..78899eeab974 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -25,7 +25,7 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) | |||
25 | struct kobject * kobj = to_kobj(dentry->d_parent); | 25 | struct kobject * kobj = to_kobj(dentry->d_parent); |
26 | 26 | ||
27 | if (!attr->read) | 27 | if (!attr->read) |
28 | return -EINVAL; | 28 | return -EIO; |
29 | 29 | ||
30 | return attr->read(kobj, buffer, off, count); | 30 | return attr->read(kobj, buffer, off, count); |
31 | } | 31 | } |
@@ -71,7 +71,7 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) | |||
71 | struct kobject *kobj = to_kobj(dentry->d_parent); | 71 | struct kobject *kobj = to_kobj(dentry->d_parent); |
72 | 72 | ||
73 | if (!attr->write) | 73 | if (!attr->write) |
74 | return -EINVAL; | 74 | return -EIO; |
75 | 75 | ||
76 | return attr->write(kobj, buffer, offset, count); | 76 | return attr->write(kobj, buffer, offset, count); |
77 | } | 77 | } |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index fe198210bc2d..37d7a6875d86 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -101,18 +101,19 @@ static int create_dir(struct kobject * k, struct dentry * p, | |||
101 | down(&p->d_inode->i_sem); | 101 | down(&p->d_inode->i_sem); |
102 | *d = sysfs_get_dentry(p,n); | 102 | *d = sysfs_get_dentry(p,n); |
103 | if (!IS_ERR(*d)) { | 103 | if (!IS_ERR(*d)) { |
104 | error = sysfs_create(*d, mode, init_dir); | 104 | error = sysfs_make_dirent(p->d_fsdata, *d, k, mode, SYSFS_DIR); |
105 | if (!error) { | 105 | if (!error) { |
106 | error = sysfs_make_dirent(p->d_fsdata, *d, k, mode, | 106 | error = sysfs_create(*d, mode, init_dir); |
107 | SYSFS_DIR); | ||
108 | if (!error) { | 107 | if (!error) { |
109 | p->d_inode->i_nlink++; | 108 | p->d_inode->i_nlink++; |
110 | (*d)->d_op = &sysfs_dentry_ops; | 109 | (*d)->d_op = &sysfs_dentry_ops; |
111 | d_rehash(*d); | 110 | d_rehash(*d); |
112 | } | 111 | } |
113 | } | 112 | } |
114 | if (error && (error != -EEXIST)) | 113 | if (error && (error != -EEXIST)) { |
114 | sysfs_put((*d)->d_fsdata); | ||
115 | d_drop(*d); | 115 | d_drop(*d); |
116 | } | ||
116 | dput(*d); | 117 | dput(*d); |
117 | } else | 118 | } else |
118 | error = PTR_ERR(*d); | 119 | error = PTR_ERR(*d); |
@@ -171,17 +172,19 @@ static int sysfs_attach_attr(struct sysfs_dirent * sd, struct dentry * dentry) | |||
171 | init = init_file; | 172 | init = init_file; |
172 | } | 173 | } |
173 | 174 | ||
175 | dentry->d_fsdata = sysfs_get(sd); | ||
176 | sd->s_dentry = dentry; | ||
174 | error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init); | 177 | error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init); |
175 | if (error) | 178 | if (error) { |
179 | sysfs_put(sd); | ||
176 | return error; | 180 | return error; |
181 | } | ||
177 | 182 | ||
178 | if (bin_attr) { | 183 | if (bin_attr) { |
179 | dentry->d_inode->i_size = bin_attr->size; | 184 | dentry->d_inode->i_size = bin_attr->size; |
180 | dentry->d_inode->i_fop = &bin_fops; | 185 | dentry->d_inode->i_fop = &bin_fops; |
181 | } | 186 | } |
182 | dentry->d_op = &sysfs_dentry_ops; | 187 | dentry->d_op = &sysfs_dentry_ops; |
183 | dentry->d_fsdata = sysfs_get(sd); | ||
184 | sd->s_dentry = dentry; | ||
185 | d_rehash(dentry); | 188 | d_rehash(dentry); |
186 | 189 | ||
187 | return 0; | 190 | return 0; |
@@ -191,13 +194,15 @@ static int sysfs_attach_link(struct sysfs_dirent * sd, struct dentry * dentry) | |||
191 | { | 194 | { |
192 | int err = 0; | 195 | int err = 0; |
193 | 196 | ||
197 | dentry->d_fsdata = sysfs_get(sd); | ||
198 | sd->s_dentry = dentry; | ||
194 | err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink); | 199 | err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink); |
195 | if (!err) { | 200 | if (!err) { |
196 | dentry->d_op = &sysfs_dentry_ops; | 201 | dentry->d_op = &sysfs_dentry_ops; |
197 | dentry->d_fsdata = sysfs_get(sd); | ||
198 | sd->s_dentry = dentry; | ||
199 | d_rehash(dentry); | 202 | d_rehash(dentry); |
200 | } | 203 | } else |
204 | sysfs_put(sd); | ||
205 | |||
201 | return err; | 206 | return err; |
202 | } | 207 | } |
203 | 208 | ||
@@ -228,6 +233,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
228 | 233 | ||
229 | struct inode_operations sysfs_dir_inode_operations = { | 234 | struct inode_operations sysfs_dir_inode_operations = { |
230 | .lookup = sysfs_lookup, | 235 | .lookup = sysfs_lookup, |
236 | .setattr = sysfs_setattr, | ||
231 | }; | 237 | }; |
232 | 238 | ||
233 | static void remove_dir(struct dentry * d) | 239 | static void remove_dir(struct dentry * d) |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 364208071e17..849aac115460 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -23,7 +23,7 @@ subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page) | |||
23 | { | 23 | { |
24 | struct subsystem * s = to_subsys(kobj); | 24 | struct subsystem * s = to_subsys(kobj); |
25 | struct subsys_attribute * sattr = to_sattr(attr); | 25 | struct subsys_attribute * sattr = to_sattr(attr); |
26 | ssize_t ret = 0; | 26 | ssize_t ret = -EIO; |
27 | 27 | ||
28 | if (sattr->show) | 28 | if (sattr->show) |
29 | ret = sattr->show(s,page); | 29 | ret = sattr->show(s,page); |
@@ -36,7 +36,7 @@ subsys_attr_store(struct kobject * kobj, struct attribute * attr, | |||
36 | { | 36 | { |
37 | struct subsystem * s = to_subsys(kobj); | 37 | struct subsystem * s = to_subsys(kobj); |
38 | struct subsys_attribute * sattr = to_sattr(attr); | 38 | struct subsys_attribute * sattr = to_sattr(attr); |
39 | ssize_t ret = 0; | 39 | ssize_t ret = -EIO; |
40 | 40 | ||
41 | if (sattr->store) | 41 | if (sattr->store) |
42 | ret = sattr->store(s,page,count); | 42 | ret = sattr->store(s,page,count); |
@@ -182,7 +182,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t | |||
182 | return -ENOMEM; | 182 | return -ENOMEM; |
183 | 183 | ||
184 | if (count >= PAGE_SIZE) | 184 | if (count >= PAGE_SIZE) |
185 | count = PAGE_SIZE - 1; | 185 | count = PAGE_SIZE; |
186 | error = copy_from_user(buffer->page,buf,count); | 186 | error = copy_from_user(buffer->page,buf,count); |
187 | buffer->needs_read_fill = 1; | 187 | buffer->needs_read_fill = 1; |
188 | return error ? -EFAULT : count; | 188 | return error ? -EFAULT : count; |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index aff7b2dfa8ee..565cac1d4200 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -26,18 +26,107 @@ static struct backing_dev_info sysfs_backing_dev_info = { | |||
26 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, | 26 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | struct inode * sysfs_new_inode(mode_t mode) | 29 | static struct inode_operations sysfs_inode_operations ={ |
30 | .setattr = sysfs_setattr, | ||
31 | }; | ||
32 | |||
33 | int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) | ||
34 | { | ||
35 | struct inode * inode = dentry->d_inode; | ||
36 | struct sysfs_dirent * sd = dentry->d_fsdata; | ||
37 | struct iattr * sd_iattr; | ||
38 | unsigned int ia_valid = iattr->ia_valid; | ||
39 | int error; | ||
40 | |||
41 | if (!sd) | ||
42 | return -EINVAL; | ||
43 | |||
44 | sd_iattr = sd->s_iattr; | ||
45 | |||
46 | error = inode_change_ok(inode, iattr); | ||
47 | if (error) | ||
48 | return error; | ||
49 | |||
50 | error = inode_setattr(inode, iattr); | ||
51 | if (error) | ||
52 | return error; | ||
53 | |||
54 | if (!sd_iattr) { | ||
55 | /* setting attributes for the first time, allocate now */ | ||
56 | sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL); | ||
57 | if (!sd_iattr) | ||
58 | return -ENOMEM; | ||
59 | /* assign default attributes */ | ||
60 | memset(sd_iattr, 0, sizeof(struct iattr)); | ||
61 | sd_iattr->ia_mode = sd->s_mode; | ||
62 | sd_iattr->ia_uid = 0; | ||
63 | sd_iattr->ia_gid = 0; | ||
64 | sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime = CURRENT_TIME; | ||
65 | sd->s_iattr = sd_iattr; | ||
66 | } | ||
67 | |||
68 | /* attributes were changed atleast once in past */ | ||
69 | |||
70 | if (ia_valid & ATTR_UID) | ||
71 | sd_iattr->ia_uid = iattr->ia_uid; | ||
72 | if (ia_valid & ATTR_GID) | ||
73 | sd_iattr->ia_gid = iattr->ia_gid; | ||
74 | if (ia_valid & ATTR_ATIME) | ||
75 | sd_iattr->ia_atime = timespec_trunc(iattr->ia_atime, | ||
76 | inode->i_sb->s_time_gran); | ||
77 | if (ia_valid & ATTR_MTIME) | ||
78 | sd_iattr->ia_mtime = timespec_trunc(iattr->ia_mtime, | ||
79 | inode->i_sb->s_time_gran); | ||
80 | if (ia_valid & ATTR_CTIME) | ||
81 | sd_iattr->ia_ctime = timespec_trunc(iattr->ia_ctime, | ||
82 | inode->i_sb->s_time_gran); | ||
83 | if (ia_valid & ATTR_MODE) { | ||
84 | umode_t mode = iattr->ia_mode; | ||
85 | |||
86 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) | ||
87 | mode &= ~S_ISGID; | ||
88 | sd_iattr->ia_mode = mode; | ||
89 | } | ||
90 | |||
91 | return error; | ||
92 | } | ||
93 | |||
94 | static inline void set_default_inode_attr(struct inode * inode, mode_t mode) | ||
95 | { | ||
96 | inode->i_mode = mode; | ||
97 | inode->i_uid = 0; | ||
98 | inode->i_gid = 0; | ||
99 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
100 | } | ||
101 | |||
102 | static inline void set_inode_attr(struct inode * inode, struct iattr * iattr) | ||
103 | { | ||
104 | inode->i_mode = iattr->ia_mode; | ||
105 | inode->i_uid = iattr->ia_uid; | ||
106 | inode->i_gid = iattr->ia_gid; | ||
107 | inode->i_atime = iattr->ia_atime; | ||
108 | inode->i_mtime = iattr->ia_mtime; | ||
109 | inode->i_ctime = iattr->ia_ctime; | ||
110 | } | ||
111 | |||
112 | struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd) | ||
30 | { | 113 | { |
31 | struct inode * inode = new_inode(sysfs_sb); | 114 | struct inode * inode = new_inode(sysfs_sb); |
32 | if (inode) { | 115 | if (inode) { |
33 | inode->i_mode = mode; | ||
34 | inode->i_uid = 0; | ||
35 | inode->i_gid = 0; | ||
36 | inode->i_blksize = PAGE_CACHE_SIZE; | 116 | inode->i_blksize = PAGE_CACHE_SIZE; |
37 | inode->i_blocks = 0; | 117 | inode->i_blocks = 0; |
38 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
39 | inode->i_mapping->a_ops = &sysfs_aops; | 118 | inode->i_mapping->a_ops = &sysfs_aops; |
40 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; | 119 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; |
120 | inode->i_op = &sysfs_inode_operations; | ||
121 | |||
122 | if (sd->s_iattr) { | ||
123 | /* sysfs_dirent has non-default attributes | ||
124 | * get them for the new inode from persistent copy | ||
125 | * in sysfs_dirent | ||
126 | */ | ||
127 | set_inode_attr(inode, sd->s_iattr); | ||
128 | } else | ||
129 | set_default_inode_attr(inode, mode); | ||
41 | } | 130 | } |
42 | return inode; | 131 | return inode; |
43 | } | 132 | } |
@@ -48,7 +137,8 @@ int sysfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *)) | |||
48 | struct inode * inode = NULL; | 137 | struct inode * inode = NULL; |
49 | if (dentry) { | 138 | if (dentry) { |
50 | if (!dentry->d_inode) { | 139 | if (!dentry->d_inode) { |
51 | if ((inode = sysfs_new_inode(mode))) { | 140 | struct sysfs_dirent * sd = dentry->d_fsdata; |
141 | if ((inode = sysfs_new_inode(mode, sd))) { | ||
52 | if (dentry->d_parent && dentry->d_parent->d_inode) { | 142 | if (dentry->d_parent && dentry->d_parent->d_inode) { |
53 | struct inode *p_inode = dentry->d_parent->d_inode; | 143 | struct inode *p_inode = dentry->d_parent->d_inode; |
54 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; | 144 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 5c805bb1a4b7..f1117e885bd6 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -28,6 +28,7 @@ static struct sysfs_dirent sysfs_root = { | |||
28 | .s_children = LIST_HEAD_INIT(sysfs_root.s_children), | 28 | .s_children = LIST_HEAD_INIT(sysfs_root.s_children), |
29 | .s_element = NULL, | 29 | .s_element = NULL, |
30 | .s_type = SYSFS_ROOT, | 30 | .s_type = SYSFS_ROOT, |
31 | .s_iattr = NULL, | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | 34 | static int sysfs_fill_super(struct super_block *sb, void *data, int silent) |
@@ -42,7 +43,8 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | |||
42 | sb->s_time_gran = 1; | 43 | sb->s_time_gran = 1; |
43 | sysfs_sb = sb; | 44 | sysfs_sb = sb; |
44 | 45 | ||
45 | inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO); | 46 | inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, |
47 | &sysfs_root); | ||
46 | if (inode) { | 48 | if (inode) { |
47 | inode->i_op = &sysfs_dir_inode_operations; | 49 | inode->i_op = &sysfs_dir_inode_operations; |
48 | inode->i_fop = &sysfs_dir_operations; | 50 | inode->i_fop = &sysfs_dir_operations; |
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index dfdf70174354..fae57c83a722 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -43,7 +43,7 @@ static void fill_object_path(struct kobject * kobj, char * buffer, int length) | |||
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | static int sysfs_add_link(struct dentry * parent, char * name, struct kobject * target) | 46 | static int sysfs_add_link(struct dentry * parent, const char * name, struct kobject * target) |
47 | { | 47 | { |
48 | struct sysfs_dirent * parent_sd = parent->d_fsdata; | 48 | struct sysfs_dirent * parent_sd = parent->d_fsdata; |
49 | struct sysfs_symlink * sl; | 49 | struct sysfs_symlink * sl; |
@@ -79,7 +79,7 @@ exit1: | |||
79 | * @target: object we're pointing to. | 79 | * @target: object we're pointing to. |
80 | * @name: name of the symlink. | 80 | * @name: name of the symlink. |
81 | */ | 81 | */ |
82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name) | 82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) |
83 | { | 83 | { |
84 | struct dentry * dentry = kobj->dentry; | 84 | struct dentry * dentry = kobj->dentry; |
85 | int error = 0; | 85 | int error = 0; |
@@ -99,13 +99,13 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * nam | |||
99 | * @name: name of the symlink to remove. | 99 | * @name: name of the symlink to remove. |
100 | */ | 100 | */ |
101 | 101 | ||
102 | void sysfs_remove_link(struct kobject * kobj, char * name) | 102 | void sysfs_remove_link(struct kobject * kobj, const char * name) |
103 | { | 103 | { |
104 | sysfs_hash_and_remove(kobj->dentry,name); | 104 | sysfs_hash_and_remove(kobj->dentry,name); |
105 | } | 105 | } |
106 | 106 | ||
107 | static int sysfs_get_target_path(struct kobject * kobj, struct kobject * target, | 107 | static int sysfs_get_target_path(struct kobject * kobj, struct kobject * target, |
108 | char *path) | 108 | char *path) |
109 | { | 109 | { |
110 | char * s; | 110 | char * s; |
111 | int depth, size; | 111 | int depth, size; |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index a8a24a0c0b3b..29da6f5f07c8 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -2,7 +2,7 @@ | |||
2 | extern struct vfsmount * sysfs_mount; | 2 | extern struct vfsmount * sysfs_mount; |
3 | extern kmem_cache_t *sysfs_dir_cachep; | 3 | extern kmem_cache_t *sysfs_dir_cachep; |
4 | 4 | ||
5 | extern struct inode * sysfs_new_inode(mode_t mode); | 5 | extern struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent *); |
6 | extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); | 6 | extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); |
7 | 7 | ||
8 | extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *, | 8 | extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *, |
@@ -17,6 +17,7 @@ extern void sysfs_remove_subdir(struct dentry *); | |||
17 | 17 | ||
18 | extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); | 18 | extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); |
19 | extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); | 19 | extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); |
20 | extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); | ||
20 | 21 | ||
21 | extern struct rw_semaphore sysfs_rename_sem; | 22 | extern struct rw_semaphore sysfs_rename_sem; |
22 | extern struct super_block * sysfs_sb; | 23 | extern struct super_block * sysfs_sb; |
@@ -75,6 +76,7 @@ static inline void release_sysfs_dirent(struct sysfs_dirent * sd) | |||
75 | kobject_put(sl->target_kobj); | 76 | kobject_put(sl->target_kobj); |
76 | kfree(sl); | 77 | kfree(sl); |
77 | } | 78 | } |
79 | kfree(sd->s_iattr); | ||
78 | kmem_cache_free(sysfs_dir_cachep, sd); | 80 | kmem_cache_free(sysfs_dir_cachep, sd); |
79 | } | 81 | } |
80 | 82 | ||