• Ren Mingxin's avatar
    virtio_blk: helper function to format disk names · c0aa3e09
    Ren Mingxin authored
    The current virtio block's naming algorithm just supports 18278
    (26^3 + 26^2 + 26) disks. If there are more virtio blocks,
    there will be disks with the same name.
    
    Based on commit 3e1a7ff8, add
    a function "virtblk_name_format()" for virtio block to support mass
    of disks naming.
    
    Notes:
    - Our naming scheme is ugly. We are stuck with it
      for virtio but don't use it for any new driver:
      new drivers should name their devices PREFIX%d
      where the sequence number can be allocated by ida
    - sd_format_disk_name has exactly the same logic.
      Moving it to a central place was deferred over worries
      that this will make people keep using the legacy naming
      in new drivers.
      We kept code idential in case someone wants to deduplicate later.
    Signed-off-by: default avatarRen Mingxin <renmx@cn.fujitsu.com>
    Acked-by: default avatarAsias He <asias@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    c0aa3e09
virtio_blk.c 17.3 KB