diff options
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/smsgiucv.c | 19 | ||||
-rw-r--r-- | drivers/s390/net/smsgiucv.h | 4 |
2 files changed, 16 insertions, 7 deletions
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c index a3d28585956..1e3f7f3c662 100644 --- a/drivers/s390/net/smsgiucv.c +++ b/drivers/s390/net/smsgiucv.c @@ -32,7 +32,7 @@ struct smsg_callback { struct list_head list; char *prefix; int len; - void (*callback)(char *str); + void (*callback)(char *from, char *str); }; MODULE_AUTHOR @@ -55,8 +55,9 @@ smsg_message_pending(iucv_MessagePending *eib, void *pgm_data) { struct smsg_callback *cb; unsigned char *msg; + unsigned char sender[9]; unsigned short len; - int rc; + int rc, i; len = eib->ln1msg2.ipbfln1f; msg = kmalloc(len + 1, GFP_ATOMIC|GFP_DMA); @@ -69,10 +70,18 @@ smsg_message_pending(iucv_MessagePending *eib, void *pgm_data) if (rc == 0) { msg[len] = 0; EBCASC(msg, len); + memcpy(sender, msg, 8); + sender[8] = 0; + /* Remove trailing whitespace from the sender name. */ + for (i = 7; i >= 0; i--) { + if (sender[i] != ' ' && sender[i] != '\t') + break; + sender[i] = 0; + } spin_lock(&smsg_list_lock); list_for_each_entry(cb, &smsg_list, list) if (strncmp(msg + 8, cb->prefix, cb->len) == 0) { - cb->callback(msg + 8); + cb->callback(sender, msg + 8); break; } spin_unlock(&smsg_list_lock); @@ -91,7 +100,7 @@ static struct device_driver smsg_driver = { }; int -smsg_register_callback(char *prefix, void (*callback)(char *str)) +smsg_register_callback(char *prefix, void (*callback)(char *from, char *str)) { struct smsg_callback *cb; @@ -108,7 +117,7 @@ smsg_register_callback(char *prefix, void (*callback)(char *str)) } void -smsg_unregister_callback(char *prefix, void (*callback)(char *str)) +smsg_unregister_callback(char *prefix, void (*callback)(char *from, char *str)) { struct smsg_callback *cb, *tmp; diff --git a/drivers/s390/net/smsgiucv.h b/drivers/s390/net/smsgiucv.h index 04cd8715296..67f5d4f8378 100644 --- a/drivers/s390/net/smsgiucv.h +++ b/drivers/s390/net/smsgiucv.h @@ -5,6 +5,6 @@ * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) */ -int smsg_register_callback(char *, void (*)(char *)); -void smsg_unregister_callback(char *, void (*)(char *)); +int smsg_register_callback(char *, void (*)(char *, char *)); +void smsg_unregister_callback(char *, void (*)(char *, char *)); |