Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tipc: update address terminology in code

We update the terminology in the code so that deprecated structure
names and macros are replaced with those currently recommended in
the user API.

struct tipc_portid -> struct tipc_socket_addr
struct tipc_name -> struct tipc_service_addr
struct tipc_name_seq -> struct tipc_service_range

TIPC_ADDR_ID -> TIPC_SOCKET_ADDR
TIPC_ADDR_NAME -> TIPC_SERVICE_ADDR
TIPC_ADDR_NAMESEQ -> TIPC_SERVICE_RANGE
TIPC_CFG_SRV -> TIPC_NODE_STATE

Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jon Maloy and committed by
Jakub Kicinski
b6f88d9c 5f75e0a0

+41 -36
+2 -1
net/tipc/group.c
··· 2 2 * net/tipc/group.c: TIPC group messaging code 3 3 * 4 4 * Copyright (c) 2017, Ericsson AB 5 + * Copyright (c) 2020, Red Hat Inc 5 6 * All rights reserved. 6 7 * 7 8 * Redistribution and use in source and binary forms, with or without ··· 360 359 return &grp->dests; 361 360 } 362 361 363 - void tipc_group_self(struct tipc_group *grp, struct tipc_name_seq *seq, 362 + void tipc_group_self(struct tipc_group *grp, struct tipc_service_range *seq, 364 363 int *scope) 365 364 { 366 365 seq->type = grp->type;
+2 -1
net/tipc/group.h
··· 2 2 * net/tipc/group.h: Include file for TIPC group unicast/multicast functions 3 3 * 4 4 * Copyright (c) 2017, Ericsson AB 5 + * Copyright (c) 2020, Red Hat Inc 5 6 * All rights reserved. 6 7 * 7 8 * Redistribution and use in source and binary forms, with or without ··· 51 50 void tipc_group_add_member(struct tipc_group *grp, u32 node, 52 51 u32 port, u32 instance); 53 52 struct tipc_nlist *tipc_group_dests(struct tipc_group *grp); 54 - void tipc_group_self(struct tipc_group *grp, struct tipc_name_seq *seq, 53 + void tipc_group_self(struct tipc_group *grp, struct tipc_service_range *seq, 55 54 int *scope); 56 55 u32 tipc_group_exclude(struct tipc_group *grp); 57 56 void tipc_group_filter_msg(struct tipc_group *grp,
+6 -5
net/tipc/name_table.c
··· 3 3 * 4 4 * Copyright (c) 2000-2006, 2014-2018, Ericsson AB 5 5 * Copyright (c) 2004-2008, 2010-2014, Wind River Systems 6 + * Copyright (c) 2020, Red Hat Inc 6 7 * All rights reserved. 7 8 * 8 9 * Redistribution and use in source and binary forms, with or without ··· 404 403 struct publication *p, *first, *tmp; 405 404 struct list_head publ_list; 406 405 struct service_range *sr; 407 - struct tipc_name_seq ns; 406 + struct tipc_service_range r; 408 407 u32 filter; 409 408 410 - ns.type = tipc_sub_read(sb, seq.type); 411 - ns.lower = tipc_sub_read(sb, seq.lower); 412 - ns.upper = tipc_sub_read(sb, seq.upper); 409 + r.type = tipc_sub_read(sb, seq.type); 410 + r.lower = tipc_sub_read(sb, seq.lower); 411 + r.upper = tipc_sub_read(sb, seq.upper); 413 412 filter = tipc_sub_read(sb, filter); 414 413 415 414 tipc_sub_get(sub); ··· 419 418 return; 420 419 421 420 INIT_LIST_HEAD(&publ_list); 422 - service_range_foreach_match(sr, service, ns.lower, ns.upper) { 421 + service_range_foreach_match(sr, service, r.lower, r.upper) { 423 422 first = NULL; 424 423 list_for_each_entry(p, &sr->all_publ, all_publ) { 425 424 if (filter & TIPC_SUB_PORTS)
+1 -1
net/tipc/net.c
··· 132 132 tipc_named_reinit(net); 133 133 tipc_sk_reinit(net); 134 134 tipc_mon_reinit_self(net); 135 - tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, 135 + tipc_nametbl_publish(net, TIPC_NODE_STATE, addr, addr, 136 136 TIPC_CLUSTER_SCOPE, 0, addr); 137 137 } 138 138
+22 -22
net/tipc/socket.c
··· 139 139 bool kern); 140 140 static void tipc_sk_timeout(struct timer_list *t); 141 141 static int tipc_sk_publish(struct tipc_sock *tsk, uint scope, 142 - struct tipc_name_seq const *seq); 142 + struct tipc_service_range const *seq); 143 143 static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope, 144 - struct tipc_name_seq const *seq); 144 + struct tipc_service_range const *seq); 145 145 static int tipc_sk_leave(struct tipc_sock *tsk); 146 146 static struct tipc_sock *tipc_sk_lookup(struct net *net, u32 portid); 147 147 static int tipc_sk_insert(struct tipc_sock *tsk); ··· 667 667 if (unlikely(!alen)) 668 668 return tipc_sk_withdraw(tsk, 0, NULL); 669 669 670 - if (addr->addrtype == TIPC_ADDR_NAME) 670 + if (addr->addrtype == TIPC_SERVICE_ADDR) 671 671 addr->addr.nameseq.upper = addr->addr.nameseq.lower; 672 672 673 673 if (tsk->group) ··· 740 740 addr->addr.id.node = tipc_own_addr(sock_net(sk)); 741 741 } 742 742 743 - addr->addrtype = TIPC_ADDR_ID; 743 + addr->addrtype = TIPC_SOCKET_ADDR; 744 744 addr->family = AF_TIPC; 745 745 addr->scope = 0; 746 746 addr->addr.name.domain = 0; ··· 818 818 * Called from function tipc_sendmsg(), which has done all sanity checks 819 819 * Returns the number of bytes sent on success, or errno 820 820 */ 821 - static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq, 821 + static int tipc_sendmcast(struct socket *sock, struct tipc_service_range *seq, 822 822 struct msghdr *msg, size_t dlen, long timeout) 823 823 { 824 824 struct sock *sk = sock->sk; ··· 1403 1403 bool syn = !tipc_sk_type_connectionless(sk); 1404 1404 struct tipc_group *grp = tsk->group; 1405 1405 struct tipc_msg *hdr = &tsk->phdr; 1406 - struct tipc_name_seq *seq; 1406 + struct tipc_service_range *seq; 1407 1407 struct sk_buff_head pkts; 1408 1408 u32 dport = 0, dnode = 0; 1409 1409 u32 type = 0, inst = 0; ··· 1422 1422 if (grp) { 1423 1423 if (!dest) 1424 1424 return tipc_send_group_bcast(sock, m, dlen, timeout); 1425 - if (dest->addrtype == TIPC_ADDR_NAME) 1425 + if (dest->addrtype == TIPC_SERVICE_ADDR) 1426 1426 return tipc_send_group_anycast(sock, m, dlen, timeout); 1427 - if (dest->addrtype == TIPC_ADDR_ID) 1427 + if (dest->addrtype == TIPC_SOCKET_ADDR) 1428 1428 return tipc_send_group_unicast(sock, m, dlen, timeout); 1429 1429 if (dest->addrtype == TIPC_ADDR_MCAST) 1430 1430 return tipc_send_group_mcast(sock, m, dlen, timeout); ··· 1444 1444 return -EISCONN; 1445 1445 if (tsk->published) 1446 1446 return -EOPNOTSUPP; 1447 - if (dest->addrtype == TIPC_ADDR_NAME) { 1447 + if (dest->addrtype == TIPC_SERVICE_ADDR) { 1448 1448 tsk->conn_type = dest->addr.name.name.type; 1449 1449 tsk->conn_instance = dest->addr.name.name.instance; 1450 1450 } ··· 1455 1455 if (dest->addrtype == TIPC_ADDR_MCAST) 1456 1456 return tipc_sendmcast(sock, seq, m, dlen, timeout); 1457 1457 1458 - if (dest->addrtype == TIPC_ADDR_NAME) { 1458 + if (dest->addrtype == TIPC_SERVICE_ADDR) { 1459 1459 type = dest->addr.name.name.type; 1460 1460 inst = dest->addr.name.name.instance; 1461 1461 dnode = dest->addr.name.domain; 1462 1462 dport = tipc_nametbl_translate(net, type, inst, &dnode); 1463 1463 if (unlikely(!dport && !dnode)) 1464 1464 return -EHOSTUNREACH; 1465 - } else if (dest->addrtype == TIPC_ADDR_ID) { 1465 + } else if (dest->addrtype == TIPC_SOCKET_ADDR) { 1466 1466 dnode = dest->addr.id.node; 1467 1467 } else { 1468 1468 return -EINVAL; ··· 1474 1474 if (unlikely(rc)) 1475 1475 return rc; 1476 1476 1477 - if (dest->addrtype == TIPC_ADDR_NAME) { 1477 + if (dest->addrtype == TIPC_SERVICE_ADDR) { 1478 1478 msg_set_type(hdr, TIPC_NAMED_MSG); 1479 1479 msg_set_hdr_sz(hdr, NAMED_H_SIZE); 1480 1480 msg_set_nametype(hdr, type); ··· 1482 1482 msg_set_lookup_scope(hdr, tipc_node2scope(dnode)); 1483 1483 msg_set_destnode(hdr, dnode); 1484 1484 msg_set_destport(hdr, dport); 1485 - } else { /* TIPC_ADDR_ID */ 1485 + } else { /* TIPC_SOCKET_ADDR */ 1486 1486 msg_set_type(hdr, TIPC_DIRECT_MSG); 1487 1487 msg_set_lookup_scope(hdr, 0); 1488 1488 msg_set_destnode(hdr, dnode); ··· 1687 1687 return; 1688 1688 1689 1689 srcaddr->sock.family = AF_TIPC; 1690 - srcaddr->sock.addrtype = TIPC_ADDR_ID; 1690 + srcaddr->sock.addrtype = TIPC_SOCKET_ADDR; 1691 1691 srcaddr->sock.scope = 0; 1692 1692 srcaddr->sock.addr.id.ref = msg_origport(hdr); 1693 1693 srcaddr->sock.addr.id.node = msg_orignode(hdr); ··· 1699 1699 1700 1700 /* Group message users may also want to know sending member's id */ 1701 1701 srcaddr->member.family = AF_TIPC; 1702 - srcaddr->member.addrtype = TIPC_ADDR_NAME; 1702 + srcaddr->member.addrtype = TIPC_SERVICE_ADDR; 1703 1703 srcaddr->member.scope = 0; 1704 1704 srcaddr->member.addr.name.name.type = msg_nametype(hdr); 1705 1705 srcaddr->member.addr.name.name.instance = TIPC_SKB_CB(skb)->orig_member; ··· 2867 2867 } 2868 2868 2869 2869 static int tipc_sk_publish(struct tipc_sock *tsk, uint scope, 2870 - struct tipc_name_seq const *seq) 2870 + struct tipc_service_range const *seq) 2871 2871 { 2872 2872 struct sock *sk = &tsk->sk; 2873 2873 struct net *net = sock_net(sk); ··· 2895 2895 } 2896 2896 2897 2897 static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope, 2898 - struct tipc_name_seq const *seq) 2898 + struct tipc_service_range const *seq) 2899 2899 { 2900 2900 struct net *net = sock_net(&tsk->sk); 2901 2901 struct publication *publ; ··· 3042 3042 struct net *net = sock_net(&tsk->sk); 3043 3043 struct tipc_group *grp = tsk->group; 3044 3044 struct tipc_msg *hdr = &tsk->phdr; 3045 - struct tipc_name_seq seq; 3045 + struct tipc_service_range seq; 3046 3046 int rc; 3047 3047 3048 3048 if (mreq->type < TIPC_RESERVED_TYPES) ··· 3079 3079 { 3080 3080 struct net *net = sock_net(&tsk->sk); 3081 3081 struct tipc_group *grp = tsk->group; 3082 - struct tipc_name_seq seq; 3082 + struct tipc_service_range seq; 3083 3083 int scope; 3084 3084 3085 3085 if (!grp) ··· 3203 3203 { 3204 3204 struct sock *sk = sock->sk; 3205 3205 struct tipc_sock *tsk = tipc_sk(sk); 3206 - struct tipc_name_seq seq; 3206 + struct tipc_service_range seq; 3207 3207 int len, scope; 3208 3208 u32 value; 3209 3209 int res; ··· 3304 3304 u32 onode = tipc_own_addr(sock_net(sock1->sk)); 3305 3305 3306 3306 tsk1->peer.family = AF_TIPC; 3307 - tsk1->peer.addrtype = TIPC_ADDR_ID; 3307 + tsk1->peer.addrtype = TIPC_SOCKET_ADDR; 3308 3308 tsk1->peer.scope = TIPC_NODE_SCOPE; 3309 3309 tsk1->peer.addr.id.ref = tsk2->portid; 3310 3310 tsk1->peer.addr.id.node = onode; 3311 3311 tsk2->peer.family = AF_TIPC; 3312 - tsk2->peer.addrtype = TIPC_ADDR_ID; 3312 + tsk2->peer.addrtype = TIPC_SOCKET_ADDR; 3313 3313 tsk2->peer.scope = TIPC_NODE_SCOPE; 3314 3314 tsk2->peer.addr.id.ref = tsk1->portid; 3315 3315 tsk2->peer.addr.id.node = onode;
+3 -2
net/tipc/subscr.c
··· 3 3 * 4 4 * Copyright (c) 2000-2017, Ericsson AB 5 5 * Copyright (c) 2005-2007, 2010-2013, Wind River Systems 6 + * Copyright (c) 2020, Red Hat Inc 6 7 * All rights reserved. 7 8 * 8 9 * Redistribution and use in source and binary forms, with or without ··· 61 60 * 62 61 * Returns 1 if there is overlap, otherwise 0. 63 62 */ 64 - int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower, 63 + int tipc_sub_check_overlap(struct tipc_service_range *seq, u32 found_lower, 65 64 u32 found_upper) 66 65 { 67 66 if (found_lower < seq->lower) ··· 80 79 { 81 80 struct tipc_subscr *s = &sub->evt.s; 82 81 u32 filter = tipc_sub_read(s, filter); 83 - struct tipc_name_seq seq; 82 + struct tipc_service_range seq; 84 83 85 84 seq.type = tipc_sub_read(s, seq.type); 86 85 seq.lower = tipc_sub_read(s, seq.lower);
+3 -2
net/tipc/subscr.h
··· 3 3 * 4 4 * Copyright (c) 2003-2017, Ericsson AB 5 5 * Copyright (c) 2005-2007, 2012-2013, Wind River Systems 6 + * Copyright (c) 2020, Red Hat Inc 6 7 * All rights reserved. 7 8 * 8 9 * Redistribution and use in source and binary forms, with or without ··· 72 71 int conid); 73 72 void tipc_sub_unsubscribe(struct tipc_subscription *sub); 74 73 75 - int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower, 76 - u32 found_upper); 74 + int tipc_sub_check_overlap(struct tipc_service_range *seq, 75 + u32 found_lower, u32 found_upper); 77 76 void tipc_sub_report_overlap(struct tipc_subscription *sub, 78 77 u32 found_lower, u32 found_upper, 79 78 u32 event, u32 port, u32 node,
+2 -2
net/tipc/topsrv.c
··· 519 519 goto err; 520 520 521 521 saddr.family = AF_TIPC; 522 - saddr.addrtype = TIPC_ADDR_NAMESEQ; 523 - saddr.addr.nameseq.type = TIPC_TOP_SRV; 522 + saddr.addrtype = TIPC_SERVICE_RANGE; 523 + saddr.addr.nameseq.type = TIPC_TOP_SRV; 524 524 saddr.addr.nameseq.lower = TIPC_TOP_SRV; 525 525 saddr.addr.nameseq.upper = TIPC_TOP_SRV; 526 526 saddr.scope = TIPC_NODE_SCOPE;