[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] scsiif: simplify kthread name generation


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Tue, 02 Jun 2015 14:22:03 +0000
  • Delivery-date: Tue, 02 Jun 2015 14:22:11 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1433254152 -7200
# Node ID 62922fbe9fe2ceb749413dfccb4645d2c83bf69b
# Parent  aba765eb6c4449c1d8763071e63555f12c0a5d71
scsiif: simplify kthread name generation

kthread_run() taking a format string it can quite well do all the
formatting itself.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r aba765eb6c44 -r 62922fbe9fe2 drivers/xen/scsiback/xenbus.c
--- a/drivers/xen/scsiback/xenbus.c     Tue Jun 02 16:07:39 2015 +0200
+++ b/drivers/xen/scsiback/xenbus.c     Tue Jun 02 16:09:12 2015 +0200
@@ -46,23 +46,11 @@ struct backend_info
 };
 
 
-static int __vscsiif_name(struct backend_info *be, char *buf)
-{
-       struct xenbus_device *dev = be->dev;
-       unsigned int domid, id;
-
-       sscanf(dev->nodename, "backend/vscsi/%u/%u", &domid, &id);
-       snprintf(buf, TASK_COMM_LEN, "vscsi.%u.%u", be->info->domid, id);
-
-       return 0;
-}
-
 static int scsiback_map(struct backend_info *be)
 {
        struct xenbus_device *dev = be->dev;
-       unsigned int ring_ref, evtchn;
+       unsigned int ring_ref, evtchn, dom, id;
        int err;
-       char name[TASK_COMM_LEN];
 
        err = xenbus_gather(XBT_NIL, dev->otherend,
                        "ring-ref", "%u", &ring_ref,
@@ -76,13 +64,16 @@ static int scsiback_map(struct backend_i
        if (err)
                return err;
 
-       err = __vscsiif_name(be, name);
-       if (err) {
-               xenbus_dev_error(dev, err, "get scsiback dev name");
+       err = sscanf(be->dev->nodename, "backend/vscsi/%u/%u", &dom, &id);
+       if (err != 2) {
+               if (err >= 0)
+                       err = -EILSEQ;
+               xenbus_dev_error(dev, err, "get scsiback devid");
                return err;
        }
 
-       be->info->kthread = kthread_run(scsiback_schedule, be->info, name);
+       be->info->kthread = kthread_run(scsiback_schedule, be->info,
+                                       "vscsi.%d.%u", be->info->domid, id);
        if (IS_ERR(be->info->kthread)) {
                err = PTR_ERR(be->info->kthread);
                be->info->kthread = NULL;
diff -r aba765eb6c44 -r 62922fbe9fe2 drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c    Tue Jun 02 16:07:39 2015 +0200
+++ b/drivers/xen/scsifront/xenbus.c    Tue Jun 02 16:09:12 2015 +0200
@@ -35,12 +35,6 @@
 
 #include "common.h"
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
-  #define DEFAULT_TASK_COMM_LEN        16
-#else
-  #define DEFAULT_TASK_COMM_LEN        TASK_COMM_LEN
-#endif
-
 extern struct scsi_host_template scsifront_sht;
 
 static void scsifront_free_ring(struct vscsifrnt_info *info)
@@ -182,7 +176,6 @@ static int scsifront_probe(struct xenbus
        struct vscsifrnt_info *info;
        struct Scsi_Host *host;
        int i, err = -ENOMEM;
-       char name[DEFAULT_TASK_COMM_LEN];
 
        host = scsi_host_alloc(&scsifront_sht, sizeof(*info));
        if (!host) {
@@ -218,9 +211,8 @@ static int scsifront_probe(struct xenbus
        info->waiting_pause = 0;
        init_waitqueue_head(&info->wq_pause);
 
-       snprintf(name, DEFAULT_TASK_COMM_LEN, "vscsiif.%d", 
info->host->host_no);
-
-       info->kthread = kthread_run(scsifront_schedule, info, name);
+       info->kthread = kthread_run(scsifront_schedule, info,
+                                   "vscsiif.%d", info->host->host_no);
        if (IS_ERR(info->kthread)) {
                err = PTR_ERR(info->kthread);
                info->kthread = NULL;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.