Skip to content

Commit

Permalink
ncpfs: convert DPRINTK/DDPRINTK to ncp_dbg
Browse files Browse the repository at this point in the history
Use a more current logging style and enable use of dynamic debugging.

Remove embedded function names, dynamic debug can add this instead.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Joe Perches authored and Linus Torvalds committed Apr 8, 2014
1 parent b41f8b8 commit d3b73ca
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 83 deletions.
46 changes: 21 additions & 25 deletions fs/ncpfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
if (val)
goto finished;

DDPRINTK("ncp_lookup_validate: %pd2 not valid, age=%ld, server lookup\n",
ncp_dbg(2, "%pd2 not valid, age=%ld, server lookup\n",
dentry, NCP_GET_AGE(dentry));

len = sizeof(__name);
Expand All @@ -358,7 +358,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
finfo.volume = finfo.i.volNumber;
DDPRINTK("ncp_lookup_validate: looked for %pd/%s, res=%d\n",
ncp_dbg(2, "looked for %pd/%s, res=%d\n",
dentry->d_parent, __name, res);
/*
* If we didn't find it, or if it has a different dirEntNum to
Expand All @@ -372,14 +372,14 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
ncp_new_dentry(dentry);
val=1;
} else
DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
ncp_dbg(2, "found, but dirEntNum changed\n");

ncp_update_inode2(inode, &finfo);
mutex_unlock(&inode->i_mutex);
}

finished:
DDPRINTK("ncp_lookup_validate: result=%d\n", val);
ncp_dbg(2, "result=%d\n", val);
dput(parent);
return val;
}
Expand Down Expand Up @@ -453,8 +453,7 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx)
ctl.page = NULL;
ctl.cache = NULL;

DDPRINTK("ncp_readdir: reading %pD2, pos=%d\n", file,
(int) ctx->pos);
ncp_dbg(2, "reading %pD2, pos=%d\n", file, (int)ctx->pos);

result = -EIO;
/* Do not generate '.' and '..' when server is dead. */
Expand Down Expand Up @@ -697,8 +696,7 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
struct ncp_entry_info entry;
int i;

DPRINTK("ncp_read_volume_list: pos=%ld\n",
(unsigned long) ctx->pos);
ncp_dbg(1, "pos=%ld\n", (unsigned long)ctx->pos);

for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
int inval_dentry;
Expand All @@ -708,12 +706,11 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
if (!strlen(info.volume_name))
continue;

DPRINTK("ncp_read_volume_list: found vol: %s\n",
info.volume_name);
ncp_dbg(1, "found vol: %s\n", info.volume_name);

if (ncp_lookup_volume(server, info.volume_name,
&entry.i)) {
DPRINTK("ncpfs: could not lookup vol %s\n",
ncp_dbg(1, "could not lookup vol %s\n",
info.volume_name);
continue;
}
Expand All @@ -738,14 +735,13 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx,
int more;
size_t bufsize;

DPRINTK("ncp_do_readdir: %pD2, fpos=%ld\n", file,
(unsigned long) ctx->pos);
ncp_dbg(1, "%pD2, fpos=%ld\n", file, (unsigned long)ctx->pos);
PPRINTK("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n",
file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);

err = ncp_initialize_search(server, dir, &seq);
if (err) {
DPRINTK("ncp_do_readdir: init failed, err=%d\n", err);
ncp_dbg(1, "init failed, err=%d\n", err);
return;
}
/* We MUST NOT use server->buffer_size handshaked with server if we are
Expand Down Expand Up @@ -822,10 +818,10 @@ int ncp_conn_logged_in(struct super_block *sb)
NCP_FINFO(ino)->DosDirNum = DosDirNum;
result = 0;
} else {
DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n");
ncp_dbg(1, "sb->s_root->d_inode == NULL!\n");
}
} else {
DPRINTK("ncpfs: sb->s_root == NULL!\n");
ncp_dbg(1, "sb->s_root == NULL!\n");
}
} else
result = 0;
Expand Down Expand Up @@ -952,7 +948,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
error = -ENAMETOOLONG;
else if (result < 0)
error = result;
DPRINTK("ncp_create: %pd2 failed\n", dentry);
ncp_dbg(1, "%pd2 failed\n", dentry);
goto out;
}
opmode = O_WRONLY;
Expand Down Expand Up @@ -985,7 +981,7 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
int error, len;
__u8 __name[NCP_MAXPATHLEN + 1];

DPRINTK("ncp_mkdir: making %pd2\n", dentry);
ncp_dbg(1, "making %pd2\n", dentry);

ncp_age_dentry(server, dentry);
len = sizeof(__name);
Expand Down Expand Up @@ -1022,7 +1018,7 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
int error, result, len;
__u8 __name[NCP_MAXPATHLEN + 1];

DPRINTK("ncp_rmdir: removing %pd2\n", dentry);
ncp_dbg(1, "removing %pd2\n", dentry);

len = sizeof(__name);
error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
Expand Down Expand Up @@ -1067,7 +1063,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
int error;

server = NCP_SERVER(dir);
DPRINTK("ncp_unlink: unlinking %pd2\n", dentry);
ncp_dbg(1, "unlinking %pd2\n", dentry);

/*
* Check whether to close the file ...
Expand All @@ -1087,7 +1083,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
#endif
switch (error) {
case 0x00:
DPRINTK("ncp: removed %pd2\n", dentry);
ncp_dbg(1, "removed %pd2\n", dentry);
break;
case 0x85:
case 0x8A:
Expand Down Expand Up @@ -1120,7 +1116,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
int old_len, new_len;
__u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];

DPRINTK("ncp_rename: %pd2 to %pd2\n", old_dentry, new_dentry);
ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry);

ncp_age_dentry(server, old_dentry);
ncp_age_dentry(server, new_dentry);
Expand Down Expand Up @@ -1150,8 +1146,8 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
#endif
switch (error) {
case 0x00:
DPRINTK("ncp renamed %pd -> %pd.\n",
old_dentry, new_dentry);
ncp_dbg(1, "renamed %pd -> %pd\n",
old_dentry, new_dentry);
break;
case 0x9E:
error = -ENAMETOOLONG;
Expand All @@ -1173,7 +1169,7 @@ static int ncp_mknod(struct inode * dir, struct dentry *dentry,
if (!new_valid_dev(rdev))
return -EINVAL;
if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) {
DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%ho\n", mode);
ncp_dbg(1, "mode = 0%ho\n", mode);
return ncp_create_new(dir, dentry, mode, rdev, 0);
}
return -EPERM; /* Strange, but true */
Expand Down
16 changes: 8 additions & 8 deletions fs/ncpfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int ncp_make_open(struct inode *inode, int right)
goto out;
}

DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
ncp_dbg(1, "opened=%d, volume # %u, dir entry # %u\n",
atomic_read(&NCP_FINFO(inode)->opened),
NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
Expand Down Expand Up @@ -109,7 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
void* freepage;
size_t freelen;

DPRINTK("ncp_file_read: enter %pd2\n", dentry);
ncp_dbg(1, "enter %pd2\n", dentry);

pos = *ppos;

Expand All @@ -126,7 +126,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

error = ncp_make_open(inode, O_RDONLY);
if (error) {
DPRINTK(KERN_ERR "ncp_file_read: open failed, error=%d\n", error);
ncp_dbg(1, "open failed, error=%d\n", error);
return error;
}

Expand Down Expand Up @@ -167,7 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

file_accessed(file);

DPRINTK("ncp_file_read: exit %pd2\n", dentry);
ncp_dbg(1, "exit %pd2\n", dentry);
outrel:
ncp_inode_close(inode);
return already_read ? already_read : error;
Expand All @@ -184,7 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
int errno;
void* bouncebuffer;

DPRINTK("ncp_file_write: enter %pd2\n", dentry);
ncp_dbg(1, "enter %pd2\n", dentry);
if ((ssize_t) count < 0)
return -EINVAL;
pos = *ppos;
Expand Down Expand Up @@ -213,7 +213,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
return 0;
errno = ncp_make_open(inode, O_WRONLY);
if (errno) {
DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
ncp_dbg(1, "open failed, error=%d\n", errno);
return errno;
}
bufsize = NCP_SERVER(inode)->buffer_size;
Expand Down Expand Up @@ -263,15 +263,15 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
i_size_write(inode, pos);
mutex_unlock(&inode->i_mutex);
}
DPRINTK("ncp_file_write: exit %pd2\n", dentry);
ncp_dbg(1, "exit %pd2\n", dentry);
outrel:
ncp_inode_close(inode);
return already_written ? already_written : errno;
}

static int ncp_release(struct inode *inode, struct file *file) {
if (ncp_make_closed(inode)) {
DPRINTK("ncp_release: failed to close\n");
ncp_dbg(1, "failed to close\n");
}
return 0;
}
Expand Down
22 changes: 10 additions & 12 deletions fs/ncpfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,15 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
NCP_FINFO(inode)->access = nwinfo->access;
memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
sizeof(nwinfo->file_handle));
DPRINTK("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
ncp_dbg(1, "updated %s, volnum=%d, dirent=%u\n",
nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
}

static void ncp_update_dates(struct inode *inode, struct nw_info_struct *nwi)
{
/* NFS namespace mode overrides others if it's set. */
DPRINTK(KERN_DEBUG "ncp_update_dates_and_mode: (%s) nfs.mode=0%o\n",
nwi->entryName, nwi->nfs.mode);
ncp_dbg(1, "(%s) nfs.mode=0%o\n", nwi->entryName, nwi->nfs.mode);
if (nwi->nfs.mode) {
/* XXX Security? */
inode->i_mode = nwi->nfs.mode;
Expand Down Expand Up @@ -232,7 +231,7 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)

ncp_update_attrs(inode, nwinfo);

DDPRINTK("ncp_read_inode: inode->i_mode = %u\n", inode->i_mode);
ncp_dbg(2, "inode->i_mode = %u\n", inode->i_mode);

set_nlink(inode, 1);
inode->i_uid = server->m.uid;
Expand Down Expand Up @@ -303,7 +302,7 @@ ncp_evict_inode(struct inode *inode)
clear_inode(inode);

if (S_ISDIR(inode->i_mode)) {
DDPRINTK("ncp_evict_inode: put directory %ld\n", inode->i_ino);
ncp_dbg(2, "put directory %ld\n", inode->i_ino);
}

if (ncp_make_closed(inode) != 0) {
Expand Down Expand Up @@ -684,7 +683,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
ncp_unlock_server(server);
if (error < 0)
goto out_rxbuf;
DPRINTK("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
ncp_dbg(1, "NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));

error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */
#ifdef CONFIG_NCPFS_PACKET_SIGNING
Expand Down Expand Up @@ -712,7 +711,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
if (ncp_negotiate_buffersize(server, default_bufsize,
&(server->buffer_size)) != 0)
goto out_disconnect;
DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size);
ncp_dbg(1, "bufsize = %d\n", server->buffer_size);

memset(&finfo, 0, sizeof(finfo));
finfo.i.attributes = aDIR;
Expand Down Expand Up @@ -741,7 +740,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
root_inode = ncp_iget(sb, &finfo);
if (!root_inode)
goto out_disconnect;
DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
ncp_dbg(1, "root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
sb->s_root = d_make_root(root_inode);
if (!sb->s_root)
goto out_disconnect;
Expand Down Expand Up @@ -987,8 +986,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
if ((attr->ia_valid & ATTR_SIZE) != 0) {
int written;

DPRINTK("ncpfs: trying to change size to %ld\n",
attr->ia_size);
ncp_dbg(1, "trying to change size to %ld\n", attr->ia_size);

if ((result = ncp_make_open(inode, O_WRONLY)) < 0) {
result = -EACCES;
Expand Down Expand Up @@ -1074,7 +1072,7 @@ MODULE_ALIAS_FS("ncpfs");
static int __init init_ncp_fs(void)
{
int err;
DPRINTK("ncpfs: init_ncp_fs called\n");
ncp_dbg(1, "called\n");

err = init_inodecache();
if (err)
Expand All @@ -1091,7 +1089,7 @@ static int __init init_ncp_fs(void)

static void __exit exit_ncp_fs(void)
{
DPRINTK("ncpfs: exit_ncp_fs called\n");
ncp_dbg(1, "called\n");
unregister_filesystem(&ncp_fs_type);
destroy_inodecache();
}
Expand Down
Loading

0 comments on commit d3b73ca

Please sign in to comment.