Use helpers to obtain task pid in printks

The task_struct->pid member is going to be deprecated, so start
using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
the kernel.

The first thing to start with is the pid, printed to dmesg - in
this case we may safely use task_pid_nr(). Besides, printks produce
more (much more) than a half of all the explicit pid usage.

[akpm@linux-foundation.org: git-drm went and changed lots of stuff]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Pavel Emelyanov
2007-10-18 23:40:40 -07:00
committed by Linus Torvalds
parent 9a2e70572e
commit ba25f9dcc4
47 changed files with 97 additions and 90 deletions
+1 -1
View File
@@ -3367,7 +3367,7 @@ void submit_bio(int rw, struct bio *bio)
if (unlikely(block_dump)) { if (unlikely(block_dump)) {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n", printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
current->comm, current->pid, current->comm, task_pid_nr(current),
(rw & WRITE) ? "WRITE" : "READ", (rw & WRITE) ? "WRITE" : "READ",
(unsigned long long)bio->bi_sector, (unsigned long long)bio->bi_sector,
bdevname(bio->bi_bdev,b)); bdevname(bio->bi_bdev,b));
+1 -1
View File
@@ -188,7 +188,7 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
if (signal_pending(current)) { if (signal_pending(current)) {
siginfo_t info; siginfo_t info;
printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n", printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n",
current->pid, current->comm, task_pid_nr(current), current->comm,
dequeue_signal_lock(current, &current->blocked, &info)); dequeue_signal_lock(current, &current->blocked, &info));
result = -EINTR; result = -EINTR;
sock_shutdown(lo, !send); sock_shutdown(lo, !send);
+1 -1
View File
@@ -1107,7 +1107,7 @@ int open_for_data(struct cdrom_device_info * cdi)
is the default case! */ is the default case! */
cdinfo(CD_OPEN, "bummer. wrong media type.\n"); cdinfo(CD_OPEN, "bummer. wrong media type.\n");
cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n", cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n",
(unsigned int)current->pid); (unsigned int)task_pid_nr(current));
ret=-EMEDIUMTYPE; ret=-EMEDIUMTYPE;
goto clean_up_and_return; goto clean_up_and_return;
} }
+1 -1
View File
@@ -1456,7 +1456,7 @@ int drm_freebufs(struct drm_device *dev, void *data,
buf = dma->buflist[idx]; buf = dma->buflist[idx];
if (buf->file_priv != file_priv) { if (buf->file_priv != file_priv) {
DRM_ERROR("Process %d freeing buffer not owned\n", DRM_ERROR("Process %d freeing buffer not owned\n",
current->pid); task_pid_nr(current));
return -EINVAL; return -EINVAL;
} }
drm_free_buffer(dev, buf); drm_free_buffer(dev, buf);
+1 -1
View File
@@ -463,7 +463,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
++file_priv->ioctl_count; ++file_priv->ioctl_count;
DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
current->pid, cmd, nr, task_pid_nr(current), cmd, nr,
(long)old_encode_dev(file_priv->head->device), (long)old_encode_dev(file_priv->head->device),
file_priv->authenticated); file_priv->authenticated);
+4 -3
View File
@@ -234,7 +234,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
if (!drm_cpu_valid()) if (!drm_cpu_valid())
return -EINVAL; return -EINVAL;
DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor);
priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES);
if (!priv) if (!priv)
@@ -244,7 +244,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
filp->private_data = priv; filp->private_data = priv;
priv->filp = filp; priv->filp = filp;
priv->uid = current->euid; priv->uid = current->euid;
priv->pid = current->pid; priv->pid = task_pid_nr(current);
priv->minor = minor; priv->minor = minor;
priv->head = drm_heads[minor]; priv->head = drm_heads[minor];
priv->ioctl_count = 0; priv->ioctl_count = 0;
@@ -339,7 +339,8 @@ int drm_release(struct inode *inode, struct file *filp)
*/ */
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
current->pid, (long)old_encode_dev(file_priv->head->device), task_pid_nr(current),
(long)old_encode_dev(file_priv->head->device),
dev->open_count); dev->open_count);
if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) { if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
+3 -3
View File
@@ -58,12 +58,12 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
if (lock->context == DRM_KERNEL_CONTEXT) { if (lock->context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n", DRM_ERROR("Process %d using kernel context %d\n",
current->pid, lock->context); task_pid_nr(current), lock->context);
return -EINVAL; return -EINVAL;
} }
DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
lock->context, current->pid, lock->context, task_pid_nr(current),
dev->lock.hw_lock->lock, lock->flags); dev->lock.hw_lock->lock, lock->flags);
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)) if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
@@ -153,7 +153,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
if (lock->context == DRM_KERNEL_CONTEXT) { if (lock->context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n", DRM_ERROR("Process %d using kernel context %d\n",
current->pid, lock->context); task_pid_nr(current), lock->context);
return -EINVAL; return -EINVAL;
} }
+1 -1
View File
@@ -7,7 +7,7 @@
#include <linux/delay.h> #include <linux/delay.h>
/** Current process ID */ /** Current process ID */
#define DRM_CURRENTPID current->pid #define DRM_CURRENTPID task_pid_nr(current)
#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) #define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
#define DRM_UDELAY(d) udelay(d) #define DRM_UDELAY(d) udelay(d)
/** Read a byte from a MMIO region */ /** Read a byte from a MMIO region */
+1 -1
View File
@@ -1024,7 +1024,7 @@ static int i810_getbuf(struct drm_device *dev, void *data,
retcode = i810_dma_get_buffer(dev, d, file_priv); retcode = i810_dma_get_buffer(dev, d, file_priv);
DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n",
current->pid, retcode, d->granted); task_pid_nr(current), retcode, d->granted);
sarea_priv->last_dispatch = (int)hw_status[5]; sarea_priv->last_dispatch = (int)hw_status[5];
+1 -1
View File
@@ -1409,7 +1409,7 @@ static int i830_getbuf(struct drm_device *dev, void *data,
retcode = i830_dma_get_buffer(dev, d, file_priv); retcode = i830_dma_get_buffer(dev, d, file_priv);
DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n",
current->pid, retcode, d->granted); task_pid_nr(current), retcode, d->granted);
sarea_priv->last_dispatch = (int)hw_status[5]; sarea_priv->last_dispatch = (int)hw_status[5];
+1 -1
View File
@@ -1467,7 +1467,7 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
line = tty->index; line = tty->index;
sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, " sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, "
"np=%d)\n", current->pid, line, tty, "np=%d)\n", task_pid_nr(current), line, tty,
current->signal->tty, sx_nports); current->signal->tty, sx_nports);
if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports)) if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports))
+3 -3
View File
@@ -3530,7 +3530,7 @@ void __do_SAK(struct tty_struct *tty)
do_each_pid_task(session, PIDTYPE_SID, p) { do_each_pid_task(session, PIDTYPE_SID, p) {
printk(KERN_NOTICE "SAK: killed process %d" printk(KERN_NOTICE "SAK: killed process %d"
" (%s): task_session_nr(p)==tty->session\n", " (%s): task_session_nr(p)==tty->session\n",
p->pid, p->comm); task_pid_nr(p), p->comm);
send_sig(SIGKILL, p, 1); send_sig(SIGKILL, p, 1);
} while_each_pid_task(session, PIDTYPE_SID, p); } while_each_pid_task(session, PIDTYPE_SID, p);
/* Now kill any processes that happen to have the /* Now kill any processes that happen to have the
@@ -3540,7 +3540,7 @@ void __do_SAK(struct tty_struct *tty)
if (p->signal->tty == tty) { if (p->signal->tty == tty) {
printk(KERN_NOTICE "SAK: killed process %d" printk(KERN_NOTICE "SAK: killed process %d"
" (%s): task_session_nr(p)==tty->session\n", " (%s): task_session_nr(p)==tty->session\n",
p->pid, p->comm); task_pid_nr(p), p->comm);
send_sig(SIGKILL, p, 1); send_sig(SIGKILL, p, 1);
continue; continue;
} }
@@ -3560,7 +3560,7 @@ void __do_SAK(struct tty_struct *tty)
filp->private_data == tty) { filp->private_data == tty) {
printk(KERN_NOTICE "SAK: killed process %d" printk(KERN_NOTICE "SAK: killed process %d"
" (%s): fd#%d opened to the tty\n", " (%s): fd#%d opened to the tty\n",
p->pid, p->comm, i); task_pid_nr(p), p->comm, i);
force_sig(SIGKILL, p); force_sig(SIGKILL, p);
break; break;
} }
+2 -2
View File
@@ -113,13 +113,13 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
if (count > HID_MIN_BUFFER_SIZE) { if (count > HID_MIN_BUFFER_SIZE) {
printk(KERN_WARNING "hidraw: pid %d passed too large report\n", printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
current->pid); task_pid_nr(current));
return -EINVAL; return -EINVAL;
} }
if (count < 2) { if (count < 2) {
printk(KERN_WARNING "hidraw: pid %d passed too short report\n", printk(KERN_WARNING "hidraw: pid %d passed too short report\n",
current->pid); task_pid_nr(current));
return -EINVAL; return -EINVAL;
} }
+1 -1
View File
@@ -4717,7 +4717,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
void md_unregister_thread(mdk_thread_t *thread) void md_unregister_thread(mdk_thread_t *thread)
{ {
dprintk("interrupting MD-thread pid %d\n", thread->tsk->pid); dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
kthread_stop(thread->tsk); kthread_stop(thread->tsk);
kfree(thread); kfree(thread);
+2 -2
View File
@@ -1285,7 +1285,7 @@ zoran_open (struct inode *inode,
} }
dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n", dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n",
ZR_DEVNAME(zr), current->comm, current->pid, zr->user); ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
/* now, create the open()-specific file_ops struct */ /* now, create the open()-specific file_ops struct */
fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL); fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);
@@ -1358,7 +1358,7 @@ zoran_close (struct inode *inode,
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n", dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n",
ZR_DEVNAME(zr), current->comm, current->pid, zr->user); ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
/* kernel locks (fs/device.c), so don't do that ourselves /* kernel locks (fs/device.c), so don't do that ourselves
* (prevents deadlocks) */ * (prevents deadlocks) */
+1 -1
View File
@@ -1309,7 +1309,7 @@ static int ubi_thread(void *u)
struct ubi_device *ubi = u; struct ubi_device *ubi = u;
ubi_msg("background thread \"%s\" started, PID %d", ubi_msg("background thread \"%s\" started, PID %d",
ubi->bgt_name, current->pid); ubi->bgt_name, task_pid_nr(current));
set_freezable(); set_freezable();
for (;;) { for (;;) {
+1 -1
View File
@@ -2920,7 +2920,7 @@ static int prism2_ioctl_priv_monitor(struct net_device *dev, int *i)
printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor " printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor "
"- update software to use iwconfig mode monitor\n", "- update software to use iwconfig mode monitor\n",
dev->name, current->pid, current->comm); dev->name, task_pid_nr(current), current->comm);
/* Backward compatibility code - this can be removed at some point */ /* Backward compatibility code - this can be removed at some point */
+4 -4
View File
@@ -285,7 +285,7 @@ static void sas_discover_domain(struct work_struct *work)
dev = port->port_dev; dev = port->port_dev;
SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id,
current->pid); task_pid_nr(current));
switch (dev->dev_type) { switch (dev->dev_type) {
case SAS_END_DEV: case SAS_END_DEV:
@@ -320,7 +320,7 @@ static void sas_discover_domain(struct work_struct *work)
} }
SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id, SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id,
current->pid, error); task_pid_nr(current), error);
} }
static void sas_revalidate_domain(struct work_struct *work) static void sas_revalidate_domain(struct work_struct *work)
@@ -334,12 +334,12 @@ static void sas_revalidate_domain(struct work_struct *work)
&port->disc.pending); &port->disc.pending);
SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id,
current->pid); task_pid_nr(current));
if (port->port_dev) if (port->port_dev)
res = sas_ex_revalidate_domain(port->port_dev); res = sas_ex_revalidate_domain(port->port_dev);
SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
port->id, current->pid, res); port->id, task_pid_nr(current), res);
} }
/* ---------- Events ---------- */ /* ---------- Events ---------- */
+1 -1
View File
@@ -460,7 +460,7 @@ static int checkintf(struct dev_state *ps, unsigned int ifnum)
return 0; return 0;
/* if not yet claimed, claim it for the driver */ /* if not yet claimed, claim it for the driver */
dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n", dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
current->pid, current->comm, ifnum); task_pid_nr(current), current->comm, ifnum);
return claimintf(ps, ifnum); return claimintf(ps, ifnum);
} }
+1 -1
View File
@@ -4006,7 +4006,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
DBG(fsg, "removable=%d, stall=%d, buflen=%u\n", DBG(fsg, "removable=%d, stall=%d, buflen=%u\n",
mod_data.removable, mod_data.can_stall, mod_data.removable, mod_data.can_stall,
mod_data.buflen); mod_data.buflen);
DBG(fsg, "I/O thread pid: %d\n", fsg->thread_task->pid); DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task));
set_bit(REGISTERED, &fsg->atomic_bitflags); set_bit(REGISTERED, &fsg->atomic_bitflags);

Some files were not shown because too many files have changed in this diff Show More