2007-06-08 22:28:37

by Jack Stone

[permalink] [raw]
Subject: [PATCH 0/7] Cleanup code to replace DPRINTK with pr_debug

This patch series replaces DPRINTK with pr_debug in alternative.c,
autofs, autofs4
and ncpfs. A new function called pr_err is also added to keep
functionality in
ncpfs. The last 2 patches add support for pr_debug_pid and apply it to
autofs4 to
keep the output the same as the current DPRINTK statements.

All patches have been compile tested but not boot tested

--


2007-06-08 22:25:17

by Jack Stone

[permalink] [raw]
Subject: [PATCH 5/7] Replace DPRINTK with pr_debug in ncpfs

Signed-off-by: Jack Stone <[email protected]>
---
- DDPRINTK("ncp_lookup_validate: %s/%s not valid, age=%ld, server lookup\n",
+ pr_debug("ncp_lookup_validate: %s/%s not valid, age=%ld, server lookup\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
NCP_GET_AGE(dentry));

@@ -313,7 +313,7 @@ __ncp_lookup_validate(struct dentry * de
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
finfo.volume = finfo.i.volNumber;
- DDPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n",
+ pr_debug("ncp_lookup_validate: looked for %s/%s, res=%d\n",
dentry->d_parent->d_name.name, __name, res);
/*
* If we didn't find it, or if it has a different dirEntNum to
@@ -324,13 +324,13 @@ __ncp_lookup_validate(struct dentry * de
ncp_new_dentry(dentry);
val=1;
} else
- DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
+ pr_debug("ncp_lookup_validate: found, but dirEntNum changed\n");

ncp_update_inode2(dentry->d_inode, &finfo);
}

finished:
- DDPRINTK("ncp_lookup_validate: result=%d\n", val);
+ pr_debug("ncp_lookup_validate: result=%d\n", val);
dput(parent);
return val;
}
@@ -416,7 +416,7 @@ static int ncp_readdir(struct file *filp
ctl.page = NULL;
ctl.cache = NULL;

- DDPRINTK("ncp_readdir: reading %s/%s, pos=%d\n",
+ pr_debug("ncp_readdir: reading %s/%s, pos=%d\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
(int) filp->f_pos);

@@ -656,7 +656,7 @@ ncp_read_volume_list(struct file *filp,
struct ncp_entry_info entry;
int i;

- DPRINTK("ncp_read_volume_list: pos=%ld\n",
+ pr_debug("ncp_read_volume_list: pos=%ld\n",
(unsigned long) filp->f_pos);

for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
@@ -666,12 +666,12 @@ ncp_read_volume_list(struct file *filp,
if (!strlen(info.volume_name))
continue;

- DPRINTK("ncp_read_volume_list: found vol: %s\n",
+ pr_debug("ncp_read_volume_list: 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",
+ pr_debug("ncpfs: could not lookup vol %s\n",
info.volume_name);
continue;
}
@@ -695,7 +695,7 @@ ncp_do_readdir(struct file *filp, void *
int more;
size_t bufsize;

- DPRINTK("ncp_do_readdir: %s/%s, fpos=%ld\n",
+ pr_debug("ncp_do_readdir: %s/%s, fpos=%ld\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
(unsigned long) filp->f_pos);
PPRINTK("ncp_do_readdir: init %s, volnum=%d, dirent=%u\n",
@@ -704,7 +704,7 @@ ncp_do_readdir(struct file *filp, void *

err = ncp_initialize_search(server, dir, &seq);
if (err) {
- DPRINTK("ncp_do_readdir: init failed, err=%d\n", err);
+ pr_debug("ncp_do_readdir: init failed, err=%d\n", err);
return;
}
/* We MUST NOT use server->buffer_size handshaked with server if we are
@@ -779,10 +779,10 @@ int ncp_conn_logged_in(struct super_bloc
NCP_FINFO(ino)->dirEntNum = dirEntNum;
NCP_FINFO(ino)->DosDirNum = DosDirNum;
} else {
- DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n");
+ pr_debug("ncpfs: sb->s_root->d_inode == NULL!\n");
}
} else {
- DPRINTK("ncpfs: sb->s_root == NULL!\n");
+ pr_debug("ncpfs: sb->s_root == NULL!\n");
}
}
result = 0;
@@ -917,7 +917,7 @@ int ncp_create_new(struct inode *dir, st
if (result) {
if (result == 0x87)
error = -ENAMETOOLONG;
- DPRINTK("ncp_create: %s/%s failed\n",
+ pr_debug("ncp_create: %s/%s failed\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
goto out;
}
@@ -952,7 +952,7 @@ static int ncp_mkdir(struct inode *dir,
int error, len;
__u8 __name[NCP_MAXPATHLEN + 1];

- DPRINTK("ncp_mkdir: making %s/%s\n",
+ pr_debug("ncp_mkdir: making %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

error = -EIO;
@@ -995,7 +995,7 @@ static int ncp_rmdir(struct inode *dir,
int error, result, len;
__u8 __name[NCP_MAXPATHLEN + 1];

- DPRINTK("ncp_rmdir: removing %s/%s\n",
+ pr_debug("ncp_rmdir: removing %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

error = -EIO;
@@ -1052,7 +1052,7 @@ static int ncp_unlink(struct inode *dir,

lock_kernel();
server = NCP_SERVER(dir);
- DPRINTK("ncp_unlink: unlinking %s/%s\n",
+ pr_debug("ncp_unlink: unlinking %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

error = -EIO;
@@ -1077,7 +1077,7 @@ static int ncp_unlink(struct inode *dir,
#endif
switch (error) {
case 0x00:
- DPRINTK("ncp: removed %s/%s\n",
+ pr_debug("ncp: removed %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
break;
case 0x85:
@@ -1114,7 +1114,7 @@ static int ncp_rename(struct inode *old_
int old_len, new_len;
__u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];

- DPRINTK("ncp_rename: %s/%s to %s/%s\n",
+ pr_debug("ncp_rename: %s/%s to %s/%s\n",
old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
new_dentry->d_parent->d_name.name, new_dentry->d_name.name);

@@ -1151,7 +1151,7 @@ static int ncp_rename(struct inode *old_
#endif
switch (error) {
case 0x00:
- DPRINTK("ncp renamed %s -> %s.\n",
+ pr_debug("ncp renamed %s -> %s.\n",

old_dentry->d_name.name,new_dentry->d_name.name);
break;
case 0x9E:
@@ -1175,7 +1175,7 @@ static int ncp_mknod(struct inode * dir,
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%o\n", mode);
+ pr_debug(KERN_DEBUG "ncp_mknod: mode = 0%o\n", mode);
return ncp_create_new(dir, dentry, mode, rdev, 0);
}
return -EPERM; /* Strange, but true */
Index: linux/fs/ncpfs/file.c
===================================================================
--- linux.orig/fs/ncpfs/file.c
+++ linux/fs/ncpfs/file.c
@@ -41,7 +41,7 @@ int ncp_make_open(struct inode *inode, i
goto out;
}

- DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
+ pr_debug("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
atomic_read(&NCP_FINFO(inode)->opened),
NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
@@ -110,7 +110,7 @@ ncp_file_read(struct file *file, char __
void* freepage;
size_t freelen;

- DPRINTK("ncp_file_read: enter %s/%s\n",
+ pr_debug("ncp_file_read: enter %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

if (!ncp_conn_valid(NCP_SERVER(inode)))
@@ -131,7 +131,7 @@ ncp_file_read(struct file *file, char __

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

@@ -172,7 +172,7 @@ ncp_file_read(struct file *file, char __

file_accessed(file);

- DPRINTK("ncp_file_read: exit %s/%s\n",
+ pr_debug("ncp_file_read: exit %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
outrel:
ncp_inode_close(inode);
@@ -190,7 +190,7 @@ ncp_file_write(struct file *file, const
int errno;
void* bouncebuffer;

- DPRINTK("ncp_file_write: enter %s/%s\n",
+ pr_debug("ncp_file_write: enter %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
if (!ncp_conn_valid(NCP_SERVER(inode)))
return -EIO;
@@ -224,7 +224,7 @@ ncp_file_write(struct file *file, const
return 0;
errno = ncp_make_open(inode, O_WRONLY);
if (errno) {
- DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
+ pr_err("ncp_file_write: open failed, error=%d\n", errno);
return errno;
}
bufsize = NCP_SERVER(inode)->buffer_size;
@@ -269,7 +269,7 @@ ncp_file_write(struct file *file, const
if (pos > inode->i_size) {
inode->i_size = pos;
}
- DPRINTK("ncp_file_write: exit %s/%s\n",
+ pr_debug("ncp_file_write: exit %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
outrel:
ncp_inode_close(inode);
@@ -278,7 +278,7 @@ outrel:

static int ncp_release(struct inode *inode, struct file *file) {
if (ncp_make_closed(inode)) {
- DPRINTK("ncp_release: failed to close\n");
+ pr_debug("ncp_release: failed to close\n");
}
return 0;
}
Index: linux/fs/ncpfs/inode.c
===================================================================
--- linux.orig/fs/ncpfs/inode.c
+++ linux/fs/ncpfs/inode.c
@@ -121,7 +121,7 @@ void ncp_update_inode(struct inode *inod
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",
+ pr_debug("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
}
@@ -129,7 +129,7 @@ void ncp_update_inode(struct inode *inod
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",
+ pr_debug("ncp_update_dates_and_mode: (%s) nfs.mode=0%o\n",
nwi->entryName, nwi->nfs.mode);
if (nwi->nfs.mode) {
/* XXX Security? */
@@ -215,7 +215,7 @@ static void ncp_set_attr(struct inode *i

ncp_update_attrs(inode, nwinfo);

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

inode->i_nlink = 1;
inode->i_uid = server->m.uid;
@@ -284,7 +284,7 @@ ncp_delete_inode(struct inode *inode)
truncate_inode_pages(&inode->i_data, 0);

if (S_ISDIR(inode->i_mode)) {
- DDPRINTK("ncp_delete_inode: put directory %ld\n", inode->i_ino);
+ pr_debug("ncp_delete_inode: put directory %ld\n", inode->i_ino);
}

if (ncp_make_closed(inode) != 0) {
@@ -601,7 +601,7 @@ static int ncp_fill_super(struct super_b
ncp_unlock_server(server);
if (error < 0)
goto out_rxbuf;
- DPRINTK("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
+ pr_debug("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));

error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */
#ifdef CONFIG_NCPFS_PACKET_SIGNING
@@ -627,7 +627,7 @@ static int ncp_fill_super(struct super_b
if (ncp_negotiate_buffersize(server, default_bufsize,
&(server->buffer_size)) != 0)
goto out_disconnect;
- DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size);
+ pr_debug("ncpfs: bufsize = %d\n", server->buffer_size);

memset(&finfo, 0, sizeof(finfo));
finfo.i.attributes = aDIR;
@@ -656,7 +656,7 @@ static int ncp_fill_super(struct super_b
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);
+ pr_debug("ncp_fill_super: root vol=%d\n",
NCP_FINFO(root_inode)->volNumber);
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root)
goto out_no_root;
@@ -900,7 +900,7 @@ int ncp_notify_change(struct dentry *den
if ((attr->ia_valid & ATTR_SIZE) != 0) {
int written;

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

if ((result = ncp_make_open(inode, O_WRONLY)) < 0) {
@@ -987,7 +987,7 @@ static struct file_system_type ncp_fs_ty
static int __init init_ncp_fs(void)
{
int err;
- DPRINTK("ncpfs: init_module called\n");
+ pr_debug("ncpfs: init_module called\n");

err = init_inodecache();
if (err)
@@ -1004,7 +1004,7 @@ out1:

static void __exit exit_ncp_fs(void)
{
- DPRINTK("ncpfs: cleanup_module called\n");
+ pr_debug("ncpfs: cleanup_module called\n");
unregister_filesystem(&ncp_fs_type);
destroy_inodecache();
}
Index: linux/fs/ncpfs/ioctl.c
===================================================================
--- linux.orig/fs/ncpfs/ioctl.c
+++ linux/fs/ncpfs/ioctl.c
@@ -18,6 +18,7 @@
#include <linux/smp_lock.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
+#include <linux/kernel.h>

#include <linux/ncp_fs.h>

@@ -47,7 +48,7 @@ ncp_get_fs_info(struct ncp_server * serv
return -EFAULT;

if (info.version != NCP_GET_FS_INFO_VERSION) {
- DPRINTK("info.version invalid: %d\n", info.version);
+ pr_debug("info.version invalid: %d\n", info.version);
return -EINVAL;
}
/* TODO: info.addr = server->m.serv_addr; */
@@ -77,7 +78,7 @@ ncp_get_fs_info_v2(struct ncp_server * s
return -EFAULT;

if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
- DPRINTK("info.version invalid: %d\n", info2.version);
+ pr_debug("info.version invalid: %d\n", info2.version);
return -EINVAL;
}
info2.mounted_uid = server->m.mounted_uid;
@@ -148,7 +149,7 @@ ncp_get_compat_fs_info_v2(struct ncp_ser
return -EFAULT;

if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
- DPRINTK("info.version invalid: %d\n", info2.version);
+ pr_debug("info.version invalid: %d\n", info2.version);
return -EINVAL;
}
info2.mounted_uid = server->m.mounted_uid;
@@ -320,7 +321,7 @@ int ncp_ioctl(struct inode *inode, struc
else
result = server->reply_size;
ncp_unlock_server(server);
- DPRINTK("ncp_ioctl: copy %d bytes\n",
+ pr_debug("ncp_ioctl: copy %d bytes\n",
result);
if (result >= 0)
if (copy_to_user(request.data, bouncebuffer, result))
@@ -395,9 +396,9 @@ int ncp_ioctl(struct inode *inode, struc
sr.dirEntNum = NCP_FINFO(inode)->dirEntNum;
sr.namespace = server->name_space[sr.volNumber];
} else
- DPRINTK("ncpfs: s_root->d_inode==NULL\n");
+ pr_debug("ncpfs: s_root->d_inode==NULL\n");
} else
- DPRINTK("ncpfs: s_root==NULL\n");
+ pr_debug("ncpfs: s_root==NULL\n");
} else {
sr.volNumber = -1;
sr.namespace = 0;
@@ -445,9 +446,9 @@ int ncp_ioctl(struct inode *inode, struc
NCP_FINFO(inode)->dirEntNum = de;
NCP_FINFO(inode)->DosDirNum = dosde;
} else
- DPRINTK("ncpfs: s_root->d_inode==NULL\n");
+ pr_debug("ncpfs: s_root->d_inode==NULL\n");
} else
- DPRINTK("ncpfs: s_root==NULL\n");
+ pr_debug("ncpfs: s_root==NULL\n");

return 0;
}
Index: linux/fs/ncpfs/mmap.c
===================================================================
--- linux.orig/fs/ncpfs/mmap.c
+++ linux/fs/ncpfs/mmap.c
@@ -108,7 +108,7 @@ int ncp_mmap(struct file *file, struct v
{
struct inode *inode = file->f_path.dentry->d_inode;

- DPRINTK("ncp_mmap: called\n");
+ pr_debug("ncp_mmap: called\n");

if (!ncp_conn_valid(NCP_SERVER(inode)))
return -EIO;
Index: linux/fs/ncpfs/ncplib_kernel.c
===================================================================
--- linux.orig/fs/ncpfs/ncplib_kernel.c
+++ linux/fs/ncpfs/ncplib_kernel.c
@@ -10,13 +10,13 @@
*/


-
+#include <linux/kernel.h>
#include "ncplib_kernel.h"

static inline void assert_server_locked(struct ncp_server *server)
{
if (server->lock == 0) {
- DPRINTK("ncpfs: server not locked!\n");
+ pr_debug("ncpfs: server not locked!\n");
}
}

@@ -75,7 +75,7 @@ static void ncp_add_pstring(struct ncp_s
int len = strlen(s);
assert_server_locked(server);
if (len > 255) {
- DPRINTK("ncpfs: string too long: %s\n", s);
+ pr_debug("ncpfs: string too long: %s\n", s);
len = 255;
}
ncp_add_byte(server, len);
@@ -226,7 +226,7 @@ int ncp_get_volume_info_with_number(stru
result = -EIO;
len = ncp_reply_byte(server, 29);
if (len > NCP_VOLNAME_LEN) {
- DPRINTK("ncpfs: volume name too long: %d\n", len);
+ pr_debug("ncpfs: volume name too long: %d\n", len);
goto out;
}
memcpy(&(target->volume_name), ncp_reply_data(server, 30), len);
@@ -260,7 +260,7 @@ int ncp_get_directory_info(struct ncp_se
result = -EIO;
len = ncp_reply_byte(server, 21);
if (len > NCP_VOLNAME_LEN) {
- DPRINTK("ncpfs: volume name too long: %d\n", len);
+ pr_debug("ncpfs: volume name too long: %d\n", len);
goto out;
}
memcpy(&(target->volume_name), ncp_reply_data(server, 22), len);
@@ -395,7 +395,7 @@ int ncp_obtain_nfs_info(struct ncp_serve

if ((result = ncp_request(server, 87)) == 0) {
ncp_extract_nfs_info(ncp_reply_data(server, 0), &target->nfs);
- DPRINTK(KERN_DEBUG
+ pr_debug(
"ncp_obtain_nfs_info: (%s) mode=0%o, rdev=0x%x\n",
target->entryName, target->nfs.mode,
target->nfs.rdev);
@@ -499,7 +499,7 @@ ncp_get_known_namespace(struct ncp_serve
namespace = ncp_reply_data(server, 2);

while (no_namespaces > 0) {
- DPRINTK("get_namespaces: found %d on %d\n", *namespace, volume);
+ pr_debug("get_namespaces: found %d on %d\n", *namespace, volume);

#ifdef CONFIG_NCPFS_NFS_NS
if ((*namespace == NW_NS_NFS) && !(server->m.flags&NCP_MOUNT_NO_NFS))
@@ -582,7 +582,7 @@ ncp_get_volume_root(struct ncp_server *s
int result;
__u8 volnum;

- DPRINTK("ncp_get_volume_root: looking up vol %s\n", volname);
+ pr_debug("ncp_get_volume_root: looking up vol %s\n", volname);

ncp_init_request(server);
ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */
@@ -608,7 +608,7 @@ ncp_get_volume_root(struct ncp_server *s

server->name_space[volnum] = ncp_get_known_namespace(server, volnum);

- DPRINTK("lookup_vol: namespace[%d] = %d\n",
+ pr_debug("lookup_vol: namespace[%d] = %d\n",
volnum, server->name_space[volnum]);

return 0;
Index: linux/fs/ncpfs/sock.c
===================================================================
--- linux.orig/fs/ncpfs/sock.c
+++ linux/fs/ncpfs/sock.c
@@ -26,6 +26,7 @@
#include <linux/ipx.h>
#include <linux/poll.h>
#include <linux/file.h>
+#include <linux/kernel.h>

#include <linux/ncp_fs.h>

@@ -404,15 +405,15 @@ void ncpdgram_rcv_proc(struct work_struc
}
result = _recv(sock, buf, sizeof(buf), MSG_DONTWAIT);
if (result < 0) {
- DPRINTK("recv failed with %d\n", result);
+ pr_debug("recv failed with %d\n", result);
continue;
}
if (result < 10) {
- DPRINTK("too short (%u) watchdog packet\n", result);
+ pr_debug("too short (%u) watchdog packet\n", result);
continue;
}
if (buf[9] != '?') {
- DPRINTK("bad signature (%02X) in watchdog packet\n", buf[9]);
+ pr_debug("bad signature (%02X) in watchdog packet\n", buf[9]);
continue;
}
buf[9] = 'Y';
@@ -553,7 +554,7 @@ static int __ncptcp_rcv_proc(struct ncp_
if (result < 0) {
printk(KERN_ERR "ncpfs: tcp: error in recvmsg: %d\n", result);
} else {
- DPRINTK(KERN_ERR "ncpfs: tcp: EOF\n");
+ pr_err("ncpfs: tcp: EOF\n");
}
return -EIO;
}
@@ -603,7 +604,7 @@ cont:;
server->rcv.len = datalen - 10;
break;
}
- DPRINTK("ncpfs: tcp: Unexpected NCP type %02X\n", type);
+ pr_debug("ncpfs: tcp: Unexpected NCP type %02X\n", type);
skipdata2:;
server->rcv.state = 2;
skipdata:;
@@ -613,7 +614,7 @@ skipdata:;
}
req = server->rcv.creq;
if (!req) {
- DPRINTK(KERN_ERR "ncpfs: Reply without appropriate request\n");
+ pr_err("ncpfs: Reply without appropriate request\n");
goto skipdata2;
}
if (datalen > req->datalen + 8) {
@@ -781,7 +782,7 @@ static int ncp_do_request(struct ncp_ser
spin_unlock_irqrestore(&current->sighand->siglock, flags);
}

- DDPRINTK("do_ncp_rpc_call returned %d\n", result);
+ pr_debug("do_ncp_rpc_call returned %d\n", result);

return result;
}
@@ -811,7 +812,7 @@ int ncp_request2(struct ncp_server *serv

result = ncp_do_request(server, server->current_size, reply, size);
if (result < 0) {
- DPRINTK("ncp_request_error: %d\n", result);
+ pr_debug("ncp_request_error: %d\n", result);
goto out;
}
server->completion = reply->completion_code;
Index: linux/fs/ncpfs/symlink.c
===================================================================
--- linux.orig/fs/ncpfs/symlink.c
+++ linux/fs/ncpfs/symlink.c
@@ -29,6 +29,7 @@
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/stat.h>
+#include <linux/kernel.h>
#include "ncplib_kernel.h"


@@ -113,7 +114,7 @@ int ncp_symlink(struct inode *dir, struc
__le32 attr;
unsigned int hdr;

- DPRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
+ pr_debug("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);

if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber))
kludge = 0;
Index: linux/include/linux/ncp_fs.h
===================================================================
--- linux.orig/include/linux/ncp_fs.h
+++ linux/include/linux/ncp_fs.h
@@ -160,20 +160,6 @@ struct ncp_nls_ioctl
#define PPRINTK(format, args...)
#endif

-#ifndef DEBUG_NCP
-#define DEBUG_NCP 0
-#endif
-#if DEBUG_NCP > 0
-#define DPRINTK(format, args...) PRINTK(format , ## args)
-#else
-#define DPRINTK(format, args...)
-#endif
-#if DEBUG_NCP > 1
-#define DDPRINTK(format, args...) PRINTK(format , ## args)
-#else
-#define DDPRINTK(format, args...)
-#endif
-
#define NCP_MAX_RPC_TIMEOUT (6*HZ)



--

2007-06-08 22:25:47

by Jack Stone

[permalink] [raw]
Subject: [PATCH 6/7] Add pr_debug_pid to kernel.h


Signed-off-by: Jack Stone <[email protected]>
---
+static inline int __attribute__ ((format (printf, 1, 2)))
pr_debug_pid(const char * fmt, ...)
+{
+ return 0;
+}
+
static inline int __attribute__ ((format (printf, 1, 2))) pr_err(const
char * fmt, ...)
{
return 0;

--

2007-06-08 22:26:29

by Jack Stone

[permalink] [raw]
Subject: [PATCH 7/7] Replace DPRINTK with pr_debug_pid in autofs4

Signed-off-by: Jack Stone <[email protected]>
---
-/* #define DEBUG */
-
-#ifdef DEBUG
-#define DPRINTK(fmt,args...) do { pr_debug("pid %d: %s: " fmt "\n" ,
current->pid , __FUNCTION__ , ##args); } while(0)
-#else
-#define DPRINTK(fmt,args...) do {} while(0)
-#endif
-
/* Unified info structure. This is pointed to by both the dentry and
inode structures. Each file in the filesystem has an instance of this
structure. It holds a reference to the dentry, so dentries are never
Index: linux/fs/autofs4/expire.c
===================================================================
--- linux.orig/fs/autofs4/expire.c
+++ linux/fs/autofs4/expire.c
@@ -50,7 +50,7 @@ static int autofs4_mount_busy(struct vfs
struct dentry *top = dentry;
int status = 1;

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);

mntget(mnt);
@@ -72,7 +72,7 @@ static int autofs4_mount_busy(struct vfs

status = 0;
done:
- DPRINTK("returning = %d", status);
+ pr_debug_pid("returning = %d", status);
mntput(mnt);
dput(dentry);
return status;
@@ -110,7 +110,7 @@ static int autofs4_direct_busy(struct vf
unsigned long timeout,
int do_now)
{
- DPRINTK("top %p %.*s",
+ pr_debug_pid("top %p %.*s",
top, (int) top->d_name.len, top->d_name.name);

/* If it's busy update the expiry counters */
@@ -139,7 +139,7 @@ static int autofs4_tree_busy(struct vfsm
struct autofs_info *top_ino = autofs4_dentry_ino(top);
struct dentry *p;

- DPRINTK("top %p %.*s",
+ pr_debug_pid("top %p %.*s",
top, (int)top->d_name.len, top->d_name.name);

/* Negative dentry - give up */
@@ -152,7 +152,7 @@ static int autofs4_tree_busy(struct vfsm
if (!simple_positive(p))
continue;

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
p, (int) p->d_name.len, p->d_name.name);

p = dget(p);
@@ -211,7 +211,7 @@ static struct dentry *autofs4_check_leav
{
struct dentry *p;

- DPRINTK("parent %p %.*s",
+ pr_debug_pid("parent %p %.*s",
parent, (int)parent->d_name.len, parent->d_name.name);

spin_lock(&dcache_lock);
@@ -220,7 +220,7 @@ static struct dentry *autofs4_check_leav
if (!simple_positive(p))
continue;

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
p, (int) p->d_name.len, p->d_name.name);

p = dget(p);
@@ -323,7 +323,7 @@ static struct dentry *autofs4_expire_ind
* offset (autofs-5.0+).
*/
if (d_mountpoint(dentry)) {
- DPRINTK("checking mountpoint %p %.*s",
+ pr_debug_pid("checking mountpoint %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);

/* Can we umount this guy */
@@ -373,7 +373,7 @@ next:
}

if (expired) {
- DPRINTK("returning %p %.*s",
+ pr_debug_pid("returning %p %.*s",
expired, (int)expired->d_name.len, expired->d_name.name);
spin_lock(&dcache_lock);
list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child);
Index: linux/fs/autofs4/inode.c
===================================================================
--- linux.orig/fs/autofs4/inode.c
+++ linux/fs/autofs4/inode.c
@@ -124,7 +124,7 @@ resume:
next = next->next;
spin_unlock(&dcache_lock);

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);

dput(dentry);
@@ -137,7 +137,7 @@ resume:
next = this_parent->d_u.d_child.next;
this_parent = this_parent->d_parent;
spin_unlock(&dcache_lock);
- DPRINTK("parent dentry %p %.*s",
+ pr_debug_pid("parent dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);
dput(dentry);
spin_lock(&dcache_lock);
@@ -169,7 +169,7 @@ void autofs4_kill_sb(struct super_block
kfree(sbi);

out_kill_sb:
- DPRINTK("shutting down");
+ pr_debug_pid("shutting down");
kill_anon_super(sb);
}

@@ -315,7 +315,7 @@ int autofs4_fill_super(struct super_bloc
sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
goto fail_unlock;
- DPRINTK("starting up, sbi = %p",sbi);
+ pr_debug_pid("starting up, sbi = %p",sbi);

memset(sbi, 0, sizeof(*sbi));

@@ -391,7 +391,7 @@ int autofs4_fill_super(struct super_bloc
sbi->version = sbi->max_proto;
sbi->sub_version = AUTOFS_PROTO_SUBVERSION;

- DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
+ pr_debug_pid("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
pipe = fget(pipefd);

if (!pipe) {
Index: linux/fs/autofs4/root.c
===================================================================
--- linux.orig/fs/autofs4/root.c
+++ linux/fs/autofs4/root.c
@@ -76,7 +76,7 @@ static int autofs4_root_readdir(struct f
struct autofs_sb_info *sbi = autofs4_sbi(file->f_path.dentry->d_sb);
int oz_mode = autofs4_oz_mode(sbi);

- DPRINTK("called, filp->f_pos = %lld", file->f_pos);
+ pr_debug_pid("called, filp->f_pos = %lld", file->f_pos);

/*
* Don't set reghost flag if:
@@ -87,7 +87,7 @@ static int autofs4_root_readdir(struct f
if (oz_mode && file->f_pos == 0 && sbi->reghost_enabled)
sbi->needs_reghost = 1;

- DPRINTK("needs_reghost = %d", sbi->needs_reghost);
+ pr_debug_pid("needs_reghost = %d", sbi->needs_reghost);

return dcache_readdir(file, dirent, filldir);
}
@@ -107,14 +107,14 @@ static int autofs4_dir_open(struct inode
cursor = file->private_data;
cursor->d_fsdata = NULL;

- DPRINTK("file=%p dentry=%p %.*s",
+ pr_debug_pid("file=%p dentry=%p %.*s",
file, dentry, dentry->d_name.len, dentry->d_name.name);

if (autofs4_oz_mode(sbi))
goto out;

if (autofs4_ispending(dentry)) {
- DPRINTK("dentry busy");
+ pr_debug_pid("dentry busy");
dcache_dir_close(inode, file);
status = -EBUSY;
goto out;
@@ -176,14 +176,14 @@ static int autofs4_dir_close(struct inod
struct dentry *cursor = file->private_data;
int status = 0;

- DPRINTK("file=%p dentry=%p %.*s",
+ pr_debug_pid("file=%p dentry=%p %.*s",
file, dentry, dentry->d_name.len, dentry->d_name.name);

if (autofs4_oz_mode(sbi))
goto out;

if (autofs4_ispending(dentry)) {
- DPRINTK("dentry busy");
+ pr_debug_pid("dentry busy");
status = -EBUSY;
goto out;
}
@@ -208,14 +208,14 @@ static int autofs4_dir_readdir(struct fi
struct dentry *cursor = file->private_data;
int status;

- DPRINTK("file=%p dentry=%p %.*s",
+ pr_debug_pid("file=%p dentry=%p %.*s",
file, dentry, dentry->d_name.len, dentry->d_name.name);

if (autofs4_oz_mode(sbi))
goto out;

if (autofs4_ispending(dentry)) {
- DPRINTK("dentry busy");
+ pr_debug_pid("dentry busy");
return -EBUSY;
}

@@ -248,12 +248,12 @@ static int try_to_fill_dentry(struct den
when expiration is done to trigger mount request with a new
dentry */
if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
- DPRINTK("waiting for expire %p name=%.*s",
+ pr_debug_pid("waiting for expire %p name=%.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

status = autofs4_wait(sbi, dentry, NFY_NONE);

- DPRINTK("expire done status=%d", status);
+ pr_debug_pid("expire done status=%d", status);

/*
* If the directory still exists the mount request must
@@ -265,7 +265,7 @@ static int try_to_fill_dentry(struct den
return -EAGAIN;
}

- DPRINTK("dentry=%p %.*s ino=%p",
+ pr_debug_pid("dentry=%p %.*s ino=%p",
dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode);

/*
@@ -273,12 +273,12 @@ static int try_to_fill_dentry(struct den
* isn't one already
*/
if (dentry->d_inode == NULL) {
- DPRINTK("waiting for mount name=%.*s",
+ pr_debug_pid("waiting for mount name=%.*s",
dentry->d_name.len, dentry->d_name.name);

status = autofs4_wait(sbi, dentry, NFY_MOUNT);

- DPRINTK("mount done status=%d", status);
+ pr_debug_pid("mount done status=%d", status);

/* Turn this into a real negative dentry? */
if (status == -ENOENT) {
@@ -293,7 +293,7 @@ static int try_to_fill_dentry(struct den
/* Trigger mount for path component or follow link */
} else if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY) ||
current->link_count) {
- DPRINTK("waiting for mount name=%.*s",
+ pr_debug_pid("waiting for mount name=%.*s",
dentry->d_name.len, dentry->d_name.name);

spin_lock(&dentry->d_lock);
@@ -301,7 +301,7 @@ static int try_to_fill_dentry(struct den
spin_unlock(&dentry->d_lock);
status = autofs4_wait(sbi, dentry, NFY_MOUNT);

- DPRINTK("mount done status=%d", status);
+ pr_debug_pid("mount done status=%d", status);

if (status) {
spin_lock(&dentry->d_lock);
@@ -330,7 +330,7 @@ static void *autofs4_follow_link(struct
unsigned int lookup_type;
int status;

- DPRINTK("dentry=%p %.*s oz_mode=%d nd->flags=%d",
+ pr_debug_pid("dentry=%p %.*s oz_mode=%d nd->flags=%d",
dentry, dentry->d_name.len, dentry->d_name.name, oz_mode,
nd->flags);

@@ -341,12 +341,12 @@ static void *autofs4_follow_link(struct

/* If an expire request is pending wait for it. */
if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
- DPRINTK("waiting for active request %p name=%.*s",
+ pr_debug_pid("waiting for active request %p name=%.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

status = autofs4_wait(sbi, dentry, NFY_NONE);

- DPRINTK("request done status=%d", status);
+ pr_debug_pid("request done status=%d", status);
}

/*
@@ -435,7 +435,7 @@ static int autofs4_revalidate(struct den
if (S_ISDIR(dentry->d_inode->i_mode) &&
!d_mountpoint(dentry) &&
__simple_empty(dentry)) {
- DPRINTK("dentry=%p %.*s, emptydir",
+ pr_debug_pid("dentry=%p %.*s, emptydir",
dentry, dentry->d_name.len, dentry->d_name.name);
spin_unlock(&dcache_lock);
/* The daemon never causes a mount to trigger */
@@ -461,7 +461,7 @@ void autofs4_dentry_release(struct dentr
{
struct autofs_info *inf;

- DPRINTK("releasing %p", de);
+ pr_debug_pid("releasing %p", de);

inf = autofs4_dentry_ino(de);
de->d_fsdata = NULL;
@@ -571,7 +571,7 @@ static struct dentry *autofs4_lookup(str
struct dentry *unhashed;
int oz_mode;

- DPRINTK("name = %.*s",
+ pr_debug_pid("name = %.*s",
dentry->d_name.len, dentry->d_name.name);

/* File name too long to exist */
@@ -581,7 +581,7 @@ static struct dentry *autofs4_lookup(str
sbi = autofs4_sbi(dir->i_sb);
oz_mode = autofs4_oz_mode(sbi);

- DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
+ pr_debug_pid("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
current->pid, process_group(current), sbi->catatonic, oz_mode);

unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent,
&dentry->d_name);
@@ -602,18 +602,18 @@ static struct dentry *autofs4_lookup(str
d_add(dentry, NULL);
} else {
struct autofs_info *ino = autofs4_dentry_ino(unhashed);
- DPRINTK("rehash %p with %p", dentry, unhashed);
+ pr_debug_pid("rehash %p with %p", dentry, unhashed);
/*
* If we are racing with expire the request might not
* be quite complete but the directory has been removed
* so it must have been successful, so just wait for it.
*/
if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
- DPRINTK("wait for incomplete expire %p name=%.*s",
+ pr_debug_pid("wait for incomplete expire %p name=%.*s",
unhashed, unhashed->d_name.len,
unhashed->d_name.name);
autofs4_wait(sbi, unhashed, NFY_NONE);
- DPRINTK("request completed");
+ pr_debug_pid("request completed");
}
d_rehash(unhashed);
dentry = unhashed;
@@ -695,7 +695,7 @@ static int autofs4_dir_symlink(struct in
struct inode *inode;
char *cp;

- DPRINTK("%s <- %.*s", symname,
+ pr_debug_pid("%s <- %.*s", symname,
dentry->d_name.len, dentry->d_name.name);

if (!autofs4_oz_mode(sbi))
@@ -792,7 +792,7 @@ static int autofs4_dir_rmdir(struct inod
struct autofs_info *ino = autofs4_dentry_ino(dentry);
struct autofs_info *p_ino;

- DPRINTK("dentry %p, removing %.*s",
+ pr_debug_pid("dentry %p, removing %.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

if (!autofs4_oz_mode(sbi))
@@ -836,7 +836,7 @@ static int autofs4_dir_mkdir(struct inod
if (!autofs4_oz_mode(sbi))
return -EACCES;

- DPRINTK("dentry %p, creating %.*s",
+ pr_debug_pid("dentry %p, creating %.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

ino = autofs4_init_ino(ino, sbi, S_IFDIR | 0555);
@@ -903,7 +903,7 @@ static inline int autofs4_ask_reghost(st
{
int status;

- DPRINTK("returning %d", sbi->needs_reghost);
+ pr_debug_pid("returning %d", sbi->needs_reghost);

status = put_user(sbi->needs_reghost, p);
if (status)
@@ -923,7 +923,7 @@ static inline int autofs4_toggle_reghost

status = get_user(val, p);

- DPRINTK("reghost = %d", val);
+ pr_debug_pid("reghost = %d", val);

if (status)
return status;
@@ -943,7 +943,7 @@ static inline int autofs4_ask_umount(str
if (may_umount(mnt))
status = 1;

- DPRINTK("returning %d", status);
+ pr_debug_pid("returning %d", status);

status = put_user(status, p);

@@ -972,7 +972,7 @@ static int autofs4_root_ioctl(struct ino
struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
void __user *p = (void __user *)arg;

- DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
+ pr_debug_pid("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
cmd,arg,sbi,process_group(current));

if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
Index: linux/fs/autofs4/waitq.c
===================================================================
--- linux.orig/fs/autofs4/waitq.c
+++ linux/fs/autofs4/waitq.c
@@ -28,7 +28,7 @@ void autofs4_catatonic_mode(struct autof
{
struct autofs_wait_queue *wq, *nwq;

- DPRINTK("entering catatonic mode");
+ pr_debug_pid("entering catatonic mode");

sbi->catatonic = 1;
wq = sbi->queues;
@@ -91,7 +91,7 @@ static void autofs4_notify_daemon(struct
} pkt;
size_t pktsz;

- DPRINTK("wait id = 0x%08lx, name = %.*s, type=%d",
+ pr_debug_pid("wait id = 0x%08lx, name = %.*s, type=%d",
wq->wait_queue_token, wq->len, wq->name, type);

memset(&pkt,0,sizeof pkt); /* For security reasons */
@@ -318,7 +318,7 @@ int autofs4_wait(struct autofs_sb_info *
autofs_ptype_expire_indirect;
}

- DPRINTK("new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
+ pr_debug_pid("new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);

/* autofs4_notify_daemon() may block */
@@ -327,7 +327,7 @@ int autofs4_wait(struct autofs_sb_info *
atomic_inc(&wq->wait_ctr);
mutex_unlock(&sbi->wq_mutex);
kfree(name);
- DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
+ pr_debug_pid("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
}

@@ -358,7 +358,7 @@ int autofs4_wait(struct autofs_sb_info *
recalc_sigpending();
spin_unlock_irqrestore(&current->sighand->siglock, irqflags);
} else {
- DPRINTK("skipped sleeping");
+ pr_debug_pid("skipped sleeping");
}

status = wq->status;

--

2007-06-08 22:28:54

by Jack Stone

[permalink] [raw]
Subject: [PATCH 1/7] Add a new debug function to kernel.h

Signed-off-by: Jack Stone <[email protected]>
---

Index: linux/include/linux/kernel.h
===================================================================
--- linux.orig/include/linux/kernel.h
+++ linux/include/linux/kernel.h
@@ -228,11 +228,18 @@ extern void print_hex_dump(const char *l
/* If you are writing a driver, please use dev_dbg instead */
#define pr_debug(fmt,arg...) \
printk(KERN_DEBUG fmt,##arg)
+#define pr_err(fmt,arg...) \
+ printk(KERN_ERR fmt,##arg)
#else
static inline int __attribute__ ((format (printf, 1, 2)))
pr_debug(const char * fmt, ...)
{
return 0;
}
+
+static inline int __attribute__ ((format (printf, 1, 2))) pr_err(const
char * fmt, ...)
+{
+ return 0;
+}
#endif

#define pr_info(fmt,arg...) \

--

2007-06-08 22:33:27

by Jack Stone

[permalink] [raw]
Subject: [PATCH 4/7] Update DPRINTK macro to use pr_debug in autofs4

Signed-off-by: Jack Stone <[email protected]>
---
#ifdef DEBUG
-#define DPRINTK(fmt,args...) do { printk(KERN_DEBUG "pid %d: %s: " fmt
"\n" , current->pid , __FUNCTION__ , ##args); } while(0)
+#define DPRINTK(fmt,args...) do { pr_debug("pid %d: %s: " fmt "\n" ,
current->pid , __FUNCTION__ , ##args); } while(0)
#else
#define DPRINTK(fmt,args...) do {} while(0)
#endif

--

2007-06-08 22:33:47

by Jack Stone

[permalink] [raw]
Subject: [PATCH 2/7] Replace DPRINTK with pr_debug in alternative.c

Signed-off-by: Jack Stone <[email protected]>
---
-#define DPRINTK(fmt, args...) if (debug_alternative) \
- printk(KERN_DEBUG fmt, args)
-
#ifdef GENERIC_NOP1
/* Use inline assembly to define this because the nops are defined
as inline assembly strings in the include files and we cannot
@@ -165,7 +163,7 @@
u8 *instr;
int diff;

- DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
+ pr_debug("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
for (a = start; a < end; a++) {
BUG_ON(a->replacementlen > a->instrlen);
if (!boot_cpu_has(a->cpuid))
@@ -175,7 +173,7 @@
/* vsyscall code is not mapped yet. resolve it manually. */
if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) {
instr = __va(instr - (u8*)VSYSCALL_START +
(u8*)__pa_symbol(&__vsyscall_0));
- DPRINTK("%s: vsyscall fixup: %p => %p\n",
+ pr_debug("%s: vsyscall fixup: %p => %p\n",
__FUNCTION__, a->instr, instr);
}
#endif
@@ -261,7 +259,7 @@
smp->locks_end = locks_end;
smp->text = text;
smp->text_end = text_end;
- DPRINTK("%s: locks %p -> %p, text %p -> %p, name %s\n",
+ pr_debug("%s: locks %p -> %p, text %p -> %p, name %s\n",
__FUNCTION__, smp->locks, smp->locks_end,
smp->text, smp->text_end, smp->name);

@@ -287,7 +285,7 @@
continue;
list_del(&item->next);
spin_unlock_irqrestore(&smp_alt, flags);
- DPRINTK("%s: %s\n", __FUNCTION__, item->name);
+ pr_debug("%s: %s\n", __FUNCTION__, item->name);
kfree(item);
return;
}

--

2007-06-08 22:34:19

by Jack Stone

[permalink] [raw]
Subject: [PATCH 3/7] Replace DPRINTK with pr_debug in autofs

Signed-off-by: Jack Stone <[email protected]>
---
-#ifdef DEBUG
-#define DPRINTK(D) (printk D)
-#else
-#define DPRINTK(D) ((void)0)
-#endif
-
/*
* If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
* kernel will keep the negative response cached for up to the time given
Index: linux/fs/autofs/dirhash.c
===================================================================
--- linux.orig/fs/autofs/dirhash.c
+++ linux/fs/autofs/dirhash.c
@@ -77,7 +77,7 @@ struct autofs_dir_ent *autofs_expire(str
/* Make sure entry is mounted and unused; note that dentry will
point to the mounted-on-top root. */
if (!S_ISDIR(dentry->d_inode->i_mode)||!d_mountpoint(dentry)) {
- DPRINTK(("autofs: not expirable (not a mounted directory): %s\n",
ent->name));
+ pr_debug("autofs: not expirable (not a mounted directory): %s\n",
ent->name);
continue;
}
mntget(mnt);
@@ -85,7 +85,7 @@ struct autofs_dir_ent *autofs_expire(str
if (!follow_down(&mnt, &dentry)) {
dput(dentry);
mntput(mnt);
- DPRINTK(("autofs: not expirable (not a mounted directory): %s\n",
ent->name));
+ pr_debug("autofs: not expirable (not a mounted directory): %s\n",
ent->name);
continue;
}
while (d_mountpoint(dentry) && follow_down(&mnt, &dentry))
@@ -94,10 +94,10 @@ struct autofs_dir_ent *autofs_expire(str

if ( may_umount(mnt) ) {
mntput(mnt);
- DPRINTK(("autofs: signaling expire on %s\n", ent->name));
+ pr_debug("autofs: signaling expire on %s\n", ent->name);
return ent; /* Expirable! */
}
- DPRINTK(("autofs: didn't expire due to may_umount: %s\n", ent->name));
+ pr_debug("autofs: didn't expire due to may_umount: %s\n", ent->name);
mntput(mnt);
}
return NULL; /* No expirable entries */
@@ -112,7 +112,7 @@ struct autofs_dir_ent *autofs_hash_looku
{
struct autofs_dir_ent *dhn;

- DPRINTK(("autofs_hash_lookup: hash = 0x%08x, name = ", name->hash));
+ pr_debug("autofs_hash_lookup: hash = 0x%08x, name = ", name->hash);
autofs_say(name->name,name->len);

for ( dhn = dh->h[(unsigned) name->hash % AUTOFS_HASH_SIZE] ; dhn ;
dhn = dhn->next ) {
@@ -129,7 +129,7 @@ void autofs_hash_insert(struct autofs_di
{
struct autofs_dir_ent **dhnp;

- DPRINTK(("autofs_hash_insert: hash = 0x%08x, name = ", ent->hash));
+ pr_debug("autofs_hash_insert: hash = 0x%08x, name = ", ent->hash);
autofs_say(ent->name,ent->len);

autofs_init_usage(dh,ent);
@@ -179,7 +179,7 @@ struct autofs_dir_ent *autofs_hash_enum(
bucket = ecount = 0;
}

- DPRINTK(("autofs_hash_enum: bucket %d, entry %d\n", bucket, ecount));
+ pr_debug("autofs_hash_enum: bucket %d, entry %d\n", bucket, ecount);

ent = last ? last->next : NULL;

Index: linux/fs/autofs/inode.c
===================================================================
--- linux.orig/fs/autofs/inode.c
+++ linux/fs/autofs/inode.c
@@ -48,7 +48,7 @@ void autofs_kill_sb(struct super_block *
kfree(sb->s_fs_info);

out_kill_sb:
- DPRINTK(("autofs: shutting down\n"));
+ pr_debug("autofs: shutting down\n");
kill_anon_super(sb);
}

@@ -146,7 +146,7 @@ int autofs_fill_super(struct super_block
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
goto fail_unlock;
- DPRINTK(("autofs: starting up, sbi = %p\n",sbi));
+ pr_debug("autofs: starting up, sbi = %p\n",sbi);

s->s_fs_info = sbi;
sbi->magic = AUTOFS_SBI_MAGIC;
@@ -186,7 +186,7 @@ int autofs_fill_super(struct super_block
goto fail_dput;
}

- DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, pgid));
+ pr_debug("autofs: pipe fd = %d, pgrp = %u\n", pipefd, pgid);
sbi->oz_pgrp = find_get_pid(pgid);

if (!sbi->oz_pgrp) {
Index: linux/fs/autofs/root.c
===================================================================
--- linux.orig/fs/autofs/root.c
+++ linux/fs/autofs/root.c
@@ -201,7 +201,7 @@ static struct dentry *autofs_root_lookup
struct autofs_sb_info *sbi;
int oz_mode;

- DPRINTK(("autofs_root_lookup: name = "));
+ pr_debug("autofs_root_lookup: name = ");
lock_kernel();
autofs_say(dentry->d_name.name,dentry->d_name.len);

@@ -213,10 +213,10 @@ static struct dentry *autofs_root_lookup
sbi = autofs_sbi(dir->i_sb);

oz_mode = autofs_oz_mode(sbi);
- DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
+ pr_debug("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
"oz_mode = %d\n", pid_nr(task_pid(current)),
process_group(current), sbi->catatonic,
- oz_mode));
+ oz_mode);

/*
* Mark the dentry incomplete, but add it. This is needed so
@@ -275,7 +275,7 @@ static int autofs_root_symlink(struct in
int slsize;
struct autofs_symlink *sl;

- DPRINTK(("autofs_root_symlink: %s <- ", symname));
+ pr_debug("autofs_root_symlink: %s <- ", symname);
autofs_say(dentry->d_name.name,dentry->d_name.len);

lock_kernel();
@@ -536,7 +536,7 @@ static int autofs_root_ioctl(struct inod
struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb);
void __user *argp = (void __user *)arg;

- DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp =
%u\n",cmd,arg,sbi,process_group(current)));
+ pr_debug("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp =
%u\n",cmd,arg,sbi,process_group(current));

if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
_IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
Index: linux/fs/autofs/waitq.c
===================================================================
--- linux.orig/fs/autofs/waitq.c
+++ linux/fs/autofs/waitq.c
@@ -27,7 +27,7 @@ void autofs_catatonic_mode(struct autofs
{
struct autofs_wait_queue *wq, *nwq;

- DPRINTK(("autofs: entering catatonic mode\n"));
+ pr_debug("autofs: entering catatonic mode\n");

sbi->catatonic = 1;
wq = sbi->queues;
@@ -84,7 +84,7 @@ static void autofs_notify_daemon(struct
{
struct autofs_packet_missing pkt;

- DPRINTK(("autofs_wait: wait id = 0x%08lx, name = ",
wq->wait_queue_token));
+ pr_debug("autofs_wait: wait id = 0x%08lx, name = ", wq->wait_queue_token);
autofs_say(wq->name,wq->len);

memset(&pkt,0,sizeof pkt); /* For security reasons */
@@ -166,7 +166,7 @@ int autofs_wait(struct autofs_sb_info *s

sigprocmask(SIG_SETMASK, &sigmask, NULL);
} else {
- DPRINTK(("autofs_wait: skipped sleeping\n"));
+ pr_debug("autofs_wait: skipped sleeping\n");
}

status = wq->status;

--

2007-06-08 22:41:17

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH 3/7] Replace DPRINTK with pr_debug in autofs

Jack Stone wrote:
> Signed-off-by: Jack Stone <[email protected]>

Acked-By: H. Peter Anvin <[email protected]>

As far as I can tell, autofs 3 has fallen into disuse, and autofs 4/5
has matured to the point where I don't think there is any major reason
to use autofs 3 anymore. It probably should be put on the chopping block.

-hpa

2007-06-09 07:00:12

by Ian Kent

[permalink] [raw]
Subject: Re: [PATCH 0/7] Cleanup code to replace DPRINTK with pr_debug

On Fri, 2007-06-08 at 23:18 +0100, Jack Stone wrote:
> This patch series replaces DPRINTK with pr_debug in alternative.c,
> autofs, autofs4
> and ncpfs. A new function called pr_err is also added to keep
> functionality in
> ncpfs. The last 2 patches add support for pr_debug_pid and apply it to
> autofs4 to
> keep the output the same as the current DPRINTK statements.

And ???

Presenting patches without the reason why they are needed is not a good
policy.

Not to mention that several appear to be missing headers, I can't
believe you tested that they applied before posting them.

NACK.

Ian


2007-06-09 07:56:56

by Jack Stone

[permalink] [raw]
Subject: Re: [PATCH 0/7] Cleanup code to replace DPRINTK with pr_debug

Ian Kent wrote:
> On Fri, 2007-06-08 at 23:18 +0100, Jack Stone wrote:
>> This patch series replaces DPRINTK with pr_debug in alternative.c,
>> autofs, autofs4
>> and ncpfs. A new function called pr_err is also added to keep
>> functionality in
>> ncpfs. The last 2 patches add support for pr_debug_pid and apply it to
>> autofs4 to
>> keep the output the same as the current DPRINTK statements.
>
> And ???
>
> Presenting patches without the reason why they are needed is not a good
> policy.
>
> Not to mention that several appear to be missing headers, I can't
> believe you tested that they applied before posting them.
>
> NACK.
>
> Ian

Sorry, I think I must've miss copied the patches. I'll re-email them.

The reason for these patches is to move the debug printk macros to the
central debug printk macro. This is so future updates are easier and the
code is more uniform.

Jack

2007-06-09 08:01:26

by Jack Stone

[permalink] [raw]
Subject: Re: [PATCH 0/7] Cleanup code to replace DPRINTK with pr_debug

Jack Stone wrote:
> This patch series replaces DPRINTK with pr_debug in alternative.c,
> autofs, autofs4
> and ncpfs. A new function called pr_err is also added to keep
> functionality in
> ncpfs. The last 2 patches add support for pr_debug_pid and apply it to
> autofs4 to
> keep the output the same as the current DPRINTK statements.
>
> All patches have been compile tested but not boot tested

Correct set of patches.

Jack

2007-06-09 08:07:34

by Jack Stone

[permalink] [raw]
Subject: [PATCH 1/7] Add a new debug function to kernel.h

This patch adds a new macro to print to KERN_ERR initially for ncp but
others may want to use it

Signed-off-by: Jack Stone <[email protected]>
---
Index: linux/include/linux/kernel.h
===================================================================
--- linux.orig/include/linux/kernel.h
+++ linux/include/linux/kernel.h
@@ -228,11 +228,18 @@ extern void print_hex_dump(const char *l
/* If you are writing a driver, please use dev_dbg instead */
#define pr_debug(fmt,arg...) \
printk(KERN_DEBUG fmt,##arg)
+#define pr_err(fmt,arg...) \
+ printk(KERN_ERR fmt,##arg)
#else
static inline int __attribute__ ((format (printf, 1, 2)))
pr_debug(const char * fmt, ...)
{
return 0;
}
+
+static inline int __attribute__ ((format (printf, 1, 2))) pr_err(const
char * fmt, ...)
+{
+ return 0;
+}
#endif

#define pr_info(fmt,arg...) \


2007-06-09 08:09:28

by Jack Stone

[permalink] [raw]
Subject: [PATCH 2/7] Replace DPRINTK with pr_debug in alternative.c

This patch converts all DPRINTKs in alternative.c to pr_debug

Signed-off-by: Jack Stone <[email protected]>
---

--- linux/arch/i386/kernel/alternative.c 2007-06-07 17:25:46.000000000 +0100
+++ linux/arch/i386/kernel/alternative.c 2007-06-07 20:45:52.000000000 +0100
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
@@ -41,9 +42,6 @@
__setup("noreplace-paravirt", setup_noreplace_paravirt);
#endif

-#define DPRINTK(fmt, args...) if (debug_alternative) \
- printk(KERN_DEBUG fmt, args)
-
#ifdef GENERIC_NOP1
/* Use inline assembly to define this because the nops are defined
as inline assembly strings in the include files and we cannot
@@ -165,7 +163,7 @@
u8 *instr;
int diff;

- DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
+ pr_debug("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
for (a = start; a < end; a++) {
BUG_ON(a->replacementlen > a->instrlen);
if (!boot_cpu_has(a->cpuid))
@@ -175,7 +173,7 @@
/* vsyscall code is not mapped yet. resolve it manually. */
if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) {
instr = __va(instr - (u8*)VSYSCALL_START +
(u8*)__pa_symbol(&__vsyscall_0));
- DPRINTK("%s: vsyscall fixup: %p => %p\n",
+ pr_debug("%s: vsyscall fixup: %p => %p\n",
__FUNCTION__, a->instr, instr);
}
#endif
@@ -261,7 +259,7 @@
smp->locks_end = locks_end;
smp->text = text;
smp->text_end = text_end;
- DPRINTK("%s: locks %p -> %p, text %p -> %p, name %s\n",
+ pr_debug("%s: locks %p -> %p, text %p -> %p, name %s\n",
__FUNCTION__, smp->locks, smp->locks_end,
smp->text, smp->text_end, smp->name);

@@ -287,7 +285,7 @@
continue;
list_del(&item->next);
spin_unlock_irqrestore(&smp_alt, flags);
- DPRINTK("%s: %s\n", __FUNCTION__, item->name);
+ pr_debug("%s: %s\n", __FUNCTION__, item->name);
kfree(item);
return;
}

2007-06-09 08:11:32

by Jack Stone

[permalink] [raw]
Subject: [PATCH 3/7] Replace DPRINTK with pr_debug in autofs

This patch replaces DPRINTKs in autofs

Signed-off-by: Jack Stone <[email protected]>
---
Index: linux/fs/autofs/autofs_i.h
===================================================================
--- linux.orig/fs/autofs/autofs_i.h
+++ linux/fs/autofs/autofs_i.h
@@ -31,12 +31,6 @@
#include <asm/current.h>
#include <asm/uaccess.h>

-#ifdef DEBUG
-#define DPRINTK(D) (printk D)
-#else
-#define DPRINTK(D) ((void)0)
-#endif
-
/*
* If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
* kernel will keep the negative response cached for up to the time given
Index: linux/fs/autofs/dirhash.c
===================================================================
--- linux.orig/fs/autofs/dirhash.c
+++ linux/fs/autofs/dirhash.c
@@ -77,7 +77,7 @@ struct autofs_dir_ent *autofs_expire(str
/* Make sure entry is mounted and unused; note that dentry will
point to the mounted-on-top root. */
if (!S_ISDIR(dentry->d_inode->i_mode)||!d_mountpoint(dentry)) {
- DPRINTK(("autofs: not expirable (not a mounted directory): %s\n",
ent->name));
+ pr_debug("autofs: not expirable (not a mounted directory): %s\n",
ent->name);
continue;
}
mntget(mnt);
@@ -85,7 +85,7 @@ struct autofs_dir_ent *autofs_expire(str
if (!follow_down(&mnt, &dentry)) {
dput(dentry);
mntput(mnt);
- DPRINTK(("autofs: not expirable (not a mounted directory): %s\n",
ent->name));
+ pr_debug("autofs: not expirable (not a mounted directory): %s\n",
ent->name);
continue;
}
while (d_mountpoint(dentry) && follow_down(&mnt, &dentry))
@@ -94,10 +94,10 @@ struct autofs_dir_ent *autofs_expire(str

if ( may_umount(mnt) ) {
mntput(mnt);
- DPRINTK(("autofs: signaling expire on %s\n", ent->name));
+ pr_debug("autofs: signaling expire on %s\n", ent->name);
return ent; /* Expirable! */
}
- DPRINTK(("autofs: didn't expire due to may_umount: %s\n", ent->name));
+ pr_debug("autofs: didn't expire due to may_umount: %s\n", ent->name);
mntput(mnt);
}
return NULL; /* No expirable entries */
@@ -112,7 +112,7 @@ struct autofs_dir_ent *autofs_hash_looku
{
struct autofs_dir_ent *dhn;

- DPRINTK(("autofs_hash_lookup: hash = 0x%08x, name = ", name->hash));
+ pr_debug("autofs_hash_lookup: hash = 0x%08x, name = ", name->hash);
autofs_say(name->name,name->len);

for ( dhn = dh->h[(unsigned) name->hash % AUTOFS_HASH_SIZE] ; dhn ;
dhn = dhn->next ) {
@@ -129,7 +129,7 @@ void autofs_hash_insert(struct autofs_di
{
struct autofs_dir_ent **dhnp;

- DPRINTK(("autofs_hash_insert: hash = 0x%08x, name = ", ent->hash));
+ pr_debug("autofs_hash_insert: hash = 0x%08x, name = ", ent->hash);
autofs_say(ent->name,ent->len);

autofs_init_usage(dh,ent);
@@ -179,7 +179,7 @@ struct autofs_dir_ent *autofs_hash_enum(
bucket = ecount = 0;
}

- DPRINTK(("autofs_hash_enum: bucket %d, entry %d\n", bucket, ecount));
+ pr_debug("autofs_hash_enum: bucket %d, entry %d\n", bucket, ecount);

ent = last ? last->next : NULL;

Index: linux/fs/autofs/inode.c
===================================================================
--- linux.orig/fs/autofs/inode.c
+++ linux/fs/autofs/inode.c
@@ -48,7 +48,7 @@ void autofs_kill_sb(struct super_block *
kfree(sb->s_fs_info);

out_kill_sb:
- DPRINTK(("autofs: shutting down\n"));
+ pr_debug("autofs: shutting down\n");
kill_anon_super(sb);
}

@@ -146,7 +146,7 @@ int autofs_fill_super(struct super_block
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
goto fail_unlock;
- DPRINTK(("autofs: starting up, sbi = %p\n",sbi));
+ pr_debug("autofs: starting up, sbi = %p\n",sbi);

s->s_fs_info = sbi;
sbi->magic = AUTOFS_SBI_MAGIC;
@@ -186,7 +186,7 @@ int autofs_fill_super(struct super_block
goto fail_dput;
}

- DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, pgid));
+ pr_debug("autofs: pipe fd = %d, pgrp = %u\n", pipefd, pgid);
sbi->oz_pgrp = find_get_pid(pgid);

if (!sbi->oz_pgrp) {
Index: linux/fs/autofs/root.c
===================================================================
--- linux.orig/fs/autofs/root.c
+++ linux/fs/autofs/root.c
@@ -201,7 +201,7 @@ static struct dentry *autofs_root_lookup
struct autofs_sb_info *sbi;
int oz_mode;

- DPRINTK(("autofs_root_lookup: name = "));
+ pr_debug("autofs_root_lookup: name = ");
lock_kernel();
autofs_say(dentry->d_name.name,dentry->d_name.len);

@@ -213,10 +213,10 @@ static struct dentry *autofs_root_lookup
sbi = autofs_sbi(dir->i_sb);

oz_mode = autofs_oz_mode(sbi);
- DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
+ pr_debug("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
"oz_mode = %d\n", pid_nr(task_pid(current)),
process_group(current), sbi->catatonic,
- oz_mode));
+ oz_mode);

/*
* Mark the dentry incomplete, but add it. This is needed so
@@ -275,7 +275,7 @@ static int autofs_root_symlink(struct in
int slsize;
struct autofs_symlink *sl;

- DPRINTK(("autofs_root_symlink: %s <- ", symname));
+ pr_debug("autofs_root_symlink: %s <- ", symname);
autofs_say(dentry->d_name.name,dentry->d_name.len);

lock_kernel();
@@ -536,7 +536,7 @@ static int autofs_root_ioctl(struct inod
struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb);
void __user *argp = (void __user *)arg;

- DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp =
%u\n",cmd,arg,sbi,process_group(current)));
+ pr_debug("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp =
%u\n",cmd,arg,sbi,process_group(current));

if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
_IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
Index: linux/fs/autofs/waitq.c
===================================================================
--- linux.orig/fs/autofs/waitq.c
+++ linux/fs/autofs/waitq.c
@@ -27,7 +27,7 @@ void autofs_catatonic_mode(struct autofs
{
struct autofs_wait_queue *wq, *nwq;

- DPRINTK(("autofs: entering catatonic mode\n"));
+ pr_debug("autofs: entering catatonic mode\n");

sbi->catatonic = 1;
wq = sbi->queues;
@@ -84,7 +84,7 @@ static void autofs_notify_daemon(struct
{
struct autofs_packet_missing pkt;

- DPRINTK(("autofs_wait: wait id = 0x%08lx, name = ",
wq->wait_queue_token));
+ pr_debug("autofs_wait: wait id = 0x%08lx, name = ", wq->wait_queue_token);
autofs_say(wq->name,wq->len);

memset(&pkt,0,sizeof pkt); /* For security reasons */
@@ -166,7 +166,7 @@ int autofs_wait(struct autofs_sb_info *s

sigprocmask(SIG_SETMASK, &sigmask, NULL);
} else {
- DPRINTK(("autofs_wait: skipped sleeping\n"));
+ pr_debug("autofs_wait: skipped sleeping\n");
}

status = wq->status;

2007-06-09 08:13:40

by Jack Stone

[permalink] [raw]
Subject: [PATCH 4/7] Update DPRINTK macro to use pr_debug

This patch updates the DPRINTK macro in autofs4 to use pr_debug as the
macro uses a special print format.

Signed-off-by Jack Stone <[email protected]>
---
Index: linux/fs/autofs4/autofs_i.h
===================================================================
--- linux.orig/fs/autofs4/autofs_i.h
+++ linux/fs/autofs4/autofs_i.h
@@ -35,7 +35,7 @@
/* #define DEBUG */

#ifdef DEBUG
-#define DPRINTK(fmt,args...) do { printk(KERN_DEBUG "pid %d: %s: " fmt
"\n" , current->pid , __FUNCTION__ , ##args); } while(0)
+#define DPRINTK(fmt,args...) do { pr_debug("pid %d: %s: " fmt "\n" ,
current->pid , __FUNCTION__ , ##args); } while(0)
#else
#define DPRINTK(fmt,args...) do {} while(0)
#endif


2007-06-09 08:16:04

by Jack Stone

[permalink] [raw]
Subject: [PATCH 5/7] Replace DPRINTK with pr_debug in ncpfs

This patch replaces DPRINTKs in ncpfs with a combination of pr_debug and
pr_err as appropriate.

Signed-off-by: Jack Stone <[email protected]>
---
Index: linux/fs/ncpfs/dir.c
===================================================================
--- linux.orig/fs/ncpfs/dir.c
+++ linux/fs/ncpfs/dir.c
@@ -296,7 +296,7 @@ __ncp_lookup_validate(struct dentry * de
if (val)
goto finished;

- DDPRINTK("ncp_lookup_validate: %s/%s not valid, age=%ld, server lookup\n",
+ pr_debug("ncp_lookup_validate: %s/%s not valid, age=%ld, server lookup\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
NCP_GET_AGE(dentry));

@@ -313,7 +313,7 @@ __ncp_lookup_validate(struct dentry * de
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
finfo.volume = finfo.i.volNumber;
- DDPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n",
+ pr_debug("ncp_lookup_validate: looked for %s/%s, res=%d\n",
dentry->d_parent->d_name.name, __name, res);
/*
* If we didn't find it, or if it has a different dirEntNum to
@@ -324,13 +324,13 @@ __ncp_lookup_validate(struct dentry * de
ncp_new_dentry(dentry);
val=1;
} else
- DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
+ pr_debug("ncp_lookup_validate: found, but dirEntNum changed\n");

ncp_update_inode2(dentry->d_inode, &finfo);
}

finished:
- DDPRINTK("ncp_lookup_validate: result=%d\n", val);
+ pr_debug("ncp_lookup_validate: result=%d\n", val);
dput(parent);
return val;
}
@@ -416,7 +416,7 @@ static int ncp_readdir(struct file *filp
ctl.page = NULL;
ctl.cache = NULL;

- DDPRINTK("ncp_readdir: reading %s/%s, pos=%d\n",
+ pr_debug("ncp_readdir: reading %s/%s, pos=%d\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
(int) filp->f_pos);

@@ -656,7 +656,7 @@ ncp_read_volume_list(struct file *filp,
struct ncp_entry_info entry;
int i;

- DPRINTK("ncp_read_volume_list: pos=%ld\n",
+ pr_debug("ncp_read_volume_list: pos=%ld\n",
(unsigned long) filp->f_pos);

for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
@@ -666,12 +666,12 @@ ncp_read_volume_list(struct file *filp,
if (!strlen(info.volume_name))
continue;

- DPRINTK("ncp_read_volume_list: found vol: %s\n",
+ pr_debug("ncp_read_volume_list: 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",
+ pr_debug("ncpfs: could not lookup vol %s\n",
info.volume_name);
continue;
}
@@ -695,7 +695,7 @@ ncp_do_readdir(struct file *filp, void *
int more;
size_t bufsize;

- DPRINTK("ncp_do_readdir: %s/%s, fpos=%ld\n",
+ pr_debug("ncp_do_readdir: %s/%s, fpos=%ld\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
(unsigned long) filp->f_pos);
PPRINTK("ncp_do_readdir: init %s, volnum=%d, dirent=%u\n",
@@ -704,7 +704,7 @@ ncp_do_readdir(struct file *filp, void *

err = ncp_initialize_search(server, dir, &seq);
if (err) {
- DPRINTK("ncp_do_readdir: init failed, err=%d\n", err);
+ pr_debug("ncp_do_readdir: init failed, err=%d\n", err);
return;
}
/* We MUST NOT use server->buffer_size handshaked with server if we are
@@ -779,10 +779,10 @@ int ncp_conn_logged_in(struct super_bloc
NCP_FINFO(ino)->dirEntNum = dirEntNum;
NCP_FINFO(ino)->DosDirNum = DosDirNum;
} else {
- DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n");
+ pr_debug("ncpfs: sb->s_root->d_inode == NULL!\n");
}
} else {
- DPRINTK("ncpfs: sb->s_root == NULL!\n");
+ pr_debug("ncpfs: sb->s_root == NULL!\n");
}
}
result = 0;
@@ -917,7 +917,7 @@ int ncp_create_new(struct inode *dir, st
if (result) {
if (result == 0x87)
error = -ENAMETOOLONG;
- DPRINTK("ncp_create: %s/%s failed\n",
+ pr_debug("ncp_create: %s/%s failed\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
goto out;
}
@@ -952,7 +952,7 @@ static int ncp_mkdir(struct inode *dir,
int error, len;
__u8 __name[NCP_MAXPATHLEN + 1];

- DPRINTK("ncp_mkdir: making %s/%s\n",
+ pr_debug("ncp_mkdir: making %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

error = -EIO;
@@ -995,7 +995,7 @@ static int ncp_rmdir(struct inode *dir,
int error, result, len;
__u8 __name[NCP_MAXPATHLEN + 1];

- DPRINTK("ncp_rmdir: removing %s/%s\n",
+ pr_debug("ncp_rmdir: removing %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

error = -EIO;
@@ -1052,7 +1052,7 @@ static int ncp_unlink(struct inode *dir,

lock_kernel();
server = NCP_SERVER(dir);
- DPRINTK("ncp_unlink: unlinking %s/%s\n",
+ pr_debug("ncp_unlink: unlinking %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

error = -EIO;
@@ -1077,7 +1077,7 @@ static int ncp_unlink(struct inode *dir,
#endif
switch (error) {
case 0x00:
- DPRINTK("ncp: removed %s/%s\n",
+ pr_debug("ncp: removed %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
break;
case 0x85:
@@ -1114,7 +1114,7 @@ static int ncp_rename(struct inode *old_
int old_len, new_len;
__u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];

- DPRINTK("ncp_rename: %s/%s to %s/%s\n",
+ pr_debug("ncp_rename: %s/%s to %s/%s\n",
old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
new_dentry->d_parent->d_name.name, new_dentry->d_name.name);

@@ -1151,7 +1151,7 @@ static int ncp_rename(struct inode *old_
#endif
switch (error) {
case 0x00:
- DPRINTK("ncp renamed %s -> %s.\n",
+ pr_debug("ncp renamed %s -> %s.\n",

old_dentry->d_name.name,new_dentry->d_name.name);
break;
case 0x9E:
@@ -1175,7 +1175,7 @@ static int ncp_mknod(struct inode * dir,
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%o\n", mode);
+ pr_debug(KERN_DEBUG "ncp_mknod: mode = 0%o\n", mode);
return ncp_create_new(dir, dentry, mode, rdev, 0);
}
return -EPERM; /* Strange, but true */
Index: linux/fs/ncpfs/file.c
===================================================================
--- linux.orig/fs/ncpfs/file.c
+++ linux/fs/ncpfs/file.c
@@ -41,7 +41,7 @@ int ncp_make_open(struct inode *inode, i
goto out;
}

- DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
+ pr_debug("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
atomic_read(&NCP_FINFO(inode)->opened),
NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
@@ -110,7 +110,7 @@ ncp_file_read(struct file *file, char __
void* freepage;
size_t freelen;

- DPRINTK("ncp_file_read: enter %s/%s\n",
+ pr_debug("ncp_file_read: enter %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);

if (!ncp_conn_valid(NCP_SERVER(inode)))
@@ -131,7 +131,7 @@ ncp_file_read(struct file *file, char __

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

@@ -172,7 +172,7 @@ ncp_file_read(struct file *file, char __

file_accessed(file);

- DPRINTK("ncp_file_read: exit %s/%s\n",
+ pr_debug("ncp_file_read: exit %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
outrel:
ncp_inode_close(inode);
@@ -190,7 +190,7 @@ ncp_file_write(struct file *file, const
int errno;
void* bouncebuffer;

- DPRINTK("ncp_file_write: enter %s/%s\n",
+ pr_debug("ncp_file_write: enter %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
if (!ncp_conn_valid(NCP_SERVER(inode)))
return -EIO;
@@ -224,7 +224,7 @@ ncp_file_write(struct file *file, const
return 0;
errno = ncp_make_open(inode, O_WRONLY);
if (errno) {
- DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
+ pr_err("ncp_file_write: open failed, error=%d\n", errno);
return errno;
}
bufsize = NCP_SERVER(inode)->buffer_size;
@@ -269,7 +269,7 @@ ncp_file_write(struct file *file, const
if (pos > inode->i_size) {
inode->i_size = pos;
}
- DPRINTK("ncp_file_write: exit %s/%s\n",
+ pr_debug("ncp_file_write: exit %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
outrel:
ncp_inode_close(inode);
@@ -278,7 +278,7 @@ outrel:

static int ncp_release(struct inode *inode, struct file *file) {
if (ncp_make_closed(inode)) {
- DPRINTK("ncp_release: failed to close\n");
+ pr_debug("ncp_release: failed to close\n");
}
return 0;
}
Index: linux/fs/ncpfs/inode.c
===================================================================
--- linux.orig/fs/ncpfs/inode.c
+++ linux/fs/ncpfs/inode.c
@@ -121,7 +121,7 @@ void ncp_update_inode(struct inode *inod
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",
+ pr_debug("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
}
@@ -129,7 +129,7 @@ void ncp_update_inode(struct inode *inod
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",
+ pr_debug("ncp_update_dates_and_mode: (%s) nfs.mode=0%o\n",
nwi->entryName, nwi->nfs.mode);
if (nwi->nfs.mode) {
/* XXX Security? */
@@ -215,7 +215,7 @@ static void ncp_set_attr(struct inode *i

ncp_update_attrs(inode, nwinfo);

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

inode->i_nlink = 1;
inode->i_uid = server->m.uid;
@@ -284,7 +284,7 @@ ncp_delete_inode(struct inode *inode)
truncate_inode_pages(&inode->i_data, 0);

if (S_ISDIR(inode->i_mode)) {
- DDPRINTK("ncp_delete_inode: put directory %ld\n", inode->i_ino);
+ pr_debug("ncp_delete_inode: put directory %ld\n", inode->i_ino);
}

if (ncp_make_closed(inode) != 0) {
@@ -601,7 +601,7 @@ static int ncp_fill_super(struct super_b
ncp_unlock_server(server);
if (error < 0)
goto out_rxbuf;
- DPRINTK("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
+ pr_debug("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));

error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */
#ifdef CONFIG_NCPFS_PACKET_SIGNING
@@ -627,7 +627,7 @@ static int ncp_fill_super(struct super_b
if (ncp_negotiate_buffersize(server, default_bufsize,
&(server->buffer_size)) != 0)
goto out_disconnect;
- DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size);
+ pr_debug("ncpfs: bufsize = %d\n", server->buffer_size);

memset(&finfo, 0, sizeof(finfo));
finfo.i.attributes = aDIR;
@@ -656,7 +656,7 @@ static int ncp_fill_super(struct super_b
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);
+ pr_debug("ncp_fill_super: root vol=%d\n",
NCP_FINFO(root_inode)->volNumber);
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root)
goto out_no_root;
@@ -900,7 +900,7 @@ int ncp_notify_change(struct dentry *den
if ((attr->ia_valid & ATTR_SIZE) != 0) {
int written;

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

if ((result = ncp_make_open(inode, O_WRONLY)) < 0) {
@@ -987,7 +987,7 @@ static struct file_system_type ncp_fs_ty
static int __init init_ncp_fs(void)
{
int err;
- DPRINTK("ncpfs: init_module called\n");
+ pr_debug("ncpfs: init_module called\n");

err = init_inodecache();
if (err)
@@ -1004,7 +1004,7 @@ out1:

static void __exit exit_ncp_fs(void)
{
- DPRINTK("ncpfs: cleanup_module called\n");
+ pr_debug("ncpfs: cleanup_module called\n");
unregister_filesystem(&ncp_fs_type);
destroy_inodecache();
}
Index: linux/fs/ncpfs/ioctl.c
===================================================================
--- linux.orig/fs/ncpfs/ioctl.c
+++ linux/fs/ncpfs/ioctl.c
@@ -18,6 +18,7 @@
#include <linux/smp_lock.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
+#include <linux/kernel.h>

#include <linux/ncp_fs.h>

@@ -47,7 +48,7 @@ ncp_get_fs_info(struct ncp_server * serv
return -EFAULT;

if (info.version != NCP_GET_FS_INFO_VERSION) {
- DPRINTK("info.version invalid: %d\n", info.version);
+ pr_debug("info.version invalid: %d\n", info.version);
return -EINVAL;
}
/* TODO: info.addr = server->m.serv_addr; */
@@ -77,7 +78,7 @@ ncp_get_fs_info_v2(struct ncp_server * s
return -EFAULT;

if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
- DPRINTK("info.version invalid: %d\n", info2.version);
+ pr_debug("info.version invalid: %d\n", info2.version);
return -EINVAL;
}
info2.mounted_uid = server->m.mounted_uid;
@@ -148,7 +149,7 @@ ncp_get_compat_fs_info_v2(struct ncp_ser
return -EFAULT;

if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
- DPRINTK("info.version invalid: %d\n", info2.version);
+ pr_debug("info.version invalid: %d\n", info2.version);
return -EINVAL;
}
info2.mounted_uid = server->m.mounted_uid;
@@ -320,7 +321,7 @@ int ncp_ioctl(struct inode *inode, struc
else
result = server->reply_size;
ncp_unlock_server(server);
- DPRINTK("ncp_ioctl: copy %d bytes\n",
+ pr_debug("ncp_ioctl: copy %d bytes\n",
result);
if (result >= 0)
if (copy_to_user(request.data, bouncebuffer, result))
@@ -395,9 +396,9 @@ int ncp_ioctl(struct inode *inode, struc
sr.dirEntNum = NCP_FINFO(inode)->dirEntNum;
sr.namespace = server->name_space[sr.volNumber];
} else
- DPRINTK("ncpfs: s_root->d_inode==NULL\n");
+ pr_debug("ncpfs: s_root->d_inode==NULL\n");
} else
- DPRINTK("ncpfs: s_root==NULL\n");
+ pr_debug("ncpfs: s_root==NULL\n");
} else {
sr.volNumber = -1;
sr.namespace = 0;
@@ -445,9 +446,9 @@ int ncp_ioctl(struct inode *inode, struc
NCP_FINFO(inode)->dirEntNum = de;
NCP_FINFO(inode)->DosDirNum = dosde;
} else
- DPRINTK("ncpfs: s_root->d_inode==NULL\n");
+ pr_debug("ncpfs: s_root->d_inode==NULL\n");
} else
- DPRINTK("ncpfs: s_root==NULL\n");
+ pr_debug("ncpfs: s_root==NULL\n");

return 0;
}
Index: linux/fs/ncpfs/mmap.c
===================================================================
--- linux.orig/fs/ncpfs/mmap.c
+++ linux/fs/ncpfs/mmap.c
@@ -108,7 +108,7 @@ int ncp_mmap(struct file *file, struct v
{
struct inode *inode = file->f_path.dentry->d_inode;

- DPRINTK("ncp_mmap: called\n");
+ pr_debug("ncp_mmap: called\n");

if (!ncp_conn_valid(NCP_SERVER(inode)))
return -EIO;
Index: linux/fs/ncpfs/ncplib_kernel.c
===================================================================
--- linux.orig/fs/ncpfs/ncplib_kernel.c
+++ linux/fs/ncpfs/ncplib_kernel.c
@@ -10,13 +10,13 @@
*/


-
+#include <linux/kernel.h>
#include "ncplib_kernel.h"

static inline void assert_server_locked(struct ncp_server *server)
{
if (server->lock == 0) {
- DPRINTK("ncpfs: server not locked!\n");
+ pr_debug("ncpfs: server not locked!\n");
}
}

@@ -75,7 +75,7 @@ static void ncp_add_pstring(struct ncp_s
int len = strlen(s);
assert_server_locked(server);
if (len > 255) {
- DPRINTK("ncpfs: string too long: %s\n", s);
+ pr_debug("ncpfs: string too long: %s\n", s);
len = 255;
}
ncp_add_byte(server, len);
@@ -226,7 +226,7 @@ int ncp_get_volume_info_with_number(stru
result = -EIO;
len = ncp_reply_byte(server, 29);
if (len > NCP_VOLNAME_LEN) {
- DPRINTK("ncpfs: volume name too long: %d\n", len);
+ pr_debug("ncpfs: volume name too long: %d\n", len);
goto out;
}
memcpy(&(target->volume_name), ncp_reply_data(server, 30), len);
@@ -260,7 +260,7 @@ int ncp_get_directory_info(struct ncp_se
result = -EIO;
len = ncp_reply_byte(server, 21);
if (len > NCP_VOLNAME_LEN) {
- DPRINTK("ncpfs: volume name too long: %d\n", len);
+ pr_debug("ncpfs: volume name too long: %d\n", len);
goto out;
}
memcpy(&(target->volume_name), ncp_reply_data(server, 22), len);
@@ -395,7 +395,7 @@ int ncp_obtain_nfs_info(struct ncp_serve

if ((result = ncp_request(server, 87)) == 0) {
ncp_extract_nfs_info(ncp_reply_data(server, 0), &target->nfs);
- DPRINTK(KERN_DEBUG
+ pr_debug(
"ncp_obtain_nfs_info: (%s) mode=0%o, rdev=0x%x\n",
target->entryName, target->nfs.mode,
target->nfs.rdev);
@@ -499,7 +499,7 @@ ncp_get_known_namespace(struct ncp_serve
namespace = ncp_reply_data(server, 2);

while (no_namespaces > 0) {
- DPRINTK("get_namespaces: found %d on %d\n", *namespace, volume);
+ pr_debug("get_namespaces: found %d on %d\n", *namespace, volume);

#ifdef CONFIG_NCPFS_NFS_NS
if ((*namespace == NW_NS_NFS) && !(server->m.flags&NCP_MOUNT_NO_NFS))
@@ -582,7 +582,7 @@ ncp_get_volume_root(struct ncp_server *s
int result;
__u8 volnum;

- DPRINTK("ncp_get_volume_root: looking up vol %s\n", volname);
+ pr_debug("ncp_get_volume_root: looking up vol %s\n", volname);

ncp_init_request(server);
ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */
@@ -608,7 +608,7 @@ ncp_get_volume_root(struct ncp_server *s

server->name_space[volnum] = ncp_get_known_namespace(server, volnum);

- DPRINTK("lookup_vol: namespace[%d] = %d\n",
+ pr_debug("lookup_vol: namespace[%d] = %d\n",
volnum, server->name_space[volnum]);

return 0;
Index: linux/fs/ncpfs/sock.c
===================================================================
--- linux.orig/fs/ncpfs/sock.c
+++ linux/fs/ncpfs/sock.c
@@ -26,6 +26,7 @@
#include <linux/ipx.h>
#include <linux/poll.h>
#include <linux/file.h>
+#include <linux/kernel.h>

#include <linux/ncp_fs.h>

@@ -404,15 +405,15 @@ void ncpdgram_rcv_proc(struct work_struc
}
result = _recv(sock, buf, sizeof(buf), MSG_DONTWAIT);
if (result < 0) {
- DPRINTK("recv failed with %d\n", result);
+ pr_debug("recv failed with %d\n", result);
continue;
}
if (result < 10) {
- DPRINTK("too short (%u) watchdog packet\n", result);
+ pr_debug("too short (%u) watchdog packet\n", result);
continue;
}
if (buf[9] != '?') {
- DPRINTK("bad signature (%02X) in watchdog packet\n", buf[9]);
+ pr_debug("bad signature (%02X) in watchdog packet\n", buf[9]);
continue;
}
buf[9] = 'Y';
@@ -553,7 +554,7 @@ static int __ncptcp_rcv_proc(struct ncp_
if (result < 0) {
printk(KERN_ERR "ncpfs: tcp: error in recvmsg: %d\n", result);
} else {
- DPRINTK(KERN_ERR "ncpfs: tcp: EOF\n");
+ pr_err("ncpfs: tcp: EOF\n");
}
return -EIO;
}
@@ -603,7 +604,7 @@ cont:;
server->rcv.len = datalen - 10;
break;
}
- DPRINTK("ncpfs: tcp: Unexpected NCP type %02X\n", type);
+ pr_debug("ncpfs: tcp: Unexpected NCP type %02X\n", type);
skipdata2:;
server->rcv.state = 2;
skipdata:;
@@ -613,7 +614,7 @@ skipdata:;
}
req = server->rcv.creq;
if (!req) {
- DPRINTK(KERN_ERR "ncpfs: Reply without appropriate request\n");
+ pr_err("ncpfs: Reply without appropriate request\n");
goto skipdata2;
}
if (datalen > req->datalen + 8) {
@@ -781,7 +782,7 @@ static int ncp_do_request(struct ncp_ser
spin_unlock_irqrestore(&current->sighand->siglock, flags);
}

- DDPRINTK("do_ncp_rpc_call returned %d\n", result);
+ pr_debug("do_ncp_rpc_call returned %d\n", result);

return result;
}
@@ -811,7 +812,7 @@ int ncp_request2(struct ncp_server *serv

result = ncp_do_request(server, server->current_size, reply, size);
if (result < 0) {
- DPRINTK("ncp_request_error: %d\n", result);
+ pr_debug("ncp_request_error: %d\n", result);
goto out;
}
server->completion = reply->completion_code;
Index: linux/fs/ncpfs/symlink.c
===================================================================
--- linux.orig/fs/ncpfs/symlink.c
+++ linux/fs/ncpfs/symlink.c
@@ -29,6 +29,7 @@
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/stat.h>
+#include <linux/kernel.h>
#include "ncplib_kernel.h"


@@ -113,7 +114,7 @@ int ncp_symlink(struct inode *dir, struc
__le32 attr;
unsigned int hdr;

- DPRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
+ pr_debug("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);

if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber))
kludge = 0;
Index: linux/include/linux/ncp_fs.h
===================================================================
--- linux.orig/include/linux/ncp_fs.h
+++ linux/include/linux/ncp_fs.h
@@ -160,20 +160,6 @@ struct ncp_nls_ioctl
#define PPRINTK(format, args...)
#endif

-#ifndef DEBUG_NCP
-#define DEBUG_NCP 0
-#endif
-#if DEBUG_NCP > 0
-#define DPRINTK(format, args...) PRINTK(format , ## args)
-#else
-#define DPRINTK(format, args...)
-#endif
-#if DEBUG_NCP > 1
-#define DDPRINTK(format, args...) PRINTK(format , ## args)
-#else
-#define DDPRINTK(format, args...)
-#endif
-
#define NCP_MAX_RPC_TIMEOUT (6*HZ)




2007-06-09 08:19:25

by Jack Stone

[permalink] [raw]
Subject: [PATCH 6/7] Add pr_debug_pid to kernel.h

This patch adds a new function to kernel.h. This function prints out the
pid of the current process and the name of the function where it was
called from followed by the debug message and a newline.

This function mimics the output of autofs4.

Signed-off-by: Jack Stone <[email protected]>
---
Index: linux/include/linux/kernel.h
===================================================================
--- linux.orig/include/linux/kernel.h
+++ linux/include/linux/kernel.h
@@ -228,6 +228,8 @@ extern void print_hex_dump(const char *l
/* If you are writing a driver, please use dev_dbg instead */
#define pr_debug(fmt,arg...) \
printk(KERN_DEBUG fmt,##arg)
+#define pr_debug_pid(fmt,arg...) \
+ printk(KERN_DEBUG "pid %d: %s: " fmt "\n" , current->pid ,
__FUNCTION__, ##args)
#define pr_err(fmt,arg...) \
printk(KERN_ERR fmt,##arg)
#else
@@ -236,6 +238,11 @@ static inline int __attribute__ ((format
return 0;
}

+static inline int __attribute__ ((format (printf, 1, 2)))
pr_debug_pid(const char * fmt, ...)
+{
+ return 0;
+}
+
static inline int __attribute__ ((format (printf, 1, 2))) pr_err(const
char * fmt, ...)
{
return 0;


2007-06-09 08:21:38

by Jack Stone

[permalink] [raw]
Subject: [PATCH 7/7] Replace DPRINTK with pr_debug_pid in autofs4

This patch uses the new pr_debug_pid function to replace DPRINKs in
autofs4 without breaking the functionality.

Signed-off-by: Jack Stone <[email protected]>
---
Index: linux/fs/autofs4/autofs_i.h
===================================================================
--- linux.orig/fs/autofs4/autofs_i.h
+++ linux/fs/autofs4/autofs_i.h
@@ -32,14 +32,6 @@
#include <asm/current.h>
#include <asm/uaccess.h>

-/* #define DEBUG */
-
-#ifdef DEBUG
-#define DPRINTK(fmt,args...) do { pr_debug("pid %d: %s: " fmt "\n" ,
current->pid , __FUNCTION__ , ##args); } while(0)
-#else
-#define DPRINTK(fmt,args...) do {} while(0)
-#endif
-
/* Unified info structure. This is pointed to by both the dentry and
inode structures. Each file in the filesystem has an instance of this
structure. It holds a reference to the dentry, so dentries are never
Index: linux/fs/autofs4/expire.c
===================================================================
--- linux.orig/fs/autofs4/expire.c
+++ linux/fs/autofs4/expire.c
@@ -50,7 +50,7 @@ static int autofs4_mount_busy(struct vfs
struct dentry *top = dentry;
int status = 1;

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);

mntget(mnt);
@@ -72,7 +72,7 @@ static int autofs4_mount_busy(struct vfs

status = 0;
done:
- DPRINTK("returning = %d", status);
+ pr_debug_pid("returning = %d", status);
mntput(mnt);
dput(dentry);
return status;
@@ -110,7 +110,7 @@ static int autofs4_direct_busy(struct vf
unsigned long timeout,
int do_now)
{
- DPRINTK("top %p %.*s",
+ pr_debug_pid("top %p %.*s",
top, (int) top->d_name.len, top->d_name.name);

/* If it's busy update the expiry counters */
@@ -139,7 +139,7 @@ static int autofs4_tree_busy(struct vfsm
struct autofs_info *top_ino = autofs4_dentry_ino(top);
struct dentry *p;

- DPRINTK("top %p %.*s",
+ pr_debug_pid("top %p %.*s",
top, (int)top->d_name.len, top->d_name.name);

/* Negative dentry - give up */
@@ -152,7 +152,7 @@ static int autofs4_tree_busy(struct vfsm
if (!simple_positive(p))
continue;

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
p, (int) p->d_name.len, p->d_name.name);

p = dget(p);
@@ -211,7 +211,7 @@ static struct dentry *autofs4_check_leav
{
struct dentry *p;

- DPRINTK("parent %p %.*s",
+ pr_debug_pid("parent %p %.*s",
parent, (int)parent->d_name.len, parent->d_name.name);

spin_lock(&dcache_lock);
@@ -220,7 +220,7 @@ static struct dentry *autofs4_check_leav
if (!simple_positive(p))
continue;

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
p, (int) p->d_name.len, p->d_name.name);

p = dget(p);
@@ -323,7 +323,7 @@ static struct dentry *autofs4_expire_ind
* offset (autofs-5.0+).
*/
if (d_mountpoint(dentry)) {
- DPRINTK("checking mountpoint %p %.*s",
+ pr_debug_pid("checking mountpoint %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);

/* Can we umount this guy */
@@ -373,7 +373,7 @@ next:
}

if (expired) {
- DPRINTK("returning %p %.*s",
+ pr_debug_pid("returning %p %.*s",
expired, (int)expired->d_name.len, expired->d_name.name);
spin_lock(&dcache_lock);
list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child);
Index: linux/fs/autofs4/inode.c
===================================================================
--- linux.orig/fs/autofs4/inode.c
+++ linux/fs/autofs4/inode.c
@@ -124,7 +124,7 @@ resume:
next = next->next;
spin_unlock(&dcache_lock);

- DPRINTK("dentry %p %.*s",
+ pr_debug_pid("dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);

dput(dentry);
@@ -137,7 +137,7 @@ resume:
next = this_parent->d_u.d_child.next;
this_parent = this_parent->d_parent;
spin_unlock(&dcache_lock);
- DPRINTK("parent dentry %p %.*s",
+ pr_debug_pid("parent dentry %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);
dput(dentry);
spin_lock(&dcache_lock);
@@ -169,7 +169,7 @@ void autofs4_kill_sb(struct super_block
kfree(sbi);

out_kill_sb:
- DPRINTK("shutting down");
+ pr_debug_pid("shutting down");
kill_anon_super(sb);
}

@@ -315,7 +315,7 @@ int autofs4_fill_super(struct super_bloc
sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
goto fail_unlock;
- DPRINTK("starting up, sbi = %p",sbi);
+ pr_debug_pid("starting up, sbi = %p",sbi);

memset(sbi, 0, sizeof(*sbi));

@@ -391,7 +391,7 @@ int autofs4_fill_super(struct super_bloc
sbi->version = sbi->max_proto;
sbi->sub_version = AUTOFS_PROTO_SUBVERSION;

- DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
+ pr_debug_pid("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
pipe = fget(pipefd);

if (!pipe) {
Index: linux/fs/autofs4/root.c
===================================================================
--- linux.orig/fs/autofs4/root.c
+++ linux/fs/autofs4/root.c
@@ -76,7 +76,7 @@ static int autofs4_root_readdir(struct f
struct autofs_sb_info *sbi = autofs4_sbi(file->f_path.dentry->d_sb);
int oz_mode = autofs4_oz_mode(sbi);

- DPRINTK("called, filp->f_pos = %lld", file->f_pos);
+ pr_debug_pid("called, filp->f_pos = %lld", file->f_pos);

/*
* Don't set reghost flag if:
@@ -87,7 +87,7 @@ static int autofs4_root_readdir(struct f
if (oz_mode && file->f_pos == 0 && sbi->reghost_enabled)
sbi->needs_reghost = 1;

- DPRINTK("needs_reghost = %d", sbi->needs_reghost);
+ pr_debug_pid("needs_reghost = %d", sbi->needs_reghost);

return dcache_readdir(file, dirent, filldir);
}
@@ -107,14 +107,14 @@ static int autofs4_dir_open(struct inode
cursor = file->private_data;
cursor->d_fsdata = NULL;

- DPRINTK("file=%p dentry=%p %.*s",
+ pr_debug_pid("file=%p dentry=%p %.*s",
file, dentry, dentry->d_name.len, dentry->d_name.name);

if (autofs4_oz_mode(sbi))
goto out;

if (autofs4_ispending(dentry)) {
- DPRINTK("dentry busy");
+ pr_debug_pid("dentry busy");
dcache_dir_close(inode, file);
status = -EBUSY;
goto out;
@@ -176,14 +176,14 @@ static int autofs4_dir_close(struct inod
struct dentry *cursor = file->private_data;
int status = 0;

- DPRINTK("file=%p dentry=%p %.*s",
+ pr_debug_pid("file=%p dentry=%p %.*s",
file, dentry, dentry->d_name.len, dentry->d_name.name);

if (autofs4_oz_mode(sbi))
goto out;

if (autofs4_ispending(dentry)) {
- DPRINTK("dentry busy");
+ pr_debug_pid("dentry busy");
status = -EBUSY;
goto out;
}
@@ -208,14 +208,14 @@ static int autofs4_dir_readdir(struct fi
struct dentry *cursor = file->private_data;
int status;

- DPRINTK("file=%p dentry=%p %.*s",
+ pr_debug_pid("file=%p dentry=%p %.*s",
file, dentry, dentry->d_name.len, dentry->d_name.name);

if (autofs4_oz_mode(sbi))
goto out;

if (autofs4_ispending(dentry)) {
- DPRINTK("dentry busy");
+ pr_debug_pid("dentry busy");
return -EBUSY;
}

@@ -248,12 +248,12 @@ static int try_to_fill_dentry(struct den
when expiration is done to trigger mount request with a new
dentry */
if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
- DPRINTK("waiting for expire %p name=%.*s",
+ pr_debug_pid("waiting for expire %p name=%.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

status = autofs4_wait(sbi, dentry, NFY_NONE);

- DPRINTK("expire done status=%d", status);
+ pr_debug_pid("expire done status=%d", status);

/*
* If the directory still exists the mount request must
@@ -265,7 +265,7 @@ static int try_to_fill_dentry(struct den
return -EAGAIN;
}

- DPRINTK("dentry=%p %.*s ino=%p",
+ pr_debug_pid("dentry=%p %.*s ino=%p",
dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode);

/*
@@ -273,12 +273,12 @@ static int try_to_fill_dentry(struct den
* isn't one already
*/
if (dentry->d_inode == NULL) {
- DPRINTK("waiting for mount name=%.*s",
+ pr_debug_pid("waiting for mount name=%.*s",
dentry->d_name.len, dentry->d_name.name);

status = autofs4_wait(sbi, dentry, NFY_MOUNT);

- DPRINTK("mount done status=%d", status);
+ pr_debug_pid("mount done status=%d", status);

/* Turn this into a real negative dentry? */
if (status == -ENOENT) {
@@ -293,7 +293,7 @@ static int try_to_fill_dentry(struct den
/* Trigger mount for path component or follow link */
} else if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY) ||
current->link_count) {
- DPRINTK("waiting for mount name=%.*s",
+ pr_debug_pid("waiting for mount name=%.*s",
dentry->d_name.len, dentry->d_name.name);

spin_lock(&dentry->d_lock);
@@ -301,7 +301,7 @@ static int try_to_fill_dentry(struct den
spin_unlock(&dentry->d_lock);
status = autofs4_wait(sbi, dentry, NFY_MOUNT);

- DPRINTK("mount done status=%d", status);
+ pr_debug_pid("mount done status=%d", status);

if (status) {
spin_lock(&dentry->d_lock);
@@ -330,7 +330,7 @@ static void *autofs4_follow_link(struct
unsigned int lookup_type;
int status;

- DPRINTK("dentry=%p %.*s oz_mode=%d nd->flags=%d",
+ pr_debug_pid("dentry=%p %.*s oz_mode=%d nd->flags=%d",
dentry, dentry->d_name.len, dentry->d_name.name, oz_mode,
nd->flags);

@@ -341,12 +341,12 @@ static void *autofs4_follow_link(struct

/* If an expire request is pending wait for it. */
if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
- DPRINTK("waiting for active request %p name=%.*s",
+ pr_debug_pid("waiting for active request %p name=%.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

status = autofs4_wait(sbi, dentry, NFY_NONE);

- DPRINTK("request done status=%d", status);
+ pr_debug_pid("request done status=%d", status);
}

/*
@@ -435,7 +435,7 @@ static int autofs4_revalidate(struct den
if (S_ISDIR(dentry->d_inode->i_mode) &&
!d_mountpoint(dentry) &&
__simple_empty(dentry)) {
- DPRINTK("dentry=%p %.*s, emptydir",
+ pr_debug_pid("dentry=%p %.*s, emptydir",
dentry, dentry->d_name.len, dentry->d_name.name);
spin_unlock(&dcache_lock);
/* The daemon never causes a mount to trigger */
@@ -461,7 +461,7 @@ void autofs4_dentry_release(struct dentr
{
struct autofs_info *inf;

- DPRINTK("releasing %p", de);
+ pr_debug_pid("releasing %p", de);

inf = autofs4_dentry_ino(de);
de->d_fsdata = NULL;
@@ -571,7 +571,7 @@ static struct dentry *autofs4_lookup(str
struct dentry *unhashed;
int oz_mode;

- DPRINTK("name = %.*s",
+ pr_debug_pid("name = %.*s",
dentry->d_name.len, dentry->d_name.name);

/* File name too long to exist */
@@ -581,7 +581,7 @@ static struct dentry *autofs4_lookup(str
sbi = autofs4_sbi(dir->i_sb);
oz_mode = autofs4_oz_mode(sbi);

- DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
+ pr_debug_pid("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
current->pid, process_group(current), sbi->catatonic, oz_mode);

unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent,
&dentry->d_name);
@@ -602,18 +602,18 @@ static struct dentry *autofs4_lookup(str
d_add(dentry, NULL);
} else {
struct autofs_info *ino = autofs4_dentry_ino(unhashed);
- DPRINTK("rehash %p with %p", dentry, unhashed);
+ pr_debug_pid("rehash %p with %p", dentry, unhashed);
/*
* If we are racing with expire the request might not
* be quite complete but the directory has been removed
* so it must have been successful, so just wait for it.
*/
if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
- DPRINTK("wait for incomplete expire %p name=%.*s",
+ pr_debug_pid("wait for incomplete expire %p name=%.*s",
unhashed, unhashed->d_name.len,
unhashed->d_name.name);
autofs4_wait(sbi, unhashed, NFY_NONE);
- DPRINTK("request completed");
+ pr_debug_pid("request completed");
}
d_rehash(unhashed);
dentry = unhashed;
@@ -695,7 +695,7 @@ static int autofs4_dir_symlink(struct in
struct inode *inode;
char *cp;

- DPRINTK("%s <- %.*s", symname,
+ pr_debug_pid("%s <- %.*s", symname,
dentry->d_name.len, dentry->d_name.name);

if (!autofs4_oz_mode(sbi))
@@ -792,7 +792,7 @@ static int autofs4_dir_rmdir(struct inod
struct autofs_info *ino = autofs4_dentry_ino(dentry);
struct autofs_info *p_ino;

- DPRINTK("dentry %p, removing %.*s",
+ pr_debug_pid("dentry %p, removing %.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

if (!autofs4_oz_mode(sbi))
@@ -836,7 +836,7 @@ static int autofs4_dir_mkdir(struct inod
if (!autofs4_oz_mode(sbi))
return -EACCES;

- DPRINTK("dentry %p, creating %.*s",
+ pr_debug_pid("dentry %p, creating %.*s",
dentry, dentry->d_name.len, dentry->d_name.name);

ino = autofs4_init_ino(ino, sbi, S_IFDIR | 0555);
@@ -903,7 +903,7 @@ static inline int autofs4_ask_reghost(st
{
int status;

- DPRINTK("returning %d", sbi->needs_reghost);
+ pr_debug_pid("returning %d", sbi->needs_reghost);

status = put_user(sbi->needs_reghost, p);
if (status)
@@ -923,7 +923,7 @@ static inline int autofs4_toggle_reghost

status = get_user(val, p);

- DPRINTK("reghost = %d", val);
+ pr_debug_pid("reghost = %d", val);

if (status)
return status;
@@ -943,7 +943,7 @@ static inline int autofs4_ask_umount(str
if (may_umount(mnt))
status = 1;

- DPRINTK("returning %d", status);
+ pr_debug_pid("returning %d", status);

status = put_user(status, p);

@@ -972,7 +972,7 @@ static int autofs4_root_ioctl(struct ino
struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
void __user *p = (void __user *)arg;

- DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
+ pr_debug_pid("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
cmd,arg,sbi,process_group(current));

if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
Index: linux/fs/autofs4/waitq.c
===================================================================
--- linux.orig/fs/autofs4/waitq.c
+++ linux/fs/autofs4/waitq.c
@@ -28,7 +28,7 @@ void autofs4_catatonic_mode(struct autof
{
struct autofs_wait_queue *wq, *nwq;

- DPRINTK("entering catatonic mode");
+ pr_debug_pid("entering catatonic mode");

sbi->catatonic = 1;
wq = sbi->queues;
@@ -91,7 +91,7 @@ static void autofs4_notify_daemon(struct
} pkt;
size_t pktsz;

- DPRINTK("wait id = 0x%08lx, name = %.*s, type=%d",
+ pr_debug_pid("wait id = 0x%08lx, name = %.*s, type=%d",
wq->wait_queue_token, wq->len, wq->name, type);

memset(&pkt,0,sizeof pkt); /* For security reasons */
@@ -318,7 +318,7 @@ int autofs4_wait(struct autofs_sb_info *
autofs_ptype_expire_indirect;
}

- DPRINTK("new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
+ pr_debug_pid("new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);

/* autofs4_notify_daemon() may block */
@@ -327,7 +327,7 @@ int autofs4_wait(struct autofs_sb_info *
atomic_inc(&wq->wait_ctr);
mutex_unlock(&sbi->wq_mutex);
kfree(name);
- DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
+ pr_debug_pid("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
}

@@ -358,7 +358,7 @@ int autofs4_wait(struct autofs_sb_info *
recalc_sigpending();
spin_unlock_irqrestore(&current->sighand->siglock, irqflags);
} else {
- DPRINTK("skipped sleeping");
+ pr_debug_pid("skipped sleeping");
}

status = wq->status;


2007-06-09 17:59:14

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH 2/7] Replace DPRINTK with pr_debug in alternative.c

On Sat, Jun 09, 2007 at 09:08:46AM +0100, Jack Stone wrote:
> This patch converts all DPRINTKs in alternative.c to pr_debug

, rendering "debug-alternative" option useless.

> --- linux/arch/i386/kernel/alternative.c
> +++ linux/arch/i386/kernel/alternative.c
> @@ -1,3 +1,4 @@
> +#include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/sched.h>
> #include <linux/spinlock.h>
> @@ -41,9 +42,6 @@
> __setup("noreplace-paravirt", setup_noreplace_paravirt);
> #endif
>
> -#define DPRINTK(fmt, args...) if (debug_alternative) \
> - printk(KERN_DEBUG fmt, args)
> -
> #ifdef GENERIC_NOP1
> /* Use inline assembly to define this because the nops are defined
> as inline assembly strings in the include files and we cannot
> @@ -165,7 +163,7 @@
> u8 *instr;
> int diff;
>
> - DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
> + pr_debug("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
> for (a = start; a < end; a++) {
> BUG_ON(a->replacementlen > a->instrlen);
> if (!boot_cpu_has(a->cpuid))
> @@ -175,7 +173,7 @@
> /* vsyscall code is not mapped yet. resolve it manually. */
> if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) {
> instr = __va(instr - (u8*)VSYSCALL_START +
> (u8*)__pa_symbol(&__vsyscall_0));
> - DPRINTK("%s: vsyscall fixup: %p => %p\n",
> + pr_debug("%s: vsyscall fixup: %p => %p\n",
> __FUNCTION__, a->instr, instr);
> }
> #endif
> @@ -261,7 +259,7 @@
> smp->locks_end = locks_end;
> smp->text = text;
> smp->text_end = text_end;
> - DPRINTK("%s: locks %p -> %p, text %p -> %p, name %s\n",
> + pr_debug("%s: locks %p -> %p, text %p -> %p, name %s\n",
> __FUNCTION__, smp->locks, smp->locks_end,
> smp->text, smp->text_end, smp->name);
>
> @@ -287,7 +285,7 @@
> continue;
> list_del(&item->next);
> spin_unlock_irqrestore(&smp_alt, flags);
> - DPRINTK("%s: %s\n", __FUNCTION__, item->name);
> + pr_debug("%s: %s\n", __FUNCTION__, item->name);

2007-06-09 18:02:08

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH 6/7] Add pr_debug_pid to kernel.h

On Sat, Jun 09, 2007 at 09:18:36AM +0100, Jack Stone wrote:
> This patch adds a new function to kernel.h. This function prints out the
> pid of the current process and the name of the function where it was
> called from followed by the debug message and a newline.

NO! We don't add macros for every debug format people use into core
headers. I think you should stop after pr_err().

> --- linux.orig/include/linux/kernel.h
> +++ linux/include/linux/kernel.h
> @@ -228,6 +228,8 @@ extern void print_hex_dump(const char *l
> /* If you are writing a driver, please use dev_dbg instead */
> #define pr_debug(fmt,arg...) \
> printk(KERN_DEBUG fmt,##arg)
> +#define pr_debug_pid(fmt,arg...) \
> + printk(KERN_DEBUG "pid %d: %s: " fmt "\n" , current->pid ,
> __FUNCTION__, ##args)
> #define pr_err(fmt,arg...) \
> printk(KERN_ERR fmt,##arg)
> #else
> @@ -236,6 +238,11 @@ static inline int __attribute__ ((format
> return 0;
> }
>
> +static inline int __attribute__ ((format (printf, 1, 2)))
> pr_debug_pid(const char * fmt, ...)
> +{
> + return 0;
> +}

2007-06-09 18:05:13

by Jack Stone

[permalink] [raw]
Subject: Re: [PATCH 6/7] Add pr_debug_pid to kernel.h

Alexey Dobriyan wrote:
> NO! We don't add macros for every debug format people use into core
> headers. I think you should stop after pr_err().

That was what I though would be the answer which is why i did this
change in the last set of patches.

Jack

2007-06-09 18:06:16

by Jack Stone

[permalink] [raw]
Subject: Re: [PATCH 2/7] Replace DPRINTK with pr_debug in alternative.c

Alexey Dobriyan wrote:
> , rendering "debug-alternative" option useless.

So drop the patch entirely or change the DPRINTK macro to use pr_debug?

Jack

2007-06-10 17:49:56

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 0/7] Cleanup code to replace DPRINTK with pr_debug

On Fri, 08 Jun 2007 23:18:31 +0100 Jack Stone wrote:

> This patch series replaces DPRINTK with pr_debug in alternative.c,
> autofs, autofs4
> and ncpfs. A new function called pr_err is also added to keep
> functionality in
> ncpfs. The last 2 patches add support for pr_debug_pid and apply it to
> autofs4 to
> keep the output the same as the current DPRINTK statements.
>
> All patches have been compile tested but not boot tested

Hi,

Doesn't this move printk-debug control from local source files
(i.e., targeted, specific ones) to a more global control (DEBUG)?

If so, I don't see that as a generally good thing.

If not, please correct me and tell me how this is useful to just
one instance of using pr_debug() in say, ncpfs, without pr_debug()
being enabled throughout the entire kernel tree.

Thanks.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

2007-06-10 19:29:47

by Jack Stone

[permalink] [raw]
Subject: Re: [PATCH 0/7] Cleanup code to replace DPRINTK with pr_debug

Randy Dunlap wrote:
> Hi,
>
> Doesn't this move printk-debug control from local source files
> (i.e., targeted, specific ones) to a more global control (DEBUG)?
>
> If so, I don't see that as a generally good thing.
>
> If not, please correct me and tell me how this is useful to just
> one instance of using pr_debug() in say, ncpfs, without pr_debug()
> being enabled throughout the entire kernel tree.
>
> Thanks.

I can certainly see that point but using pr_debug means that all the
debug print statements are centralised so that changes to the format
could be more uniform. For example, it would be very easy to change the
macro to print the function name it was called from followed by the message.

The only DPRINTK's with specific DEBUGs were alternative.c, which had an
extra if, and ncpfs which had an extra #ifdef DEBUG_NCP. The alternative
solution would be to change the #defines to use pr_debug rather than
printk directly:

#define DPRINTK(format, args...) \
pr_debug(format, ##args);

The advantage would be maitaining subsystem specific debug control with
centralised format control.

Jack

2007-06-11 04:35:19

by Ian Kent

[permalink] [raw]
Subject: Re: [PATCH 1/7] Add a new debug function to kernel.h

On Sat, 2007-06-09 at 09:06 +0100, Jack Stone wrote:
> This patch adds a new macro to print to KERN_ERR initially for ncp but
> others may want to use it

Yes, the patch set takes away local control of debug printing that I may
need to turn on for the module without re-compiling the kernel.

>
> Signed-off-by: Jack Stone <[email protected]>
> ---
> Index: linux/include/linux/kernel.h
> ===================================================================
> --- linux.orig/include/linux/kernel.h
> +++ linux/include/linux/kernel.h
> @@ -228,11 +228,18 @@ extern void print_hex_dump(const char *l
> /* If you are writing a driver, please use dev_dbg instead */
> #define pr_debug(fmt,arg...) \
> printk(KERN_DEBUG fmt,##arg)
> +#define pr_err(fmt,arg...) \
> + printk(KERN_ERR fmt,##arg)
> #else
> static inline int __attribute__ ((format (printf, 1, 2)))
> pr_debug(const char * fmt, ...)
> {
> return 0;
> }
> +
> +static inline int __attribute__ ((format (printf, 1, 2))) pr_err(const
> char * fmt, ...)
> +{
> + return 0;
> +}
> #endif
>
> #define pr_info(fmt,arg...) \
>
>