From 44db77f33cc42c49f55ddb360f5e9a05581ffdc0 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sat, 14 Jan 2006 13:21:12 -0800 Subject: [PATCH] [PATCH] ncpfs: remove kmalloc wrapper Remove remaining kmalloc wrapper bits from fs/ncpfs/. Signed-off-by: Pekka Enberg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/ncpfs/inode.c | 19 ++----------------- fs/ncpfs/ioctl.c | 20 +++++++++++--------- 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 8c88392..d277a58 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c @@ -716,10 +716,8 @@ static void ncp_put_super(struct super_block *sb) fput(server->ncp_filp); kill_proc(server->m.wdog_pid, SIGTERM, 1); - if (server->priv.data) - ncp_kfree_s(server->priv.data, server->priv.len); - if (server->auth.object_name) - ncp_kfree_s(server->auth.object_name, server->auth.object_name_len); + kfree(server->priv.data); + kfree(server->auth.object_name); vfree(server->packet); sb->s_fs_info = NULL; kfree(server); @@ -958,11 +956,6 @@ out: return result; } -#ifdef DEBUG_NCP_MALLOC -int ncp_malloced; -int ncp_current_malloced; -#endif - static struct super_block *ncp_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { @@ -981,10 +974,6 @@ static int __init init_ncp_fs(void) int err; DPRINTK("ncpfs: init_module called\n"); -#ifdef DEBUG_NCP_MALLOC - ncp_malloced = 0; - ncp_current_malloced = 0; -#endif err = init_inodecache(); if (err) goto out1; @@ -1003,10 +992,6 @@ static void __exit exit_ncp_fs(void) DPRINTK("ncpfs: cleanup_module called\n"); unregister_filesystem(&ncp_fs_type); destroy_inodecache(); -#ifdef DEBUG_NCP_MALLOC - PRINTK("ncp_malloced: %d\n", ncp_malloced); - PRINTK("ncp_current_malloced: %d\n", ncp_current_malloced); -#endif } module_init(init_ncp_fs) diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index d6e0c08..eb3813a 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c @@ -518,10 +518,11 @@ outrel: if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) return -ENOMEM; if (user.object_name_len) { - newname = ncp_kmalloc(user.object_name_len, GFP_USER); - if (!newname) return -ENOMEM; + newname = kmalloc(user.object_name_len, GFP_USER); + if (!newname) + return -ENOMEM; if (copy_from_user(newname, user.object_name, user.object_name_len)) { - ncp_kfree_s(newname, user.object_name_len); + kfree(newname); return -EFAULT; } } else { @@ -540,8 +541,8 @@ outrel: server->priv.len = 0; server->priv.data = NULL; /* leave critical section */ - if (oldprivate) ncp_kfree_s(oldprivate, oldprivatelen); - if (oldname) ncp_kfree_s(oldname, oldnamelen); + kfree(oldprivate); + kfree(oldname); return 0; } case NCP_IOC_GETPRIVATEDATA: @@ -581,10 +582,11 @@ outrel: if (user.len > NCP_PRIVATE_DATA_MAX_LEN) return -ENOMEM; if (user.len) { - new = ncp_kmalloc(user.len, GFP_USER); - if (!new) return -ENOMEM; + new = kmalloc(user.len, GFP_USER); + if (!new) + return -ENOMEM; if (copy_from_user(new, user.data, user.len)) { - ncp_kfree_s(new, user.len); + kfree(new); return -EFAULT; } } else { @@ -596,7 +598,7 @@ outrel: server->priv.len = user.len; server->priv.data = new; /* leave critical section */ - if (old) ncp_kfree_s(old, oldlen); + kfree(old); return 0; } diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 7297e43..e013425 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) return container_of(inode, struct ncp_inode_info, vfs_inode); } -#ifdef DEBUG_NCP_MALLOC - -#include - -extern int ncp_malloced; -extern int ncp_current_malloced; - -static inline void * - ncp_kmalloc(unsigned int size, int priority) -{ - ncp_malloced += 1; - ncp_current_malloced += 1; - return kmalloc(size, priority); -} - -static inline void ncp_kfree_s(void *obj, int size) -{ - ncp_current_malloced -= 1; - kfree(obj); -} - -#else /* DEBUG_NCP_MALLOC */ - -#define ncp_kmalloc(s,p) kmalloc(s,p) -#define ncp_kfree_s(o,s) kfree(o) - -#endif /* DEBUG_NCP_MALLOC */ - /* linux/fs/ncpfs/inode.c */ int ncp_notify_change(struct dentry *, struct iattr *); struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); -- 2.7.4