21
21
#include <net/af_rxrpc.h>
22
22
#include "ar-internal.h"
23
23
24
- enum rxrpc_command {
25
- RXRPC_CMD_SEND_DATA , /* send data message */
26
- RXRPC_CMD_SEND_ABORT , /* request abort generation */
27
- RXRPC_CMD_ACCEPT , /* [server] accept incoming call */
28
- RXRPC_CMD_REJECT_BUSY , /* [server] reject a call as busy */
29
- };
30
-
31
- struct rxrpc_send_params {
32
- s64 tx_total_len ; /* Total Tx data length (if send data) */
33
- unsigned long user_call_ID ; /* User's call ID */
34
- u32 abort_code ; /* Abort code to Tx (if abort) */
35
- enum rxrpc_command command : 8 ; /* The command to implement */
36
- bool exclusive ; /* Shared or exclusive call */
37
- bool upgrade ; /* If the connection is upgradeable */
38
- };
39
-
40
24
/*
41
25
* Wait for space to appear in the Tx queue or a signal to occur.
42
26
*/
@@ -480,11 +464,11 @@ static int rxrpc_sendmsg_cmsg(struct msghdr *msg, struct rxrpc_send_params *p)
480
464
if (msg -> msg_flags & MSG_CMSG_COMPAT ) {
481
465
if (len != sizeof (u32 ))
482
466
return - EINVAL ;
483
- p -> user_call_ID = * (u32 * )CMSG_DATA (cmsg );
467
+ p -> call . user_call_ID = * (u32 * )CMSG_DATA (cmsg );
484
468
} else {
485
469
if (len != sizeof (unsigned long ))
486
470
return - EINVAL ;
487
- p -> user_call_ID = * (unsigned long * )
471
+ p -> call . user_call_ID = * (unsigned long * )
488
472
CMSG_DATA (cmsg );
489
473
}
490
474
got_user_ID = true;
@@ -522,10 +506,10 @@ static int rxrpc_sendmsg_cmsg(struct msghdr *msg, struct rxrpc_send_params *p)
522
506
break ;
523
507
524
508
case RXRPC_TX_LENGTH :
525
- if (p -> tx_total_len != -1 || len != sizeof (__s64 ))
509
+ if (p -> call . tx_total_len != -1 || len != sizeof (__s64 ))
526
510
return - EINVAL ;
527
- p -> tx_total_len = * (__s64 * )CMSG_DATA (cmsg );
528
- if (p -> tx_total_len < 0 )
511
+ p -> call . tx_total_len = * (__s64 * )CMSG_DATA (cmsg );
512
+ if (p -> call . tx_total_len < 0 )
529
513
return - EINVAL ;
530
514
break ;
531
515
@@ -536,7 +520,7 @@ static int rxrpc_sendmsg_cmsg(struct msghdr *msg, struct rxrpc_send_params *p)
536
520
537
521
if (!got_user_ID )
538
522
return - EINVAL ;
539
- if (p -> tx_total_len != -1 && p -> command != RXRPC_CMD_SEND_DATA )
523
+ if (p -> call . tx_total_len != -1 && p -> command != RXRPC_CMD_SEND_DATA )
540
524
return - EINVAL ;
541
525
_leave (" = 0" );
542
526
return 0 ;
@@ -576,8 +560,7 @@ rxrpc_new_client_call_for_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg,
576
560
cp .exclusive = rx -> exclusive | p -> exclusive ;
577
561
cp .upgrade = p -> upgrade ;
578
562
cp .service_id = srx -> srx_service ;
579
- call = rxrpc_new_client_call (rx , & cp , srx , p -> user_call_ID ,
580
- p -> tx_total_len , GFP_KERNEL );
563
+ call = rxrpc_new_client_call (rx , & cp , srx , & p -> call , GFP_KERNEL );
581
564
/* The socket is now unlocked */
582
565
583
566
_leave (" = %p\n" , call );
@@ -597,12 +580,12 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
597
580
int ret ;
598
581
599
582
struct rxrpc_send_params p = {
600
- .tx_total_len = -1 ,
601
- .user_call_ID = 0 ,
602
- .abort_code = 0 ,
603
- .command = RXRPC_CMD_SEND_DATA ,
604
- .exclusive = false,
605
- .upgrade = false,
583
+ .call . tx_total_len = -1 ,
584
+ .call . user_call_ID = 0 ,
585
+ .abort_code = 0 ,
586
+ .command = RXRPC_CMD_SEND_DATA ,
587
+ .exclusive = false,
588
+ .upgrade = false,
606
589
};
607
590
608
591
_enter ("" );
@@ -615,15 +598,15 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
615
598
ret = - EINVAL ;
616
599
if (rx -> sk .sk_state != RXRPC_SERVER_LISTENING )
617
600
goto error_release_sock ;
618
- call = rxrpc_accept_call (rx , p .user_call_ID , NULL );
601
+ call = rxrpc_accept_call (rx , p .call . user_call_ID , NULL );
619
602
/* The socket is now unlocked. */
620
603
if (IS_ERR (call ))
621
604
return PTR_ERR (call );
622
605
ret = 0 ;
623
606
goto out_put_unlock ;
624
607
}
625
608
626
- call = rxrpc_find_call_by_user_ID (rx , p .user_call_ID );
609
+ call = rxrpc_find_call_by_user_ID (rx , p .call . user_call_ID );
627
610
if (!call ) {
628
611
ret = - EBADSLT ;
629
612
if (p .command != RXRPC_CMD_SEND_DATA )
@@ -653,13 +636,13 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
653
636
goto error_put ;
654
637
}
655
638
656
- if (p .tx_total_len != -1 ) {
639
+ if (p .call . tx_total_len != -1 ) {
657
640
ret = - EINVAL ;
658
641
if (call -> tx_total_len != -1 ||
659
642
call -> tx_pending ||
660
643
call -> tx_top != 0 )
661
644
goto error_put ;
662
- call -> tx_total_len = p .tx_total_len ;
645
+ call -> tx_total_len = p .call . tx_total_len ;
663
646
}
664
647
}
665
648
0 commit comments