Skip to content

Commit

Permalink
[PATCH] ncpfs: remove kmalloc wrapper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pekka Enberg authored and Linus Torvalds committed Jan 15, 2006
1 parent 69c99ac commit 44db77f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 54 deletions.
19 changes: 2 additions & 17 deletions fs/ncpfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -958,11 +956,6 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
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)
{
Expand All @@ -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;
Expand All @@ -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)
Expand Down
20 changes: 11 additions & 9 deletions fs/ncpfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,11 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
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 {
Expand All @@ -540,8 +541,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
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:
Expand Down Expand Up @@ -581,10 +582,11 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
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 {
Expand All @@ -596,7 +598,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
server->priv.len = user.len;
server->priv.data = new;
/* leave critical section */
if (old) ncp_kfree_s(old, oldlen);
kfree(old);
return 0;
}

Expand Down
28 changes: 0 additions & 28 deletions include/linux/ncp_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <linux/slab.h>

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 *);
Expand Down

0 comments on commit 44db77f

Please sign in to comment.