~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to net/tipc/socket.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
 *
124
124
 * Caller must hold socket lock
125
125
 */
126
 
 
127
126
static void advance_rx_queue(struct sock *sk)
128
127
{
129
128
        kfree_skb(__skb_dequeue(&sk->sk_receive_queue));
135
134
 *
136
135
 * Caller must hold socket lock
137
136
 */
138
 
 
139
137
static void discard_rx_queue(struct sock *sk)
140
138
{
141
139
        struct sk_buff *buf;
151
149
 *
152
150
 * Caller must hold socket lock
153
151
 */
154
 
 
155
152
static void reject_rx_queue(struct sock *sk)
156
153
{
157
154
        struct sk_buff *buf;
174
171
 *
175
172
 * Returns 0 on success, errno otherwise
176
173
 */
177
 
 
178
174
static int tipc_create(struct net *net, struct socket *sock, int protocol,
179
175
                       int kern)
180
176
{
184
180
        struct tipc_port *tp_ptr;
185
181
 
186
182
        /* Validate arguments */
187
 
 
188
183
        if (unlikely(protocol != 0))
189
184
                return -EPROTONOSUPPORT;
190
185
 
207
202
        }
208
203
 
209
204
        /* Allocate socket's protocol area */
210
 
 
211
205
        sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto);
212
206
        if (sk == NULL)
213
207
                return -ENOMEM;
214
208
 
215
209
        /* Allocate TIPC port for socket to use */
216
 
 
217
210
        tp_ptr = tipc_createport_raw(sk, &dispatch, &wakeupdispatch,
218
211
                                     TIPC_LOW_IMPORTANCE);
219
212
        if (unlikely(!tp_ptr)) {
222
215
        }
223
216
 
224
217
        /* Finish initializing socket data structures */
225
 
 
226
218
        sock->ops = ops;
227
219
        sock->state = state;
228
220
 
258
250
 *
259
251
 * Returns 0 on success, errno otherwise
260
252
 */
261
 
 
262
253
static int release(struct socket *sock)
263
254
{
264
255
        struct sock *sk = sock->sk;
270
261
         * Exit if socket isn't fully initialized (occurs when a failed accept()
271
262
         * releases a pre-allocated child socket that was never used)
272
263
         */
273
 
 
274
264
        if (sk == NULL)
275
265
                return 0;
276
266
 
281
271
         * Reject all unreceived messages, except on an active connection
282
272
         * (which disconnects locally & sends a 'FIN+' to peer)
283
273
         */
284
 
 
285
274
        while (sock->state != SS_DISCONNECTING) {
286
275
                buf = __skb_dequeue(&sk->sk_receive_queue);
287
276
                if (buf == NULL)
303
292
         * Delete TIPC port; this ensures no more messages are queued
304
293
         * (also disconnects an active connection & sends a 'FIN-' to peer)
305
294
         */
306
 
 
307
295
        res = tipc_deleteport(tport->ref);
308
296
 
309
297
        /* Discard any remaining (connection-based) messages in receive queue */
310
 
 
311
298
        discard_rx_queue(sk);
312
299
 
313
300
        /* Reject any messages that accumulated in backlog queue */
314
 
 
315
301
        sock->state = SS_DISCONNECTING;
316
302
        release_sock(sk);
317
303
 
336
322
 * NOTE: This routine doesn't need to take the socket lock since it doesn't
337
323
 *       access any non-constant socket information.
338
324
 */
339
 
 
340
325
static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
341
326
{
342
327
        struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
376
361
 *       accesses socket information that is unchanging (or which changes in
377
362
 *       a completely predictable manner).
378
363
 */
379
 
 
380
364
static int get_name(struct socket *sock, struct sockaddr *uaddr,
381
365
                    int *uaddr_len, int peer)
382
366
{
444
428
 * imply that the operation will succeed, merely that it should be performed
445
429
 * and will not block.
446
430
 */
447
 
 
448
431
static unsigned int poll(struct file *file, struct socket *sock,
449
432
                         poll_table *wait)
450
433
{
482
465
 *
483
466
 * Returns 0 if permission is granted, otherwise errno
484
467
 */
485
 
 
486
468
static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
487
469
{
488
470
        struct tipc_cfg_msg_hdr hdr;
518
500
 *
519
501
 * Returns the number of bytes sent on success, or errno otherwise
520
502
 */
521
 
 
522
503
static int send_msg(struct kiocb *iocb, struct socket *sock,
523
504
                    struct msghdr *m, size_t total_len)
524
505
{
535
516
                     (dest->family != AF_TIPC)))
536
517
                return -EINVAL;
537
518
        if ((total_len > TIPC_MAX_USER_MSG_SIZE) ||
538
 
            (m->msg_iovlen > (unsigned)INT_MAX))
 
519
            (m->msg_iovlen > (unsigned int)INT_MAX))
539
520
                return -EMSGSIZE;
540
521
 
541
522
        if (iocb)
562
543
                }
563
544
 
564
545
                /* Abort any pending connection attempts (very unlikely) */
565
 
 
566
546
                reject_rx_queue(sk);
567
547
        }
568
548
 
631
611
 *
632
612
 * Returns the number of bytes sent on success, or errno otherwise
633
613
 */
634
 
 
635
614
static int send_packet(struct kiocb *iocb, struct socket *sock,
636
615
                       struct msghdr *m, size_t total_len)
637
616
{
642
621
        int res;
643
622
 
644
623
        /* Handle implied connection establishment */
645
 
 
646
624
        if (unlikely(dest))
647
625
                return send_msg(iocb, sock, m, total_len);
648
626
 
649
627
        if ((total_len > TIPC_MAX_USER_MSG_SIZE) ||
650
 
            (m->msg_iovlen > (unsigned)INT_MAX))
 
628
            (m->msg_iovlen > (unsigned int)INT_MAX))
651
629
                return -EMSGSIZE;
652
630
 
653
631
        if (iocb)
695
673
 * Returns the number of bytes sent on success (or partial success),
696
674
 * or errno if no data sent
697
675
 */
698
 
 
699
676
static int send_stream(struct kiocb *iocb, struct socket *sock,
700
677
                       struct msghdr *m, size_t total_len)
701
678
{
715
692
        lock_sock(sk);
716
693
 
717
694
        /* Handle special cases where there is no connection */
718
 
 
719
695
        if (unlikely(sock->state != SS_CONNECTED)) {
720
696
                if (sock->state == SS_UNCONNECTED) {
721
697
                        res = send_packet(NULL, sock, m, total_len);
734
710
                goto exit;
735
711
        }
736
712
 
737
 
        if ((total_len > (unsigned)INT_MAX) ||
738
 
            (m->msg_iovlen > (unsigned)INT_MAX)) {
 
713
        if ((total_len > (unsigned int)INT_MAX) ||
 
714
            (m->msg_iovlen > (unsigned int)INT_MAX)) {
739
715
                res = -EMSGSIZE;
740
716
                goto exit;
741
717
        }
747
723
         * (i.e. one large iovec entry), but could be improved to pass sets
748
724
         * of small iovec entries into send_packet().
749
725
         */
750
 
 
751
726
        curr_iov = m->msg_iov;
752
727
        curr_iovlen = m->msg_iovlen;
753
728
        my_msg.msg_iov = &my_iov;
796
771
 *
797
772
 * Returns 0 on success, errno otherwise
798
773
 */
799
 
 
800
774
static int auto_connect(struct socket *sock, struct tipc_msg *msg)
801
775
{
802
776
        struct tipc_sock *tsock = tipc_sk(sock->sk);
821
795
 *
822
796
 * Note: Address is not captured if not requested by receiver.
823
797
 */
824
 
 
825
798
static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
826
799
{
827
800
        struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name;
847
820
 *
848
821
 * Returns 0 if successful, otherwise errno
849
822
 */
850
 
 
851
823
static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
852
824
                                struct tipc_port *tport)
853
825
{
861
833
                return 0;
862
834
 
863
835
        /* Optionally capture errored message object(s) */
864
 
 
865
836
        err = msg ? msg_errcode(msg) : 0;
866
837
        if (unlikely(err)) {
867
838
                anc_data[0] = err;
878
849
        }
879
850
 
880
851
        /* Optionally capture message destination object */
881
 
 
882
852
        dest_type = msg ? msg_type(msg) : TIPC_DIRECT_MSG;
883
853
        switch (dest_type) {
884
854
        case TIPC_NAMED_MSG:
923
893
 *
924
894
 * Returns size of returned message data, errno otherwise
925
895
 */
926
 
 
927
896
static int recv_msg(struct kiocb *iocb, struct socket *sock,
928
897
                    struct msghdr *m, size_t buf_len, int flags)
929
898
{
937
906
        int res;
938
907
 
939
908
        /* Catch invalid receive requests */
940
 
 
941
909
        if (unlikely(!buf_len))
942
910
                return -EINVAL;
943
911
 
952
920
restart:
953
921
 
954
922
        /* Look for a message in receive queue; wait if necessary */
955
 
 
956
923
        while (skb_queue_empty(&sk->sk_receive_queue)) {
957
924
                if (sock->state == SS_DISCONNECTING) {
958
925
                        res = -ENOTCONN;
970
937
        }
971
938
 
972
939
        /* Look at first message in receive queue */
973
 
 
974
940
        buf = skb_peek(&sk->sk_receive_queue);
975
941
        msg = buf_msg(buf);
976
942
        sz = msg_data_sz(msg);
977
943
        err = msg_errcode(msg);
978
944
 
979
945
        /* Complete connection setup for an implied connect */
980
 
 
981
946
        if (unlikely(sock->state == SS_CONNECTING)) {
982
947
                res = auto_connect(sock, msg);
983
948
                if (res)
985
950
        }
986
951
 
987
952
        /* Discard an empty non-errored message & try again */
988
 
 
989
953
        if ((!sz) && (!err)) {
990
954
                advance_rx_queue(sk);
991
955
                goto restart;
992
956
        }
993
957
 
994
958
        /* Capture sender's address (optional) */
995
 
 
996
959
        set_orig_addr(m, msg);
997
960
 
998
961
        /* Capture ancillary data (optional) */
999
 
 
1000
962
        res = anc_data_recv(m, msg, tport);
1001
963
        if (res)
1002
964
                goto exit;
1003
965
 
1004
966
        /* Capture message data (if valid) & compute return value (always) */
1005
 
 
1006
967
        if (!err) {
1007
968
                if (unlikely(buf_len < sz)) {
1008
969
                        sz = buf_len;
1022
983
        }
1023
984
 
1024
985
        /* Consume received message (optional) */
1025
 
 
1026
986
        if (likely(!(flags & MSG_PEEK))) {
1027
987
                if ((sock->state != SS_READY) &&
1028
988
                    (++tport->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
1046
1006
 *
1047
1007
 * Returns size of returned message data, errno otherwise
1048
1008
 */
1049
 
 
1050
1009
static int recv_stream(struct kiocb *iocb, struct socket *sock,
1051
1010
                       struct msghdr *m, size_t buf_len, int flags)
1052
1011
{
1062
1021
        int res = 0;
1063
1022
 
1064
1023
        /* Catch invalid receive attempts */
1065
 
 
1066
1024
        if (unlikely(!buf_len))
1067
1025
                return -EINVAL;
1068
1026
 
1076
1034
 
1077
1035
        target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len);
1078
1036
        timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
 
1037
 
1079
1038
restart:
1080
 
 
1081
1039
        /* Look for a message in receive queue; wait if necessary */
1082
 
 
1083
1040
        while (skb_queue_empty(&sk->sk_receive_queue)) {
1084
1041
                if (sock->state == SS_DISCONNECTING) {
1085
1042
                        res = -ENOTCONN;
1097
1054
        }
1098
1055
 
1099
1056
        /* Look at first message in receive queue */
1100
 
 
1101
1057
        buf = skb_peek(&sk->sk_receive_queue);
1102
1058
        msg = buf_msg(buf);
1103
1059
        sz = msg_data_sz(msg);
1104
1060
        err = msg_errcode(msg);
1105
1061
 
1106
1062
        /* Discard an empty non-errored message & try again */
1107
 
 
1108
1063
        if ((!sz) && (!err)) {
1109
1064
                advance_rx_queue(sk);
1110
1065
                goto restart;
1111
1066
        }
1112
1067
 
1113
1068
        /* Optionally capture sender's address & ancillary data of first msg */
1114
 
 
1115
1069
        if (sz_copied == 0) {
1116
1070
                set_orig_addr(m, msg);
1117
1071
                res = anc_data_recv(m, msg, tport);
1120
1074
        }
1121
1075
 
1122
1076
        /* Capture message data (if valid) & compute return value (always) */
1123
 
 
1124
1077
        if (!err) {
1125
1078
                u32 offset = (u32)(unsigned long)(TIPC_SKB_CB(buf)->handle);
1126
1079
 
1152
1105
        }
1153
1106
 
1154
1107
        /* Consume received message (optional) */
1155
 
 
1156
1108
        if (likely(!(flags & MSG_PEEK))) {
1157
1109
                if (unlikely(++tport->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
1158
1110
                        tipc_acknowledge(tport->ref, tport->conn_unacked);
1160
1112
        }
1161
1113
 
1162
1114
        /* Loop around if more data is required */
1163
 
 
1164
1115
        if ((sz_copied < buf_len) &&    /* didn't get all requested data */
1165
1116
            (!skb_queue_empty(&sk->sk_receive_queue) ||
1166
1117
            (sz_copied < target)) &&    /* and more is ready or required */
1181
1132
 *
1182
1133
 * Returns 1 if queue is unable to accept message, 0 otherwise
1183
1134
 */
1184
 
 
1185
1135
static int rx_queue_full(struct tipc_msg *msg, u32 queue_size, u32 base)
1186
1136
{
1187
1137
        u32 threshold;
1214
1164
 *
1215
1165
 * Returns TIPC error status code (TIPC_OK if message is not to be rejected)
1216
1166
 */
1217
 
 
1218
1167
static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
1219
1168
{
1220
1169
        struct socket *sock = sk->sk_socket;
1222
1171
        u32 recv_q_len;
1223
1172
 
1224
1173
        /* Reject message if it is wrong sort of message for socket */
1225
 
 
1226
 
        /*
1227
 
         * WOULD IT BE BETTER TO JUST DISCARD THESE MESSAGES INSTEAD?
1228
 
         * "NO PORT" ISN'T REALLY THE RIGHT ERROR CODE, AND THERE MAY
1229
 
         * BE SECURITY IMPLICATIONS INHERENT IN REJECTING INVALID TRAFFIC
1230
 
         */
 
1174
        if (msg_type(msg) > TIPC_DIRECT_MSG)
 
1175
                return TIPC_ERR_NO_PORT;
1231
1176
 
1232
1177
        if (sock->state == SS_READY) {
1233
1178
                if (msg_connected(msg))
1236
1181
                if (msg_mcast(msg))
1237
1182
                        return TIPC_ERR_NO_PORT;
1238
1183
                if (sock->state == SS_CONNECTED) {
1239
 
                        if (!msg_connected(msg))
 
1184
                        if (!msg_connected(msg) ||
 
1185
                            !tipc_port_peer_msg(tipc_sk_port(sk), msg))
1240
1186
                                return TIPC_ERR_NO_PORT;
1241
1187
                } else if (sock->state == SS_CONNECTING) {
1242
1188
                        if (!msg_connected(msg) && (msg_errcode(msg) == 0))
1253
1199
        }
1254
1200
 
1255
1201
        /* Reject message if there isn't room to queue it */
1256
 
 
1257
1202
        recv_q_len = (u32)atomic_read(&tipc_queue_size);
1258
1203
        if (unlikely(recv_q_len >= OVERLOAD_LIMIT_BASE)) {
1259
1204
                if (rx_queue_full(msg, recv_q_len, OVERLOAD_LIMIT_BASE))
1266
1211
        }
1267
1212
 
1268
1213
        /* Enqueue message (finally!) */
1269
 
 
1270
1214
        TIPC_SKB_CB(buf)->handle = 0;
1271
1215
        atomic_inc(&tipc_queue_size);
1272
1216
        __skb_queue_tail(&sk->sk_receive_queue, buf);
1273
1217
 
1274
1218
        /* Initiate connection termination for an incoming 'FIN' */
1275
 
 
1276
1219
        if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) {
1277
1220
                sock->state = SS_DISCONNECTING;
1278
1221
                tipc_disconnect_port(tipc_sk_port(sk));
1292
1235
 *
1293
1236
 * Returns 0
1294
1237
 */
1295
 
 
1296
1238
static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
1297
1239
{
1298
1240
        u32 res;
1312
1254
 *
1313
1255
 * Returns TIPC error status code (TIPC_OK if message is not to be rejected)
1314
1256
 */
1315
 
 
1316
1257
static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1317
1258
{
1318
1259
        struct sock *sk = (struct sock *)tport->usr_handle;
1324
1265
         * This code is based on sk_receive_skb(), but must be distinct from it
1325
1266
         * since a TIPC-specific filter/reject mechanism is utilized
1326
1267
         */
1327
 
 
1328
1268
        bh_lock_sock(sk);
1329
1269
        if (!sock_owned_by_user(sk)) {
1330
1270
                res = filter_rcv(sk, buf);
1331
1271
        } else {
1332
 
                if (sk_add_backlog(sk, buf))
 
1272
                if (sk_add_backlog(sk, buf, sk->sk_rcvbuf))
1333
1273
                        res = TIPC_ERR_OVERLOAD;
1334
1274
                else
1335
1275
                        res = TIPC_OK;
1345
1285
 *
1346
1286
 * Called with port lock already taken.
1347
1287
 */
1348
 
 
1349
1288
static void wakeupdispatch(struct tipc_port *tport)
1350
1289
{
1351
1290
        struct sock *sk = (struct sock *)tport->usr_handle;
1363
1302
 *
1364
1303
 * Returns 0 on success, errno otherwise
1365
1304
 */
1366
 
 
1367
1305
static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1368
1306
                   int flags)
1369
1307
{
1378
1316
        lock_sock(sk);
1379
1317
 
1380
1318
        /* For now, TIPC does not allow use of connect() with DGRAM/RDM types */
1381
 
 
1382
1319
        if (sock->state == SS_READY) {
1383
1320
                res = -EOPNOTSUPP;
1384
1321
                goto exit;
1385
1322
        }
1386
1323
 
1387
1324
        /* For now, TIPC does not support the non-blocking form of connect() */
1388
 
 
1389
1325
        if (flags & O_NONBLOCK) {
1390
1326
                res = -EOPNOTSUPP;
1391
1327
                goto exit;
1392
1328
        }
1393
1329
 
1394
1330
        /* Issue Posix-compliant error code if socket is in the wrong state */
1395
 
 
1396
1331
        if (sock->state == SS_LISTENING) {
1397
1332
                res = -EOPNOTSUPP;
1398
1333
                goto exit;
1412
1347
         * Note: send_msg() validates the rest of the address fields,
1413
1348
         *       so there's no need to do it here
1414
1349
         */
1415
 
 
1416
1350
        if (dst->addrtype == TIPC_ADDR_MCAST) {
1417
1351
                res = -EINVAL;
1418
1352
                goto exit;
1419
1353
        }
1420
1354
 
1421
1355
        /* Reject any messages already in receive queue (very unlikely) */
1422
 
 
1423
1356
        reject_rx_queue(sk);
1424
1357
 
1425
1358
        /* Send a 'SYN-' to destination */
1426
 
 
1427
1359
        m.msg_name = dest;
1428
1360
        m.msg_namelen = destlen;
1429
1361
        res = send_msg(NULL, sock, &m, 0);
1431
1363
                goto exit;
1432
1364
 
1433
1365
        /* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */
1434
 
 
1435
1366
        timeout = tipc_sk(sk)->conn_timeout;
1436
1367
        release_sock(sk);
1437
1368
        res = wait_event_interruptible_timeout(*sk_sleep(sk),
1476
1407
 *
1477
1408
 * Returns 0 on success, errno otherwise
1478
1409
 */
1479
 
 
1480
1410
static int listen(struct socket *sock, int len)
1481
1411
{
1482
1412
        struct sock *sk = sock->sk;
1503
1433
 *
1504
1434
 * Returns 0 on success, errno otherwise
1505
1435
 */
1506
 
 
1507
1436
static int accept(struct socket *sock, struct socket *new_sock, int flags)
1508
1437
{
1509
1438
        struct sock *sk = sock->sk;
1546
1475
                 * Reject any stray messages received by new socket
1547
1476
                 * before the socket lock was taken (very, very unlikely)
1548
1477
                 */
1549
 
 
1550
1478
                reject_rx_queue(new_sk);
1551
1479
 
1552
1480
                /* Connect new socket to it's peer */
1553
 
 
1554
1481
                new_tsock->peer_name.ref = msg_origport(msg);
1555
1482
                new_tsock->peer_name.node = msg_orignode(msg);
1556
1483
                tipc_connect2port(new_ref, &new_tsock->peer_name);
1566
1493
                 * Respond to 'SYN-' by discarding it & returning 'ACK'-.
1567
1494
                 * Respond to 'SYN+' by queuing it on new socket.
1568
1495
                 */
1569
 
 
1570
1496
                if (!msg_data_sz(msg)) {
1571
1497
                        struct msghdr m = {NULL,};
1572
1498
 
1592
1518
 *
1593
1519
 * Returns 0 on success, errno otherwise
1594
1520
 */
1595
 
 
1596
1521
static int shutdown(struct socket *sock, int how)
1597
1522
{
1598
1523
        struct sock *sk = sock->sk;
1609
1534
        case SS_CONNECTING:
1610
1535
        case SS_CONNECTED:
1611
1536
 
 
1537
restart:
1612
1538
                /* Disconnect and send a 'FIN+' or 'FIN-' message to peer */
1613
 
restart:
1614
1539
                buf = __skb_dequeue(&sk->sk_receive_queue);
1615
1540
                if (buf) {
1616
1541
                        atomic_dec(&tipc_queue_size);
1631
1556
        case SS_DISCONNECTING:
1632
1557
 
1633
1558
                /* Discard any unreceived messages; wake up sleeping tasks */
1634
 
 
1635
1559
                discard_rx_queue(sk);
1636
1560
                if (waitqueue_active(sk_sleep(sk)))
1637
1561
                        wake_up_interruptible(sk_sleep(sk));
1659
1583
 *
1660
1584
 * Returns 0 on success, errno otherwise
1661
1585
 */
1662
 
 
1663
1586
static int setsockopt(struct socket *sock,
1664
1587
                      int lvl, int opt, char __user *ov, unsigned int ol)
1665
1588
{
1719
1642
 *
1720
1643
 * Returns 0 on success, errno otherwise
1721
1644
 */
1722
 
 
1723
1645
static int getsockopt(struct socket *sock,
1724
1646
                      int lvl, int opt, char __user *ov, int __user *ol)
1725
1647
{
1780
1702
/**
1781
1703
 * Protocol switches for the various types of TIPC sockets
1782
1704
 */
1783
 
 
1784
1705
static const struct proto_ops msg_ops = {
1785
1706
        .owner          = THIS_MODULE,
1786
1707
        .family         = AF_TIPC,
1886
1807
/**
1887
1808
 * tipc_socket_stop - stop TIPC socket interface
1888
1809
 */
1889
 
 
1890
1810
void tipc_socket_stop(void)
1891
1811
{
1892
1812
        if (!sockets_enabled)
1896
1816
        sock_unregister(tipc_family_ops.family);
1897
1817
        proto_unregister(&tipc_proto);
1898
1818
}
1899