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

ipvs: Clean up comment style in ip_vs.h

* Consistently use the multi-line comment style for networking code:

/* This
* That
* The other thing
*/

* Use single-line comment style for comments with only one line of text.

* In general follow the leading '*' of each line of a comment with a
single space and then text.

* Add missing line break between functions, remove double line break,
align comments to previous lines whenever possible.

Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Simon Horman and committed by
Pablo Neira Ayuso
07dcc686 4b7fd5d9

+75 -139
+75 -139
include/net/ip_vs.h
··· 1 - /* 2 - * IP Virtual Server 3 - * data structure and functionality definitions 1 + /* IP Virtual Server 2 + * data structure and functionality definitions 4 3 */ 5 4 6 5 #ifndef _NET_IP_VS_H ··· 11 12 12 13 #include <linux/list.h> /* for struct list_head */ 13 14 #include <linux/spinlock.h> /* for struct rwlock_t */ 14 - #include <linux/atomic.h> /* for struct atomic_t */ 15 + #include <linux/atomic.h> /* for struct atomic_t */ 15 16 #include <linux/compiler.h> 16 17 #include <linux/timer.h> 17 18 #include <linux/bug.h> ··· 29 30 #endif 30 31 #include <net/net_namespace.h> /* Netw namespace */ 31 32 32 - /* 33 - * Generic access of ipvs struct 34 - */ 33 + /* Generic access of ipvs struct */ 35 34 static inline struct netns_ipvs *net_ipvs(struct net* net) 36 35 { 37 36 return net->ipvs; 38 37 } 39 - /* 40 - * Get net ptr from skb in traffic cases 38 + 39 + /* Get net ptr from skb in traffic cases 41 40 * use skb_sknet when call is from userland (ioctl or netlink) 42 41 */ 43 42 static inline struct net *skb_net(const struct sk_buff *skb) ··· 87 90 return &init_net; 88 91 #endif 89 92 } 90 - /* 91 - * This one needed for single_open_net since net is stored directly in 93 + 94 + /* This one needed for single_open_net since net is stored directly in 92 95 * private not as a struct i.e. seq_file_net can't be used. 93 96 */ 94 97 static inline struct net *seq_file_single_net(struct seq_file *seq) ··· 105 108 106 109 struct ip_vs_iphdr { 107 110 __u32 len; /* IPv4 simply where L4 starts 108 - IPv6 where L4 Transport Header starts */ 111 + * IPv6 where L4 Transport Header starts */ 109 112 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ 110 113 __s16 protocol; 111 114 __s32 flags; ··· 301 304 #define LeaveFunction(level) do {} while (0) 302 305 #endif 303 306 304 - 305 - /* 306 - * The port number of FTP service (in network order). 307 - */ 307 + /* The port number of FTP service (in network order). */ 308 308 #define FTPPORT cpu_to_be16(21) 309 309 #define FTPDATA cpu_to_be16(20) 310 310 311 - /* 312 - * TCP State Values 313 - */ 311 + /* TCP State Values */ 314 312 enum { 315 313 IP_VS_TCP_S_NONE = 0, 316 314 IP_VS_TCP_S_ESTABLISHED, ··· 321 329 IP_VS_TCP_S_LAST 322 330 }; 323 331 324 - /* 325 - * UDP State Values 326 - */ 332 + /* UDP State Values */ 327 333 enum { 328 334 IP_VS_UDP_S_NORMAL, 329 335 IP_VS_UDP_S_LAST, 330 336 }; 331 337 332 - /* 333 - * ICMP State Values 334 - */ 338 + /* ICMP State Values */ 335 339 enum { 336 340 IP_VS_ICMP_S_NORMAL, 337 341 IP_VS_ICMP_S_LAST, 338 342 }; 339 343 340 - /* 341 - * SCTP State Values 342 - */ 344 + /* SCTP State Values */ 343 345 enum ip_vs_sctp_states { 344 346 IP_VS_SCTP_S_NONE, 345 347 IP_VS_SCTP_S_INIT1, ··· 352 366 IP_VS_SCTP_S_LAST 353 367 }; 354 368 355 - /* 356 - * Delta sequence info structure 357 - * Each ip_vs_conn has 2 (output AND input seq. changes). 358 - * Only used in the VS/NAT. 369 + /* Delta sequence info structure 370 + * Each ip_vs_conn has 2 (output AND input seq. changes). 371 + * Only used in the VS/NAT. 359 372 */ 360 373 struct ip_vs_seq { 361 374 __u32 init_seq; /* Add delta from this seq */ 362 375 __u32 delta; /* Delta in sequence numbers */ 363 376 __u32 previous_delta; /* Delta in sequence numbers 364 - before last resized pkt */ 377 + * before last resized pkt */ 365 378 }; 366 379 367 - /* 368 - * counters per cpu 369 - */ 380 + /* counters per cpu */ 370 381 struct ip_vs_counters { 371 382 __u32 conns; /* connections scheduled */ 372 383 __u32 inpkts; /* incoming packets */ ··· 371 388 __u64 inbytes; /* incoming bytes */ 372 389 __u64 outbytes; /* outgoing bytes */ 373 390 }; 374 - /* 375 - * Stats per cpu 376 - */ 391 + /* Stats per cpu */ 377 392 struct ip_vs_cpu_stats { 378 393 struct ip_vs_counters ustats; 379 394 struct u64_stats_sync syncp; 380 395 }; 381 396 382 - /* 383 - * IPVS statistics objects 384 - */ 397 + /* IPVS statistics objects */ 385 398 struct ip_vs_estimator { 386 399 struct list_head list; 387 400 ··· 470 491 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags); 471 492 }; 472 493 473 - /* 474 - * protocol data per netns 475 - */ 494 + /* protocol data per netns */ 476 495 struct ip_vs_proto_data { 477 496 struct ip_vs_proto_data *next; 478 497 struct ip_vs_protocol *pp; ··· 497 520 __u8 pe_data_len; 498 521 }; 499 522 500 - /* 501 - * IP_VS structure allocated for each dynamically scheduled connection 502 - */ 523 + /* IP_VS structure allocated for each dynamically scheduled connection */ 503 524 struct ip_vs_conn { 504 525 struct hlist_node c_list; /* hashed list heads */ 505 526 /* Protocol, addresses and port numbers */ ··· 536 561 struct ip_vs_dest *dest; /* real server */ 537 562 atomic_t in_pkts; /* incoming packet counter */ 538 563 539 - /* packet transmitter for different forwarding methods. If it 540 - mangles the packet, it must return NF_DROP or better NF_STOLEN, 541 - otherwise this must be changed to a sk_buff **. 542 - NF_ACCEPT can be returned when destination is local. 564 + /* Packet transmitter for different forwarding methods. If it 565 + * mangles the packet, it must return NF_DROP or better NF_STOLEN, 566 + * otherwise this must be changed to a sk_buff **. 567 + * NF_ACCEPT can be returned when destination is local. 543 568 */ 544 569 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, 545 570 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 546 571 547 572 /* Note: we can group the following members into a structure, 548 - in order to save more space, and the following members are 549 - only used in VS/NAT anyway */ 573 + * in order to save more space, and the following members are 574 + * only used in VS/NAT anyway 575 + */ 550 576 struct ip_vs_app *app; /* bound ip_vs_app object */ 551 577 void *app_data; /* Application private data */ 552 578 struct ip_vs_seq in_seq; /* incoming seq. struct */ ··· 560 584 struct rcu_head rcu_head; 561 585 }; 562 586 563 - /* 564 - * To save some memory in conn table when name space is disabled. 565 - */ 587 + /* To save some memory in conn table when name space is disabled. */ 566 588 static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp) 567 589 { 568 590 #ifdef CONFIG_NET_NS ··· 569 595 return &init_net; 570 596 #endif 571 597 } 598 + 572 599 static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net) 573 600 { 574 601 #ifdef CONFIG_NET_NS ··· 587 612 #endif 588 613 } 589 614 590 - /* 591 - * Extended internal versions of struct ip_vs_service_user and 592 - * ip_vs_dest_user for IPv6 support. 615 + /* Extended internal versions of struct ip_vs_service_user and ip_vs_dest_user 616 + * for IPv6 support. 593 617 * 594 - * We need these to conveniently pass around service and destination 595 - * options, but unfortunately, we also need to keep the old definitions to 596 - * maintain userspace backwards compatibility for the setsockopt interface. 618 + * We need these to conveniently pass around service and destination 619 + * options, but unfortunately, we also need to keep the old definitions to 620 + * maintain userspace backwards compatibility for the setsockopt interface. 597 621 */ 598 622 struct ip_vs_service_user_kern { 599 623 /* virtual service addresses */ ··· 630 656 631 657 632 658 /* 633 - * The information about the virtual service offered to the net 634 - * and the forwarding entries 659 + * The information about the virtual service offered to the net and the 660 + * forwarding entries. 635 661 */ 636 662 struct ip_vs_service { 637 663 struct hlist_node s_list; /* for normal service table */ ··· 671 697 struct rcu_head rcu_head; 672 698 }; 673 699 674 - /* 675 - * The real server destination forwarding entry 676 - * with ip address, port number, and so on. 700 + /* The real server destination forwarding entry with ip address, port number, 701 + * and so on. 677 702 */ 678 703 struct ip_vs_dest { 679 704 struct list_head n_list; /* for the dests in the service */ ··· 711 738 unsigned int in_rs_table:1; /* we are in rs_table */ 712 739 }; 713 740 714 - 715 - /* 716 - * The scheduler object 717 - */ 741 + /* The scheduler object */ 718 742 struct ip_vs_scheduler { 719 743 struct list_head n_list; /* d-linked list head */ 720 744 char *name; /* scheduler name */ ··· 751 781 int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf); 752 782 }; 753 783 754 - /* 755 - * The application module object (a.k.a. app incarnation) 756 - */ 784 + /* The application module object (a.k.a. app incarnation) */ 757 785 struct ip_vs_app { 758 786 struct list_head a_list; /* member in app list */ 759 787 int type; /* IP_VS_APP_TYPE_xxx */ ··· 767 799 atomic_t usecnt; /* usage counter */ 768 800 struct rcu_head rcu_head; 769 801 770 - /* 771 - * output hook: Process packet in inout direction, diff set for TCP. 802 + /* output hook: Process packet in inout direction, diff set for TCP. 772 803 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, 773 804 * 2=Mangled but checksum was not updated 774 805 */ 775 806 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, 776 807 struct sk_buff *, int *diff); 777 808 778 - /* 779 - * input hook: Process packet in outin direction, diff set for TCP. 809 + /* input hook: Process packet in outin direction, diff set for TCP. 780 810 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, 781 811 * 2=Mangled but checksum was not updated 782 812 */ ··· 833 867 struct netns_ipvs { 834 868 int gen; /* Generation */ 835 869 int enable; /* enable like nf_hooks do */ 836 - /* 837 - * Hash table: for real service lookups 838 - */ 870 + /* Hash table: for real service lookups */ 839 871 #define IP_VS_RTAB_BITS 4 840 872 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) 841 873 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) ··· 867 903 struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; 868 904 #endif 869 905 /* ip_vs_conn */ 870 - atomic_t conn_count; /* connection counter */ 906 + atomic_t conn_count; /* connection counter */ 871 907 872 908 /* ip_vs_ctl */ 873 909 struct ip_vs_stats tot_stats; /* Statistics & est. */ ··· 954 990 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 955 991 /* net name space ptr */ 956 992 struct net *net; /* Needed by timer routines */ 957 - /* Number of heterogeneous destinations, needed because 958 - * heterogeneous are not supported when synchronization is 959 - * enabled */ 993 + /* Number of heterogeneous destinations, needed becaus heterogeneous 994 + * are not supported when synchronization is enabled. 995 + */ 960 996 unsigned int mixed_address_family_dests; 961 997 }; 962 998 ··· 1111 1147 1112 1148 #endif 1113 1149 1114 - /* 1115 - * IPVS core functions 1116 - * (from ip_vs_core.c) 1150 + /* IPVS core functions 1151 + * (from ip_vs_core.c) 1117 1152 */ 1118 1153 const char *ip_vs_proto_name(unsigned int proto); 1119 1154 void ip_vs_init_hash_table(struct list_head *table, int rows); ··· 1120 1157 1121 1158 #define IP_VS_APP_TYPE_FTP 1 1122 1159 1123 - /* 1124 - * ip_vs_conn handling functions 1125 - * (from ip_vs_conn.c) 1160 + /* ip_vs_conn handling functions 1161 + * (from ip_vs_conn.c) 1126 1162 */ 1127 - 1128 1163 enum { 1129 1164 IP_VS_DIR_INPUT = 0, 1130 1165 IP_VS_DIR_OUTPUT, ··· 1253 1292 atomic_inc(&ctl_cp->n_control); 1254 1293 } 1255 1294 1256 - /* 1257 - * IPVS netns init & cleanup functions 1258 - */ 1295 + /* IPVS netns init & cleanup functions */ 1259 1296 int ip_vs_estimator_net_init(struct net *net); 1260 1297 int ip_vs_control_net_init(struct net *net); 1261 1298 int ip_vs_protocol_net_init(struct net *net); ··· 1268 1309 void ip_vs_sync_net_cleanup(struct net *net); 1269 1310 void ip_vs_service_net_cleanup(struct net *net); 1270 1311 1271 - /* 1272 - * IPVS application functions 1273 - * (from ip_vs_app.c) 1312 + /* IPVS application functions 1313 + * (from ip_vs_app.c) 1274 1314 */ 1275 1315 #define IP_VS_APP_MAX_PORTS 8 1276 1316 struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app); ··· 1289 1331 struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); 1290 1332 struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); 1291 1333 1292 - /* 1293 - * Use a #define to avoid all of module.h just for these trivial ops 1294 - */ 1334 + /* Use a #define to avoid all of module.h just for these trivial ops */ 1295 1335 #define ip_vs_pe_get(pe) \ 1296 1336 if (pe && pe->module) \ 1297 1337 __module_get(pe->module); ··· 1298 1342 if (pe && pe->module) \ 1299 1343 module_put(pe->module); 1300 1344 1301 - /* 1302 - * IPVS protocol functions (from ip_vs_proto.c) 1303 - */ 1345 + /* IPVS protocol functions (from ip_vs_proto.c) */ 1304 1346 int ip_vs_protocol_init(void); 1305 1347 void ip_vs_protocol_cleanup(void); 1306 1348 void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); ··· 1316 1362 extern struct ip_vs_protocol ip_vs_protocol_ah; 1317 1363 extern struct ip_vs_protocol ip_vs_protocol_sctp; 1318 1364 1319 - /* 1320 - * Registering/unregistering scheduler functions 1321 - * (from ip_vs_sched.c) 1365 + /* Registering/unregistering scheduler functions 1366 + * (from ip_vs_sched.c) 1322 1367 */ 1323 1368 int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1324 1369 int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); ··· 1336 1383 1337 1384 void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1338 1385 1339 - 1340 - /* 1341 - * IPVS control data and functions (from ip_vs_ctl.c) 1342 - */ 1386 + /* IPVS control data and functions (from ip_vs_ctl.c) */ 1343 1387 extern struct ip_vs_stats ip_vs_stats; 1344 1388 extern int sysctl_ip_vs_sync_ver; 1345 1389 ··· 1377 1427 kfree(dest); 1378 1428 } 1379 1429 1380 - /* 1381 - * IPVS sync daemon data and function prototypes 1382 - * (from ip_vs_sync.c) 1430 + /* IPVS sync daemon data and function prototypes 1431 + * (from ip_vs_sync.c) 1383 1432 */ 1384 1433 int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid); 1385 1434 int stop_sync_thread(struct net *net, int state); 1386 1435 void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts); 1387 1436 1388 - /* 1389 - * IPVS rate estimator prototypes (from ip_vs_est.c) 1390 - */ 1437 + /* IPVS rate estimator prototypes (from ip_vs_est.c) */ 1391 1438 void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1392 1439 void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1393 1440 void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1394 1441 void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1395 1442 struct ip_vs_stats *stats); 1396 1443 1397 - /* 1398 - * Various IPVS packet transmitters (from ip_vs_xmit.c) 1399 - */ 1444 + /* Various IPVS packet transmitters (from ip_vs_xmit.c) */ 1400 1445 int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1401 1446 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1402 1447 int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, ··· 1422 1477 #endif 1423 1478 1424 1479 #ifdef CONFIG_SYSCTL 1425 - /* 1426 - * This is a simple mechanism to ignore packets when 1427 - * we are loaded. Just set ip_vs_drop_rate to 'n' and 1428 - * we start to drop 1/rate of the packets 1480 + /* This is a simple mechanism to ignore packets when 1481 + * we are loaded. Just set ip_vs_drop_rate to 'n' and 1482 + * we start to drop 1/rate of the packets 1429 1483 */ 1430 - 1431 1484 static inline int ip_vs_todrop(struct netns_ipvs *ipvs) 1432 1485 { 1433 1486 if (!ipvs->drop_rate) ··· 1439 1496 static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } 1440 1497 #endif 1441 1498 1442 - /* 1443 - * ip_vs_fwd_tag returns the forwarding tag of the connection 1444 - */ 1499 + /* ip_vs_fwd_tag returns the forwarding tag of the connection */ 1445 1500 #define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) 1446 1501 1447 1502 static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp) ··· 1498 1557 return csum_partial(diff, sizeof(diff), oldsum); 1499 1558 } 1500 1559 1501 - /* 1502 - * Forget current conntrack (unconfirmed) and attach notrack entry 1503 - */ 1560 + /* Forget current conntrack (unconfirmed) and attach notrack entry */ 1504 1561 static inline void ip_vs_notrack(struct sk_buff *skb) 1505 1562 { 1506 1563 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) ··· 1515 1576 } 1516 1577 1517 1578 #ifdef CONFIG_IP_VS_NFCT 1518 - /* 1519 - * Netfilter connection tracking 1520 - * (from ip_vs_nfct.c) 1579 + /* Netfilter connection tracking 1580 + * (from ip_vs_nfct.c) 1521 1581 */ 1522 1582 static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) 1523 1583 { ··· 1555 1617 static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) 1556 1618 { 1557 1619 } 1558 - /* CONFIG_IP_VS_NFCT */ 1559 - #endif 1620 + #endif /* CONFIG_IP_VS_NFCT */ 1560 1621 1561 1622 static inline int 1562 1623 ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) 1563 1624 { 1564 - /* 1565 - * We think the overhead of processing active connections is 256 1625 + /* We think the overhead of processing active connections is 256 1566 1626 * times higher than that of inactive connections in average. (This 1567 1627 * 256 times might not be accurate, we will change it later) We 1568 1628 * use the following formula to estimate the overhead now: