diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2006-01-14 16:21:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 21:27:12 -0500 |
commit | 44db77f33cc42c49f55ddb360f5e9a05581ffdc0 (patch) | |
tree | dff20b34e2c022ea7527ee7223b6d2268f384a6d | |
parent | 69c99ac17e2ee0eb45e2c9873e6e12d73260fc6b (diff) |
[PATCH] ncpfs: remove kmalloc wrapper
Remove remaining kmalloc wrapper bits from fs/ncpfs/.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/ncpfs/inode.c | 19 | ||||
-rw-r--r-- | fs/ncpfs/ioctl.c | 20 | ||||
-rw-r--r-- | include/linux/ncp_fs.h | 28 |
3 files changed, 13 insertions, 54 deletions
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 8c8839203cd5..d277a58bd128 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -716,10 +716,8 @@ static void ncp_put_super(struct super_block *sb) | |||
716 | fput(server->ncp_filp); | 716 | fput(server->ncp_filp); |
717 | kill_proc(server->m.wdog_pid, SIGTERM, 1); | 717 | kill_proc(server->m.wdog_pid, SIGTERM, 1); |
718 | 718 | ||
719 | if (server->priv.data) | 719 | kfree(server->priv.data); |
720 | ncp_kfree_s(server->priv.data, server->priv.len); | 720 | kfree(server->auth.object_name); |
721 | if (server->auth.object_name) | ||
722 | ncp_kfree_s(server->auth.object_name, server->auth.object_name_len); | ||
723 | vfree(server->packet); | 721 | vfree(server->packet); |
724 | sb->s_fs_info = NULL; | 722 | sb->s_fs_info = NULL; |
725 | kfree(server); | 723 | kfree(server); |
@@ -958,11 +956,6 @@ out: | |||
958 | return result; | 956 | return result; |
959 | } | 957 | } |
960 | 958 | ||
961 | #ifdef DEBUG_NCP_MALLOC | ||
962 | int ncp_malloced; | ||
963 | int ncp_current_malloced; | ||
964 | #endif | ||
965 | |||
966 | static struct super_block *ncp_get_sb(struct file_system_type *fs_type, | 959 | static struct super_block *ncp_get_sb(struct file_system_type *fs_type, |
967 | int flags, const char *dev_name, void *data) | 960 | int flags, const char *dev_name, void *data) |
968 | { | 961 | { |
@@ -981,10 +974,6 @@ static int __init init_ncp_fs(void) | |||
981 | int err; | 974 | int err; |
982 | DPRINTK("ncpfs: init_module called\n"); | 975 | DPRINTK("ncpfs: init_module called\n"); |
983 | 976 | ||
984 | #ifdef DEBUG_NCP_MALLOC | ||
985 | ncp_malloced = 0; | ||
986 | ncp_current_malloced = 0; | ||
987 | #endif | ||
988 | err = init_inodecache(); | 977 | err = init_inodecache(); |
989 | if (err) | 978 | if (err) |
990 | goto out1; | 979 | goto out1; |
@@ -1003,10 +992,6 @@ static void __exit exit_ncp_fs(void) | |||
1003 | DPRINTK("ncpfs: cleanup_module called\n"); | 992 | DPRINTK("ncpfs: cleanup_module called\n"); |
1004 | unregister_filesystem(&ncp_fs_type); | 993 | unregister_filesystem(&ncp_fs_type); |
1005 | destroy_inodecache(); | 994 | destroy_inodecache(); |
1006 | #ifdef DEBUG_NCP_MALLOC | ||
1007 | PRINTK("ncp_malloced: %d\n", ncp_malloced); | ||
1008 | PRINTK("ncp_current_malloced: %d\n", ncp_current_malloced); | ||
1009 | #endif | ||
1010 | } | 995 | } |
1011 | 996 | ||
1012 | module_init(init_ncp_fs) | 997 | module_init(init_ncp_fs) |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index d6e0c089e1b1..eb3813ad136f 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -518,10 +518,11 @@ outrel: | |||
518 | if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) | 518 | if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) |
519 | return -ENOMEM; | 519 | return -ENOMEM; |
520 | if (user.object_name_len) { | 520 | if (user.object_name_len) { |
521 | newname = ncp_kmalloc(user.object_name_len, GFP_USER); | 521 | newname = kmalloc(user.object_name_len, GFP_USER); |
522 | if (!newname) return -ENOMEM; | 522 | if (!newname) |
523 | return -ENOMEM; | ||
523 | if (copy_from_user(newname, user.object_name, user.object_name_len)) { | 524 | if (copy_from_user(newname, user.object_name, user.object_name_len)) { |
524 | ncp_kfree_s(newname, user.object_name_len); | 525 | kfree(newname); |
525 | return -EFAULT; | 526 | return -EFAULT; |
526 | } | 527 | } |
527 | } else { | 528 | } else { |
@@ -540,8 +541,8 @@ outrel: | |||
540 | server->priv.len = 0; | 541 | server->priv.len = 0; |
541 | server->priv.data = NULL; | 542 | server->priv.data = NULL; |
542 | /* leave critical section */ | 543 | /* leave critical section */ |
543 | if (oldprivate) ncp_kfree_s(oldprivate, oldprivatelen); | 544 | kfree(oldprivate); |
544 | if (oldname) ncp_kfree_s(oldname, oldnamelen); | 545 | kfree(oldname); |
545 | return 0; | 546 | return 0; |
546 | } | 547 | } |
547 | case NCP_IOC_GETPRIVATEDATA: | 548 | case NCP_IOC_GETPRIVATEDATA: |
@@ -581,10 +582,11 @@ outrel: | |||
581 | if (user.len > NCP_PRIVATE_DATA_MAX_LEN) | 582 | if (user.len > NCP_PRIVATE_DATA_MAX_LEN) |
582 | return -ENOMEM; | 583 | return -ENOMEM; |
583 | if (user.len) { | 584 | if (user.len) { |
584 | new = ncp_kmalloc(user.len, GFP_USER); | 585 | new = kmalloc(user.len, GFP_USER); |
585 | if (!new) return -ENOMEM; | 586 | if (!new) |
587 | return -ENOMEM; | ||
586 | if (copy_from_user(new, user.data, user.len)) { | 588 | if (copy_from_user(new, user.data, user.len)) { |
587 | ncp_kfree_s(new, user.len); | 589 | kfree(new); |
588 | return -EFAULT; | 590 | return -EFAULT; |
589 | } | 591 | } |
590 | } else { | 592 | } else { |
@@ -596,7 +598,7 @@ outrel: | |||
596 | server->priv.len = user.len; | 598 | server->priv.len = user.len; |
597 | server->priv.data = new; | 599 | server->priv.data = new; |
598 | /* leave critical section */ | 600 | /* leave critical section */ |
599 | if (old) ncp_kfree_s(old, oldlen); | 601 | kfree(old); |
600 | return 0; | 602 | return 0; |
601 | } | 603 | } |
602 | 604 | ||
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 7297e4372c0f..e01342568530 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h | |||
@@ -201,34 +201,6 @@ static inline struct ncp_inode_info *NCP_FINFO(struct inode *inode) | |||
201 | return container_of(inode, struct ncp_inode_info, vfs_inode); | 201 | return container_of(inode, struct ncp_inode_info, vfs_inode); |
202 | } | 202 | } |
203 | 203 | ||
204 | #ifdef DEBUG_NCP_MALLOC | ||
205 | |||
206 | #include <linux/slab.h> | ||
207 | |||
208 | extern int ncp_malloced; | ||
209 | extern int ncp_current_malloced; | ||
210 | |||
211 | static inline void * | ||
212 | ncp_kmalloc(unsigned int size, int priority) | ||
213 | { | ||
214 | ncp_malloced += 1; | ||
215 | ncp_current_malloced += 1; | ||
216 | return kmalloc(size, priority); | ||
217 | } | ||
218 | |||
219 | static inline void ncp_kfree_s(void *obj, int size) | ||
220 | { | ||
221 | ncp_current_malloced -= 1; | ||
222 | kfree(obj); | ||
223 | } | ||
224 | |||
225 | #else /* DEBUG_NCP_MALLOC */ | ||
226 | |||
227 | #define ncp_kmalloc(s,p) kmalloc(s,p) | ||
228 | #define ncp_kfree_s(o,s) kfree(o) | ||
229 | |||
230 | #endif /* DEBUG_NCP_MALLOC */ | ||
231 | |||
232 | /* linux/fs/ncpfs/inode.c */ | 204 | /* linux/fs/ncpfs/inode.c */ |
233 | int ncp_notify_change(struct dentry *, struct iattr *); | 205 | int ncp_notify_change(struct dentry *, struct iattr *); |
234 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); | 206 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); |