All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ren Mingxin <renmx@cn.fujitsu.com>
To: Jens Axboe <axboe@kernel.dk>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>, Tejun Heo <tj@kernel.org>
Cc: VIRTUAL <virtualization@lists.linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	SCSI <linux-scsi@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: [PATCH 2/4] scsi: replace sd_format_disk_name() to disk_name_format()
Date: Fri, 30 Mar 2012 17:53:03 +0800	[thread overview]
Message-ID: <4F75827F.2010002__28796.8702301898$1333381111$gmane$org@cn.fujitsu.com> (raw)
In-Reply-To: <4F7581D4.4040301@cn.fujitsu.com>

  Since "sd_format_disk_name()"has been copied into block
core as "disk_name_format()", the original function should
be removed, and the place used original function should be
replaced by the renamed function.

Signed-off-by: Ren Mingxin <renmx@cn.fujitsu.com>
---
  sd.c |   48 +-----------------------------------------------
  1 file changed, 1 insertion(+), 47 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 09e3df4..b82156a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2525,52 +2525,6 @@ static void sd_unlock_native_capacity(struct 
gendisk *disk)
                 sdev->host->hostt->unlock_native_capacity(sdev);
  }

-/**
- *     sd_format_disk_name - format disk name
- *     @prefix: name prefix - ie. "sd" for SCSI disks
- *     @index: index of the disk to format name for
- *     @buf: output buffer
- *     @buflen: length of the output buffer
- *
- *     SCSI disk names starts at sda.  The 26th device is sdz and the
- *     27th is sdaa.  The last one for two lettered suffix is sdzz
- *     which is followed by sdaaa.
- *
- *     This is basically 26 base counting with one extra 'nil' entry
- *     at the beginning from the second digit on and can be
- *     determined using similar method as 26 base conversion with the
- *     index shifted -1 after each digit is computed.
- *
- *     CONTEXT:
- *     Don't care.
- *
- *     RETURNS:
- *     0 on success, -errno on failure.
- */
-static int sd_format_disk_name(char *prefix, int index, char *buf, int 
buflen)
-{
-       const int base = 'z' - 'a' + 1;
-       char *begin = buf + strlen(prefix);
-       char *end = buf + buflen;
-       char *p;
-       int unit;
-
-       p = end - 1;
-       *p = '\0';
-       unit = base;
-       do {
-               if (p == begin)
-                       return -EINVAL;
-               *--p = 'a' + (index % unit);
-               index = (index / unit) - 1;
-       } while (index >= 0);
-
-       memmove(begin, p, end - p);
-       memcpy(buf, prefix, strlen(prefix));
-
-       return 0;
-}
-
  /*
   * The asynchronous part of sd_probe
   */
@@ -2685,7 +2639,7 @@ static int sd_probe(struct device *dev)
                 goto out_put;
         }

-       error = sd_format_disk_name("sd", index, gd->disk_name, 
DISK_NAME_LEN);
+       error = disk_name_format("sd", index, gd->disk_name, DISK_NAME_LEN);
         if (error) {
                 sdev_printk(KERN_WARNING, sdp, "SCSI disk (sd) name 
length exceeded.\n");
                 goto out_free_index;

  parent reply	other threads:[~2012-03-30  9:53 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30  9:50 [PATCH 0/4] block: move sd_format_disk_name() into block core as disk_name_format() Ren Mingxin
2012-03-30  9:52 ` [PATCH 1/4] block: add function disk_name_format() into block core Ren Mingxin
2012-03-30  9:52 ` Ren Mingxin
2012-03-30  9:53 ` [PATCH 2/4] scsi: replace sd_format_disk_name() to disk_name_format() Ren Mingxin
2012-03-30  9:53 ` Ren Mingxin [this message]
2012-03-30  9:53 ` [PATCH 3/4] block: replace rssd_disk_name_format() " Ren Mingxin
2012-03-30  9:53 ` Ren Mingxin
2012-03-30 23:54   ` Asai Thambi Samymuthu Pattrayasamy (asamymuthupa) [CONT - Type 2]
2012-03-30 23:54   ` Asai Thambi Samymuthu Pattrayasamy (asamymuthupa) [CONT - Type 2]
2012-03-30 23:54     ` Asai Thambi Samymuthu Pattrayasamy (asamymuthupa) [CONT - Type 2]
2012-04-02  1:21     ` Ren Mingxin
2012-04-02  1:21       ` Ren Mingxin
2012-04-02  1:21     ` Ren Mingxin
2012-03-30  9:53 ` [PATCH 4/4] virtio_blk: use disk_name_format() to support mass of disks naming Ren Mingxin
2012-03-30  9:53 ` Ren Mingxin
2012-03-30 11:22   ` Asias He
2012-03-30 11:22     ` Asias He
2012-03-31  1:14     ` Ren Mingxin
2012-03-31  1:14     ` Ren Mingxin
2012-03-31  3:03       ` Asias He
2012-03-31  3:03         ` Asias He
2012-03-30 15:26   ` Tejun Heo
2012-03-30 15:26     ` Tejun Heo
2012-03-30 15:28     ` Tejun Heo
2012-03-30 15:28       ` Tejun Heo
2012-04-02  1:19       ` Ren Mingxin
2012-04-02  1:19       ` Ren Mingxin
2012-04-02  7:20         ` Michael S. Tsirkin
2012-04-02  7:20           ` Michael S. Tsirkin
2012-04-02 18:52           ` Tejun Heo
2012-04-02 18:52             ` Tejun Heo
2012-04-02 18:56             ` James Bottomley
2012-04-02 19:00               ` Tejun Heo
2012-04-02 19:00                 ` Tejun Heo
2012-04-04  8:01                 ` Michael S. Tsirkin
2012-04-04  8:01                   ` Michael S. Tsirkin
2012-04-09  3:47                   ` Ren Mingxin
2012-04-09  3:47                   ` Ren Mingxin
2012-04-09  7:33                     ` Michael S. Tsirkin
2012-04-09  7:33                       ` Michael S. Tsirkin
2012-04-09  7:50                     ` Michael S. Tsirkin
2012-04-09  7:50                       ` Michael S. Tsirkin
2012-04-02 18:56             ` James Bottomley
2012-03-30 15:38     ` Tejun Heo
2012-03-30 15:38     ` Tejun Heo
2012-04-02  1:18       ` Ren Mingxin
2012-04-02  1:18       ` Ren Mingxin
2012-04-02  7:15     ` Michael S. Tsirkin
2012-04-02  7:15       ` Michael S. Tsirkin
2012-04-12 20:17     ` Jeff Garzik
2012-04-12 20:17       ` Jeff Garzik
2012-03-30  9:56 ` [PATCH 0/4] block: move sd_format_disk_name() into block core as disk_name_format() James Bottomley
2012-03-30 10:10   ` Ren Mingxin
2012-03-30 10:10   ` Ren Mingxin
2012-03-30  9:56 ` James Bottomley
2012-04-01 11:20 ` Michael S. Tsirkin
2012-04-01 11:20   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='4F75827F.2010002__28796.8702301898$1333381111$gmane$org@cn.fujitsu.com' \
    --to=renmx@cn.fujitsu.com \
    --cc=axboe@kernel.dk \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tj@kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.