aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorAsias He <asias@redhat.com>2013-05-06 04:38:27 -0400
committerMichael S. Tsirkin <mst@redhat.com>2013-07-07 07:38:55 -0400
commit683bd967dd32eec4e4c45e4d38e9f807a2fd9479 (patch)
treee757400647a26db2b524ebbe9978bc42fbb88953 /drivers/vhost
parentc7289312fe9b4077b5c15632b232e76144a220c6 (diff)
vhost-scsi: Make func indention more consistent
Signed-off-by: Asias He <asias@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/scsi.c154
1 files changed, 88 insertions, 66 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index e5edb651b6d2..acac9cc93edf 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -328,11 +328,12 @@ static u32 tcm_vhost_get_default_depth(struct se_portal_group *se_tpg)
328 return 1; 328 return 1;
329} 329}
330 330
331static u32 tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg, 331static u32
332 struct se_node_acl *se_nacl, 332tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg,
333 struct t10_pr_registration *pr_reg, 333 struct se_node_acl *se_nacl,
334 int *format_code, 334 struct t10_pr_registration *pr_reg,
335 unsigned char *buf) 335 int *format_code,
336 unsigned char *buf)
336{ 337{
337 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 338 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
338 struct tcm_vhost_tpg, se_tpg); 339 struct tcm_vhost_tpg, se_tpg);
@@ -358,10 +359,11 @@ static u32 tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg,
358 format_code, buf); 359 format_code, buf);
359} 360}
360 361
361static u32 tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg, 362static u32
362 struct se_node_acl *se_nacl, 363tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg,
363 struct t10_pr_registration *pr_reg, 364 struct se_node_acl *se_nacl,
364 int *format_code) 365 struct t10_pr_registration *pr_reg,
366 int *format_code)
365{ 367{
366 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 368 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
367 struct tcm_vhost_tpg, se_tpg); 369 struct tcm_vhost_tpg, se_tpg);
@@ -387,10 +389,11 @@ static u32 tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg,
387 format_code); 389 format_code);
388} 390}
389 391
390static char *tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg, 392static char *
391 const char *buf, 393tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
392 u32 *out_tid_len, 394 const char *buf,
393 char **port_nexus_ptr) 395 u32 *out_tid_len,
396 char **port_nexus_ptr)
394{ 397{
395 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 398 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
396 struct tcm_vhost_tpg, se_tpg); 399 struct tcm_vhost_tpg, se_tpg);
@@ -416,8 +419,8 @@ static char *tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
416 port_nexus_ptr); 419 port_nexus_ptr);
417} 420}
418 421
419static struct se_node_acl *tcm_vhost_alloc_fabric_acl( 422static struct se_node_acl *
420 struct se_portal_group *se_tpg) 423tcm_vhost_alloc_fabric_acl(struct se_portal_group *se_tpg)
421{ 424{
422 struct tcm_vhost_nacl *nacl; 425 struct tcm_vhost_nacl *nacl;
423 426
@@ -430,8 +433,9 @@ static struct se_node_acl *tcm_vhost_alloc_fabric_acl(
430 return &nacl->se_node_acl; 433 return &nacl->se_node_acl;
431} 434}
432 435
433static void tcm_vhost_release_fabric_acl(struct se_portal_group *se_tpg, 436static void
434 struct se_node_acl *se_nacl) 437tcm_vhost_release_fabric_acl(struct se_portal_group *se_tpg,
438 struct se_node_acl *se_nacl)
435{ 439{
436 struct tcm_vhost_nacl *nacl = container_of(se_nacl, 440 struct tcm_vhost_nacl *nacl = container_of(se_nacl,
437 struct tcm_vhost_nacl, se_node_acl); 441 struct tcm_vhost_nacl, se_node_acl);
@@ -526,8 +530,9 @@ static void tcm_vhost_free_evt(struct vhost_scsi *vs, struct tcm_vhost_evt *evt)
526 kfree(evt); 530 kfree(evt);
527} 531}
528 532
529static struct tcm_vhost_evt *tcm_vhost_allocate_evt(struct vhost_scsi *vs, 533static struct tcm_vhost_evt *
530 u32 event, u32 reason) 534tcm_vhost_allocate_evt(struct vhost_scsi *vs,
535 u32 event, u32 reason)
531{ 536{
532 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; 537 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
533 struct tcm_vhost_evt *evt; 538 struct tcm_vhost_evt *evt;
@@ -571,8 +576,8 @@ static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *tv_cmd)
571 kfree(tv_cmd); 576 kfree(tv_cmd);
572} 577}
573 578
574static void tcm_vhost_do_evt_work(struct vhost_scsi *vs, 579static void
575 struct tcm_vhost_evt *evt) 580tcm_vhost_do_evt_work(struct vhost_scsi *vs, struct tcm_vhost_evt *evt)
576{ 581{
577 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; 582 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
578 struct virtio_scsi_event *event = &evt->event; 583 struct virtio_scsi_event *event = &evt->event;
@@ -693,12 +698,12 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
693 vhost_signal(&vs->dev, &vs->vqs[vq].vq); 698 vhost_signal(&vs->dev, &vs->vqs[vq].vq);
694} 699}
695 700
696static struct tcm_vhost_cmd *vhost_scsi_allocate_cmd( 701static struct tcm_vhost_cmd *
697 struct vhost_virtqueue *vq, 702vhost_scsi_allocate_cmd(struct vhost_virtqueue *vq,
698 struct tcm_vhost_tpg *tv_tpg, 703 struct tcm_vhost_tpg *tv_tpg,
699 struct virtio_scsi_cmd_req *v_req, 704 struct virtio_scsi_cmd_req *v_req,
700 u32 exp_data_len, 705 u32 exp_data_len,
701 int data_direction) 706 int data_direction)
702{ 707{
703 struct tcm_vhost_cmd *tv_cmd; 708 struct tcm_vhost_cmd *tv_cmd;
704 struct tcm_vhost_nexus *tv_nexus; 709 struct tcm_vhost_nexus *tv_nexus;
@@ -729,8 +734,11 @@ static struct tcm_vhost_cmd *vhost_scsi_allocate_cmd(
729 * 734 *
730 * Returns the number of scatterlist entries used or -errno on error. 735 * Returns the number of scatterlist entries used or -errno on error.
731 */ 736 */
732static int vhost_scsi_map_to_sgl(struct scatterlist *sgl, 737static int
733 unsigned int sgl_count, struct iovec *iov, int write) 738vhost_scsi_map_to_sgl(struct scatterlist *sgl,
739 unsigned int sgl_count,
740 struct iovec *iov,
741 int write)
734{ 742{
735 unsigned int npages = 0, pages_nr, offset, nbytes; 743 unsigned int npages = 0, pages_nr, offset, nbytes;
736 struct scatterlist *sg = sgl; 744 struct scatterlist *sg = sgl;
@@ -774,8 +782,11 @@ out:
774 return ret; 782 return ret;
775} 783}
776 784
777static int vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *tv_cmd, 785static int
778 struct iovec *iov, unsigned int niov, int write) 786vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *tv_cmd,
787 struct iovec *iov,
788 unsigned int niov,
789 int write)
779{ 790{
780 int ret; 791 int ret;
781 unsigned int i; 792 unsigned int i;
@@ -855,8 +866,10 @@ static void tcm_vhost_submission_work(struct work_struct *work)
855 } 866 }
856} 867}
857 868
858static void vhost_scsi_send_bad_target(struct vhost_scsi *vs, 869static void
859 struct vhost_virtqueue *vq, int head, unsigned out) 870vhost_scsi_send_bad_target(struct vhost_scsi *vs,
871 struct vhost_virtqueue *vq,
872 int head, unsigned out)
860{ 873{
861 struct virtio_scsi_cmd_resp __user *resp; 874 struct virtio_scsi_cmd_resp __user *resp;
862 struct virtio_scsi_cmd_resp rsp; 875 struct virtio_scsi_cmd_resp rsp;
@@ -872,8 +885,8 @@ static void vhost_scsi_send_bad_target(struct vhost_scsi *vs,
872 pr_err("Faulted on virtio_scsi_cmd_resp\n"); 885 pr_err("Faulted on virtio_scsi_cmd_resp\n");
873} 886}
874 887
875static void vhost_scsi_handle_vq(struct vhost_scsi *vs, 888static void
876 struct vhost_virtqueue *vq) 889vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
877{ 890{
878 struct tcm_vhost_tpg **vs_tpg; 891 struct tcm_vhost_tpg **vs_tpg;
879 struct virtio_scsi_cmd_req v_req; 892 struct virtio_scsi_cmd_req v_req;
@@ -1054,8 +1067,12 @@ static void vhost_scsi_ctl_handle_kick(struct vhost_work *work)
1054 pr_debug("%s: The handling func for control queue.\n", __func__); 1067 pr_debug("%s: The handling func for control queue.\n", __func__);
1055} 1068}
1056 1069
1057static void tcm_vhost_send_evt(struct vhost_scsi *vs, struct tcm_vhost_tpg *tpg, 1070static void
1058 struct se_lun *lun, u32 event, u32 reason) 1071tcm_vhost_send_evt(struct vhost_scsi *vs,
1072 struct tcm_vhost_tpg *tpg,
1073 struct se_lun *lun,
1074 u32 event,
1075 u32 reason)
1059{ 1076{
1060 struct tcm_vhost_evt *evt; 1077 struct tcm_vhost_evt *evt;
1061 1078
@@ -1145,9 +1162,9 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)
1145 * The lock nesting rule is: 1162 * The lock nesting rule is:
1146 * tcm_vhost_mutex -> vs->dev.mutex -> tpg->tv_tpg_mutex -> vq->mutex 1163 * tcm_vhost_mutex -> vs->dev.mutex -> tpg->tv_tpg_mutex -> vq->mutex
1147 */ 1164 */
1148static int vhost_scsi_set_endpoint( 1165static int
1149 struct vhost_scsi *vs, 1166vhost_scsi_set_endpoint(struct vhost_scsi *vs,
1150 struct vhost_scsi_target *t) 1167 struct vhost_scsi_target *t)
1151{ 1168{
1152 struct tcm_vhost_tport *tv_tport; 1169 struct tcm_vhost_tport *tv_tport;
1153 struct tcm_vhost_tpg *tv_tpg; 1170 struct tcm_vhost_tpg *tv_tpg;
@@ -1235,9 +1252,9 @@ out:
1235 return ret; 1252 return ret;
1236} 1253}
1237 1254
1238static int vhost_scsi_clear_endpoint( 1255static int
1239 struct vhost_scsi *vs, 1256vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
1240 struct vhost_scsi_target *t) 1257 struct vhost_scsi_target *t)
1241{ 1258{
1242 struct tcm_vhost_tport *tv_tport; 1259 struct tcm_vhost_tport *tv_tport;
1243 struct tcm_vhost_tpg *tv_tpg; 1260 struct tcm_vhost_tpg *tv_tpg;
@@ -1397,8 +1414,10 @@ static int vhost_scsi_release(struct inode *inode, struct file *f)
1397 return 0; 1414 return 0;
1398} 1415}
1399 1416
1400static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, 1417static long
1401 unsigned long arg) 1418vhost_scsi_ioctl(struct file *f,
1419 unsigned int ioctl,
1420 unsigned long arg)
1402{ 1421{
1403 struct vhost_scsi *vs = f->private_data; 1422 struct vhost_scsi *vs = f->private_data;
1404 struct vhost_scsi_target backend; 1423 struct vhost_scsi_target backend;
@@ -1514,8 +1533,9 @@ static char *tcm_vhost_dump_proto_id(struct tcm_vhost_tport *tport)
1514 return "Unknown"; 1533 return "Unknown";
1515} 1534}
1516 1535
1517static void tcm_vhost_do_plug(struct tcm_vhost_tpg *tpg, 1536static void
1518 struct se_lun *lun, bool plug) 1537tcm_vhost_do_plug(struct tcm_vhost_tpg *tpg,
1538 struct se_lun *lun, bool plug)
1519{ 1539{
1520 1540
1521 struct vhost_scsi *vs = tpg->vhost_scsi; 1541 struct vhost_scsi *vs = tpg->vhost_scsi;
@@ -1555,7 +1575,7 @@ static void tcm_vhost_hotunplug(struct tcm_vhost_tpg *tpg, struct se_lun *lun)
1555} 1575}
1556 1576
1557static int tcm_vhost_port_link(struct se_portal_group *se_tpg, 1577static int tcm_vhost_port_link(struct se_portal_group *se_tpg,
1558 struct se_lun *lun) 1578 struct se_lun *lun)
1559{ 1579{
1560 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg, 1580 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1561 struct tcm_vhost_tpg, se_tpg); 1581 struct tcm_vhost_tpg, se_tpg);
@@ -1574,7 +1594,7 @@ static int tcm_vhost_port_link(struct se_portal_group *se_tpg,
1574} 1594}
1575 1595
1576static void tcm_vhost_port_unlink(struct se_portal_group *se_tpg, 1596static void tcm_vhost_port_unlink(struct se_portal_group *se_tpg,
1577 struct se_lun *lun) 1597 struct se_lun *lun)
1578{ 1598{
1579 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg, 1599 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1580 struct tcm_vhost_tpg, se_tpg); 1600 struct tcm_vhost_tpg, se_tpg);
@@ -1590,10 +1610,10 @@ static void tcm_vhost_port_unlink(struct se_portal_group *se_tpg,
1590 mutex_unlock(&tcm_vhost_mutex); 1610 mutex_unlock(&tcm_vhost_mutex);
1591} 1611}
1592 1612
1593static struct se_node_acl *tcm_vhost_make_nodeacl( 1613static struct se_node_acl *
1594 struct se_portal_group *se_tpg, 1614tcm_vhost_make_nodeacl(struct se_portal_group *se_tpg,
1595 struct config_group *group, 1615 struct config_group *group,
1596 const char *name) 1616 const char *name)
1597{ 1617{
1598 struct se_node_acl *se_nacl, *se_nacl_new; 1618 struct se_node_acl *se_nacl, *se_nacl_new;
1599 struct tcm_vhost_nacl *nacl; 1619 struct tcm_vhost_nacl *nacl;
@@ -1635,7 +1655,7 @@ static void tcm_vhost_drop_nodeacl(struct se_node_acl *se_acl)
1635} 1655}
1636 1656
1637static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tv_tpg, 1657static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tv_tpg,
1638 const char *name) 1658 const char *name)
1639{ 1659{
1640 struct se_portal_group *se_tpg; 1660 struct se_portal_group *se_tpg;
1641 struct tcm_vhost_nexus *tv_nexus; 1661 struct tcm_vhost_nexus *tv_nexus;
@@ -1739,7 +1759,7 @@ static int tcm_vhost_drop_nexus(struct tcm_vhost_tpg *tpg)
1739} 1759}
1740 1760
1741static ssize_t tcm_vhost_tpg_show_nexus(struct se_portal_group *se_tpg, 1761static ssize_t tcm_vhost_tpg_show_nexus(struct se_portal_group *se_tpg,
1742 char *page) 1762 char *page)
1743{ 1763{
1744 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg, 1764 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1745 struct tcm_vhost_tpg, se_tpg); 1765 struct tcm_vhost_tpg, se_tpg);
@@ -1760,8 +1780,8 @@ static ssize_t tcm_vhost_tpg_show_nexus(struct se_portal_group *se_tpg,
1760} 1780}
1761 1781
1762static ssize_t tcm_vhost_tpg_store_nexus(struct se_portal_group *se_tpg, 1782static ssize_t tcm_vhost_tpg_store_nexus(struct se_portal_group *se_tpg,
1763 const char *page, 1783 const char *page,
1764 size_t count) 1784 size_t count)
1765{ 1785{
1766 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg, 1786 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1767 struct tcm_vhost_tpg, se_tpg); 1787 struct tcm_vhost_tpg, se_tpg);
@@ -1844,9 +1864,10 @@ static struct configfs_attribute *tcm_vhost_tpg_attrs[] = {
1844 NULL, 1864 NULL,
1845}; 1865};
1846 1866
1847static struct se_portal_group *tcm_vhost_make_tpg(struct se_wwn *wwn, 1867static struct se_portal_group *
1848 struct config_group *group, 1868tcm_vhost_make_tpg(struct se_wwn *wwn,
1849 const char *name) 1869 struct config_group *group,
1870 const char *name)
1850{ 1871{
1851 struct tcm_vhost_tport *tport = container_of(wwn, 1872 struct tcm_vhost_tport *tport = container_of(wwn,
1852 struct tcm_vhost_tport, tport_wwn); 1873 struct tcm_vhost_tport, tport_wwn);
@@ -1902,9 +1923,10 @@ static void tcm_vhost_drop_tpg(struct se_portal_group *se_tpg)
1902 kfree(tpg); 1923 kfree(tpg);
1903} 1924}
1904 1925
1905static struct se_wwn *tcm_vhost_make_tport(struct target_fabric_configfs *tf, 1926static struct se_wwn *
1906 struct config_group *group, 1927tcm_vhost_make_tport(struct target_fabric_configfs *tf,
1907 const char *name) 1928 struct config_group *group,
1929 const char *name)
1908{ 1930{
1909 struct tcm_vhost_tport *tport; 1931 struct tcm_vhost_tport *tport;
1910 char *ptr; 1932 char *ptr;
@@ -1974,9 +1996,9 @@ static void tcm_vhost_drop_tport(struct se_wwn *wwn)
1974 kfree(tport); 1996 kfree(tport);
1975} 1997}
1976 1998
1977static ssize_t tcm_vhost_wwn_show_attr_version( 1999static ssize_t
1978 struct target_fabric_configfs *tf, 2000tcm_vhost_wwn_show_attr_version(struct target_fabric_configfs *tf,
1979 char *page) 2001 char *page)
1980{ 2002{
1981 return sprintf(page, "TCM_VHOST fabric module %s on %s/%s" 2003 return sprintf(page, "TCM_VHOST fabric module %s on %s/%s"
1982 "on "UTS_RELEASE"\n", TCM_VHOST_VERSION, utsname()->sysname, 2004 "on "UTS_RELEASE"\n", TCM_VHOST_VERSION, utsname()->sysname,