diff options
author | Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | 2014-01-17 10:11:07 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2014-01-22 08:02:13 -0500 |
commit | 4f5922194dbed57581f470e49073a96d346a7174 (patch) | |
tree | e3d82e9acc991b32327088a0bd2fec4843726c8c /drivers/tty/hvc | |
parent | f1206bad2557de8868878a188cf5c506bb676ff7 (diff) |
s390/hvc_iucv: Automatically assign free HVC terminal devices
Add the generic "lnxhvc" terminal ID to automatically assign a HVC terminal when
connecting to the HVC IUCV terminal device driver. The terminal device driver
tries to find a free (not connected) HVC terminal to satisfy the incoming
connection request.
With this improvement, you do not longer need to guess which HVC terminal is
free, that is, not connected. Also you can still connect to a particular HVC
terminal by using its associated terminal ID.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/tty/hvc')
-rw-r--r-- | drivers/tty/hvc/hvc_iucv.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c index fbd023cee4ba..ea74460f3638 100644 --- a/drivers/tty/hvc/hvc_iucv.c +++ b/drivers/tty/hvc/hvc_iucv.c | |||
@@ -773,18 +773,37 @@ static int hvc_iucv_filter_connreq(u8 ipvmid[8]) | |||
773 | static int hvc_iucv_path_pending(struct iucv_path *path, | 773 | static int hvc_iucv_path_pending(struct iucv_path *path, |
774 | u8 ipvmid[8], u8 ipuser[16]) | 774 | u8 ipvmid[8], u8 ipuser[16]) |
775 | { | 775 | { |
776 | struct hvc_iucv_private *priv; | 776 | struct hvc_iucv_private *priv, *tmp; |
777 | u8 wildcard[9] = "lnxhvc "; | ||
778 | int i, rc, find_unused; | ||
777 | u8 nuser_data[16]; | 779 | u8 nuser_data[16]; |
778 | u8 vm_user_id[9]; | 780 | u8 vm_user_id[9]; |
779 | int i, rc; | ||
780 | 781 | ||
782 | ASCEBC(wildcard, sizeof(wildcard)); | ||
783 | find_unused = !memcmp(wildcard, ipuser, 8); | ||
784 | |||
785 | /* First, check if the pending path request is managed by this | ||
786 | * IUCV handler: | ||
787 | * - find a disconnected device if ipuser contains the wildcard | ||
788 | * - find the device that matches the terminal ID in ipuser | ||
789 | */ | ||
781 | priv = NULL; | 790 | priv = NULL; |
782 | for (i = 0; i < hvc_iucv_devices; i++) | 791 | for (i = 0; i < hvc_iucv_devices; i++) { |
783 | if (hvc_iucv_table[i] && | 792 | tmp = hvc_iucv_table[i]; |
784 | (0 == memcmp(hvc_iucv_table[i]->srv_name, ipuser, 8))) { | 793 | if (!tmp) |
785 | priv = hvc_iucv_table[i]; | 794 | continue; |
795 | |||
796 | if (find_unused) { | ||
797 | spin_lock(&tmp->lock); | ||
798 | if (tmp->iucv_state == IUCV_DISCONN) | ||
799 | priv = tmp; | ||
800 | spin_unlock(&tmp->lock); | ||
801 | |||
802 | } else if (!memcmp(tmp->srv_name, ipuser, 8)) | ||
803 | priv = tmp; | ||
804 | if (priv) | ||
786 | break; | 805 | break; |
787 | } | 806 | } |
788 | if (!priv) | 807 | if (!priv) |
789 | return -ENODEV; | 808 | return -ENODEV; |
790 | 809 | ||