diff options
author | Asias He <asias@redhat.com> | 2013-05-06 04:38:27 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2013-07-07 07:38:55 -0400 |
commit | 683bd967dd32eec4e4c45e4d38e9f807a2fd9479 (patch) | |
tree | e757400647a26db2b524ebbe9978bc42fbb88953 /drivers/vhost | |
parent | c7289312fe9b4077b5c15632b232e76144a220c6 (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.c | 154 |
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 | ||
331 | static u32 tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg, | 331 | static u32 |
332 | struct se_node_acl *se_nacl, | 332 | tcm_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 | ||
361 | static u32 tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg, | 362 | static u32 |
362 | struct se_node_acl *se_nacl, | 363 | tcm_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 | ||
390 | static char *tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg, | 392 | static char * |
391 | const char *buf, | 393 | tcm_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 | ||
419 | static struct se_node_acl *tcm_vhost_alloc_fabric_acl( | 422 | static struct se_node_acl * |
420 | struct se_portal_group *se_tpg) | 423 | tcm_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 | ||
433 | static void tcm_vhost_release_fabric_acl(struct se_portal_group *se_tpg, | 436 | static void |
434 | struct se_node_acl *se_nacl) | 437 | tcm_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 | ||
529 | static struct tcm_vhost_evt *tcm_vhost_allocate_evt(struct vhost_scsi *vs, | 533 | static struct tcm_vhost_evt * |
530 | u32 event, u32 reason) | 534 | tcm_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 | ||
574 | static void tcm_vhost_do_evt_work(struct vhost_scsi *vs, | 579 | static void |
575 | struct tcm_vhost_evt *evt) | 580 | tcm_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 | ||
696 | static struct tcm_vhost_cmd *vhost_scsi_allocate_cmd( | 701 | static struct tcm_vhost_cmd * |
697 | struct vhost_virtqueue *vq, | 702 | vhost_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 | */ |
732 | static int vhost_scsi_map_to_sgl(struct scatterlist *sgl, | 737 | static int |
733 | unsigned int sgl_count, struct iovec *iov, int write) | 738 | vhost_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 | ||
777 | static int vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *tv_cmd, | 785 | static int |
778 | struct iovec *iov, unsigned int niov, int write) | 786 | vhost_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 | ||
858 | static void vhost_scsi_send_bad_target(struct vhost_scsi *vs, | 869 | static void |
859 | struct vhost_virtqueue *vq, int head, unsigned out) | 870 | vhost_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 | ||
875 | static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | 888 | static void |
876 | struct vhost_virtqueue *vq) | 889 | vhost_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 | ||
1057 | static void tcm_vhost_send_evt(struct vhost_scsi *vs, struct tcm_vhost_tpg *tpg, | 1070 | static void |
1058 | struct se_lun *lun, u32 event, u32 reason) | 1071 | tcm_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 | */ |
1148 | static int vhost_scsi_set_endpoint( | 1165 | static int |
1149 | struct vhost_scsi *vs, | 1166 | vhost_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 | ||
1238 | static int vhost_scsi_clear_endpoint( | 1255 | static int |
1239 | struct vhost_scsi *vs, | 1256 | vhost_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 | ||
1400 | static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, | 1417 | static long |
1401 | unsigned long arg) | 1418 | vhost_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 | ||
1517 | static void tcm_vhost_do_plug(struct tcm_vhost_tpg *tpg, | 1536 | static void |
1518 | struct se_lun *lun, bool plug) | 1537 | tcm_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 | ||
1557 | static int tcm_vhost_port_link(struct se_portal_group *se_tpg, | 1577 | static 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 | ||
1576 | static void tcm_vhost_port_unlink(struct se_portal_group *se_tpg, | 1596 | static 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 | ||
1593 | static struct se_node_acl *tcm_vhost_make_nodeacl( | 1613 | static struct se_node_acl * |
1594 | struct se_portal_group *se_tpg, | 1614 | tcm_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 | ||
1637 | static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tv_tpg, | 1657 | static 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 | ||
1741 | static ssize_t tcm_vhost_tpg_show_nexus(struct se_portal_group *se_tpg, | 1761 | static 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 | ||
1762 | static ssize_t tcm_vhost_tpg_store_nexus(struct se_portal_group *se_tpg, | 1782 | static 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 | ||
1847 | static struct se_portal_group *tcm_vhost_make_tpg(struct se_wwn *wwn, | 1867 | static struct se_portal_group * |
1848 | struct config_group *group, | 1868 | tcm_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 | ||
1905 | static struct se_wwn *tcm_vhost_make_tport(struct target_fabric_configfs *tf, | 1926 | static struct se_wwn * |
1906 | struct config_group *group, | 1927 | tcm_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 | ||
1977 | static ssize_t tcm_vhost_wwn_show_attr_version( | 1999 | static ssize_t |
1978 | struct target_fabric_configfs *tf, | 2000 | tcm_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, |