From eeb9ea27b4b1b1136ca80501055f3fd62ff0e2c1 Mon Sep 17 00:00:00 2001 From: Michael Blizek Date: Sat, 8 Oct 2022 11:17:05 +0200 Subject: [PATCH] checkpatch fixes --- net/cor/config.c | 19 ++++++--------- net/cor/conn.c | 20 +++++---------- net/cor/conn_databuf.c | 5 ---- net/cor/conn_src_in.c | 9 ++----- net/cor/conn_src_sock.c | 5 ---- net/cor/conn_trgt_out.c | 7 +----- net/cor/conn_trgt_sock.c | 5 ---- net/cor/conn_trgt_unconn.c | 5 ---- net/cor/cor.h | 61 +++++++++++++++++++++------------------------- net/cor/dev.c | 17 +++++-------- net/cor/neigh.c | 15 ++++-------- net/cor/neigh_ann_rcv.c | 15 ++++-------- net/cor/neigh_ann_snd.c | 7 +----- net/cor/neigh_rcv.c | 5 ---- net/cor/neigh_snd.c | 27 +++++++++----------- net/cor/sock.c | 5 ---- net/cor/sock_managed.c | 15 ++++-------- net/cor/sock_raw.c | 15 ++++-------- net/cor/sock_rdaemon.c | 39 +++++++++++++---------------- net/cor/util.c | 9 ++----- 20 files changed, 102 insertions(+), 203 deletions(-) diff --git a/net/cor/config.c b/net/cor/config.c index 1ed8dd06303e..aeb598bd3d76 100644 --- a/net/cor/config.c +++ b/net/cor/config.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" @@ -41,6 +36,7 @@ int cor_is_device_configurated(struct net_device *dev) unsigned long iflags; __u32 i; + spin_lock_irqsave(&cor_interface_config_lock, iflags); if (cor_all_interfaces != 0) { @@ -49,13 +45,13 @@ int cor_is_device_configurated(struct net_device *dev) } BUG_ON(cor_num_interfaces > 65536); - for (i=0;iname == 0); - for (j=0;;j++) { + for (j = 0;; j++) { if (j >= sizeof(dev->name)) break; @@ -87,7 +83,7 @@ void cor_set_interface_config(struct cor_interface_config *new_config, spin_lock_irqsave(&cor_interface_config_lock, iflags); BUG_ON(cor_num_interfaces > 65536); - for (i=0;iname == 0); @@ -127,9 +123,9 @@ void _cor_config_down(void) void cor_config_down(void) { - mutex_lock(&(cor_config_lock)); + mutex_lock(&cor_config_lock); _cor_config_down(); - mutex_unlock(&(cor_config_lock)); + mutex_unlock(&cor_config_lock); } int cor_config_up(__u8 has_addr, __be64 addr) @@ -139,7 +135,7 @@ int cor_config_up(__u8 has_addr, __be64 addr) if (has_addr != 0 && be64_to_cpu(addr) == 0) return 1; - mutex_lock(&(cor_config_lock)); + mutex_lock(&cor_config_lock); _cor_config_down(); @@ -171,6 +167,7 @@ int cor_config_up(__u8 has_addr, __be64 addr) int cor_is_clientmode(void) { int rc; + spin_lock_bh(&cor_local_addr_lock); rc = (cor_local_has_addr == 0); spin_unlock_bh(&cor_local_addr_lock); diff --git a/net/cor/conn.c b/net/cor/conn.c index f7813f520512..749472d9a068 100644 --- a/net/cor/conn.c +++ b/net/cor/conn.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -49,7 +44,7 @@ static __u64 cor_get_prio_in(__u64 priority) if (PRIORITY_IN_MULITPLIER_PERCENT >= 100) return priority; - if (unlikely(priority > U64_MAX/100)) { + if (unlikely(priority > U64_MAX / 100)) { return (priority / 100) * PRIORITY_IN_MULITPLIER_PERCENT; } else { return (priority * PRIORITY_IN_MULITPLIER_PERCENT) / 100; @@ -77,8 +72,7 @@ __u32 _cor_conn_refresh_priority(struct cor_conn *cn_lx) cor_get_prio_in(cn_lx->src.in.priority); __u64 priority_sum = cor_get_prio_in(atomic64_read( &(cn_lx->src.in.nb->priority_sum))); - if (PRIORITY_SUM_IN_MAX != U64_MAX && - priority_sum > PRIORITY_SUM_IN_MAX) { + if (priority_sum > PRIORITY_SUM_IN_MAX) { return cor_conn_prio_sum_limit(priority, priority_sum); } else { return priority; @@ -113,6 +107,7 @@ __u32 cor_conn_refresh_priority(struct cor_conn *cn, int locked) if (cn->trgt.out.priority_send_allowed != 0) { __u16 priority_enc = cor_enc_priority(priority); + if (priority_enc != cn->trgt.out.priority_last) cor_send_priority(cn, priority_enc); } @@ -130,12 +125,9 @@ static void _cor_set_conn_in_priority(struct cor_conn *src_in_lx, __u32 newpriority) { struct cor_neighbor *nb = src_in_lx->src.in.nb; - __u32 oldpriority = src_in_lx->src.in.priority; - cor_update_atomic_sum(&(nb->priority_sum), - oldpriority, newpriority); - + cor_update_atomic_sum(&(nb->priority_sum), oldpriority, newpriority); src_in_lx->src.in.priority = newpriority; } @@ -158,7 +150,7 @@ void cor_set_conn_in_priority(struct cor_neighbor *nb, __u32 conn_id, src_in->src.in.priority_seqno = (src_in->src.in.priority_seqno + 1) & 15; - newpriority = (cor_dec_priority(priority)*4)/5; + newpriority = (cor_dec_priority(priority) * 4) / 5; _cor_set_conn_in_priority(src_in, newpriority); cor_conn_refresh_priority(src_in, 1); @@ -283,7 +275,7 @@ static void _cor_free_conn(struct cor_conn *cn) cn->src.in.nb = 0; } else if (cn->sourcetype == SOURCE_SOCK) { BUG_ON(cn->src.sock.ed == 0); - memset(cn->src.sock.ed, 9*16 + 10, + memset(cn->src.sock.ed, 9 * 16 + 10, sizeof(struct cor_conn_src_sock_extradata)); kmem_cache_free(cor_conn_ed_slab, cn->src.sock.ed); cn->src.sock.ed = 0; diff --git a/net/cor/conn_databuf.c b/net/cor/conn_databuf.c index ce74ff943337..4358e100dee9 100644 --- a/net/cor/conn_databuf.c +++ b/net/cor/conn_databuf.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include diff --git a/net/cor/conn_src_in.c b/net/cor/conn_src_in.c index c7a003c20efb..87d6ee237a15 100644 --- a/net/cor/conn_src_in.c +++ b/net/cor/conn_src_in.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -653,8 +648,8 @@ static void _cor_conn_rcv(struct cor_neighbor *nb, struct cor_conn *src_in, __u32 skblen = skb->len; rcvlen = cor_receive_skb(src_in, skb, windowused, flush); - if (unlikely(rcvlen < skblen)) - kfree_skb(skb); + if (unlikely(rcvlen < skblen)) + kfree_skb(skb); } else { rcvlen = cor_receive_buf(src_in, data, len, windowused, flush); diff --git a/net/cor/conn_src_sock.c b/net/cor/conn_src_sock.c index 99b842894d2e..75e48076ed88 100644 --- a/net/cor/conn_src_sock.c +++ b/net/cor/conn_src_sock.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" diff --git a/net/cor/conn_trgt_out.c b/net/cor/conn_trgt_out.c index 6852d36de8a4..04f995a5bbd3 100644 --- a/net/cor/conn_trgt_out.c +++ b/net/cor/conn_trgt_out.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -1002,7 +997,7 @@ static __u32 cor_maxsend_left_to_len(__u32 maxsend_left) if (maxsend_left < 128) return maxsend_left; - for (i=128;i<4096;) { + for (i = 128; i < 4096;) { if (i*2 > maxsend_left) return i; i = i*2; diff --git a/net/cor/conn_trgt_sock.c b/net/cor/conn_trgt_sock.c index cbe3829eb99c..c6249c722096 100644 --- a/net/cor/conn_trgt_sock.c +++ b/net/cor/conn_trgt_sock.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" diff --git a/net/cor/conn_trgt_unconn.c b/net/cor/conn_trgt_unconn.c index e6b0dec81851..ced98cfa4806 100644 --- a/net/cor/conn_trgt_unconn.c +++ b/net/cor/conn_trgt_unconn.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" diff --git a/net/cor/cor.h b/net/cor/cor.h index 41bf2c9f7735..744b7f75f943 100644 --- a/net/cor/cor.h +++ b/net/cor/cor.h @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -642,14 +637,14 @@ struct cor_neighbor{ struct list_head lh_nextpass; __u32 cnt; __u64 priority_sum; - }conns_waiting; + } conns_waiting; struct{ spinlock_t lock; atomic64_t data_intransit; atomic64_t cwin; __u64 cwin_shrinkto; - }nbcongwin; + } nbcongwin; spinlock_t state_lock; unsigned long last_ping_time; @@ -680,7 +675,7 @@ struct cor_neighbor{ * otherwise responded to (e.g. pong) */ unsigned long last_roundtrip;/* active/stalled state */ - }state_time; + } state_time; ktime_t last_roundtrip_end; __u16 ping_success; __u8 state; @@ -809,14 +804,14 @@ struct cor_conn_src_sock_extradata{ char snd_data[CONN_MNGD_MAX_CTRL_DATALEN]; char snd_chksum[CONN_MNGD_CHECKSUMLEN]; __u8 snd_data_len; - }buf_ctrl; + } buf_ctrl; struct{ char snd_hdr[CONN_MNGD_HEADERLEN]; char snd_chksum[CONN_MNGD_CHECKSUMLEN]; char *snd_data; __u16 snd_data_len; - }buf_data; + } buf_data; __u16 sent; }; @@ -937,7 +932,7 @@ struct cor_conn{ /* protected by nb->cmsg_lock */ struct list_head acks_pending; - }in; + } in; struct{ struct cor_conn_src_sock_extradata *ed; @@ -974,8 +969,8 @@ struct cor_conn{ __u8 last_windowused; __u8 flush:1, socktype:1; - }sock; - }src; + } sock; + } src; union{ struct{ @@ -985,7 +980,7 @@ struct cor_conn{ __u8 paramlen_read; char *cmdparams; char paramlen_buf[4]; - }unconnected; + } unconnected; struct{ struct cor_neighbor *nb; @@ -1027,7 +1022,7 @@ struct cor_conn{ /* protected by nb->retrans_conn_lock */ __u16 retrans_lowwindow; - }out; + } out; struct{ __u8 waiting_for_userspace; @@ -1044,8 +1039,8 @@ struct cor_conn{ __u16 rcvd; __u16 rcv_hdr_flags; __u16 rcv_data_len; - }sock; - }trgt; + } sock; + } trgt; struct{ struct list_head items; @@ -1057,7 +1052,7 @@ struct cor_conn{ __u32 read_remaining; __u16 next_read_offset; - }data_buf; + } data_buf; __u32 bufspace_accounted; @@ -1067,21 +1062,21 @@ struct cor_conn{ union{ struct{ __u32 bytesleft; - }noact; + } noact; struct{ __u32 size_start; - }decr; + } decr; struct{ __u32 size_start; __u32 size_end; - }incr; - }act; + } incr; + } act; __u32 state:3, bytes_rcvd:24; - }bufsize; + } bufsize; }; static inline __u32 cor_get_connid_reverse(__u32 conn_id) @@ -1181,20 +1176,20 @@ struct cor_skb_procstate{ union{ struct{ struct work_struct work; - }announce1; + } announce1; struct{ __u32 offset; - }announce2; + } announce2; struct{ __u32 skb_memused; struct cor_rcvooo r; - }rcv_ooo; + } rcv_ooo; struct{ struct cor_data_buf_item dbi; - }rcv; + } rcv; }funcstate; }; @@ -1233,7 +1228,7 @@ struct cor_sock { __u32 queue_maxlen; __u32 queue_len; struct list_head conn_queue; - }listener; + } listener; struct { struct cor_conn *src_sock; @@ -1243,7 +1238,7 @@ struct cor_sock { __u16 rcvoffset; struct cor_sock *pass_on_close; - }conn_raw; + } conn_raw; struct { struct cor_sockaddr remoteaddr; @@ -1282,7 +1277,7 @@ struct cor_sock { __u16 rcv_data_len; __u16 rcvbuf_consumed; __u8 rcv_buf_state; - }conn_managed; + } conn_managed; }data; struct work_struct readfromconn_work; @@ -1966,7 +1961,7 @@ static inline struct cor_skb_procstate *cor_skb_pstate(struct sk_buff *skb) static inline struct sk_buff *cor_skb_from_pstate(struct cor_skb_procstate *ps) { - return (struct sk_buff *) (((char *)ps) - offsetof(struct sk_buff,cb)); + return (struct sk_buff *) (((char *)ps) - offsetof(struct sk_buff, cb)); } static inline int cor_qos_fastsend_allowed_conn_retrans(struct cor_neighbor *nb) @@ -2024,7 +2019,7 @@ static inline __u32 cor_mss_conndata(struct cor_neighbor *nb, int highlatency) if (mss_tmp < 256 || highlatency || LOWLATENCY_LOWERMTU == 0) return mss_tmp; - for (i=256;i<4096;i*=2) { + for (i = 256; i < 4096; i *= 2) { if (i*2 > mss_tmp) return i; } @@ -2284,7 +2279,7 @@ static inline __u32 cor_buf_optlen(__u32 datalen, int from_sock) } -inline static void cor_databuf_item_free(struct cor_data_buf_item *item) +static inline void cor_databuf_item_free(struct cor_data_buf_item *item) { if (item->type == DATABUF_BUF) { kfree(item->buf); diff --git a/net/cor/dev.c b/net/cor/dev.c index cb10fdeefd20..4b7a21f8f011 100644 --- a/net/cor/dev.c +++ b/net/cor/dev.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -414,7 +409,7 @@ static __u32 _cor_resume_conns_burstprio(struct cor_conn *trgt_out_l, * negative burst for high latency conns: * 50% if idle * 125% if busy - */ + */ __u32 burstfactor; @@ -627,7 +622,7 @@ retry: if (rc2 == RC_FLUSH_CONN_OUT_CONG || unlikely(rc2 == RC_FLUSH_CONN_OUT_OOM)) { return QOS_RESUME_CONG; - } else if (unlikely(rc2== RC_FLUSH_CONN_OUT_NBNOTACTIVE)) { + } else if (unlikely(rc2 == RC_FLUSH_CONN_OUT_NBNOTACTIVE)) { return QOS_RESUME_NEXTNEIGHBOR; } } @@ -1236,7 +1231,7 @@ static void _cor_qos_enqueue(struct cor_qos_queue *q, list_add_tail(&(rb->lh), &(q->kpackets_waiting)); cor_nb_kref_get(nb, "qos_queue_kpacket"); } else if (caller == QOS_CALLER_CONN_RETRANS) { - list_add_tail(&(rb->lh) , &(q->conn_retrans_waiting)); + list_add_tail(&(rb->lh), &(q->conn_retrans_waiting)); cor_nb_kref_get(container_of(rb, struct cor_neighbor, rb_cr), "qos_queue_conn_retrans"); } else if (caller == QOS_CALLER_ANNOUNCE) { @@ -1401,7 +1396,7 @@ struct sk_buff *cor_create_packet(struct cor_neighbor *nb, int size, ret->dev = nb->dev; skb_reserve(ret, LL_RESERVED_SPACE(nb->dev)); - if(unlikely(dev_hard_header(ret, nb->dev, ETH_P_COR, nb->mac, + if (unlikely(dev_hard_header(ret, nb->dev, ETH_P_COR, nb->mac, nb->dev->dev_addr, ret->len) < 0)) return 0; skb_reset_network_header(ret); @@ -1504,7 +1499,7 @@ static int cor_rcv(struct sk_buff *skb, struct net_device *dev, if (skb->pkt_type == PACKET_OTHERHOST || unlikely(skb->pkt_type == PACKET_LOOPBACK)) - goto drop; + goto drop; packet_type_p = cor_pull_skb(skb, 1); @@ -1553,7 +1548,7 @@ int cor_netdev_notify_func(struct notifier_block *not, unsigned long event, BUG_ON(dev == 0); - switch(event) { + switch (event) { case NETDEV_UP: if (dev->flags & IFF_LOOPBACK) break; diff --git a/net/cor/neigh.c b/net/cor/neigh.c index f353566a78be..2003a6d6f0aa 100644 --- a/net/cor/neigh.c +++ b/net/cor/neigh.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -642,7 +637,7 @@ static struct cor_ping_cookie *cor_find_cookie(struct cor_neighbor *nb, { int i; - for(i=0;icookies[i].cookie == cookie) return &(nb->cookies[i]); } @@ -668,7 +663,7 @@ static __u32 sqrt(__u64 x) if (unlikely(x <= 1)) return 0; - for (i=0;i<20;i++) { + for (i = 0; i < 20; i++) { y = y/2 + div64_u64(x/2, y); if (unlikely(y == 0)) y = 1; @@ -796,7 +791,7 @@ void cor_ping_resp(struct cor_neighbor *nb, __u32 cookie, __u32 respdelay) cor_reset_cookie(nb, c); - for(i=0;icookies[i].cookie != 0 && ktime_before( nb->cookies[i].time_created, c->time_created)) { nb->cookies[i].pongs++; @@ -1149,7 +1144,7 @@ struct cor_conn *cor_get_conn(struct cor_neighbor *nb, __u32 conn_id) { unsigned long iflags; - struct rb_node * n = 0; + struct rb_node *n = 0; struct cor_conn *ret = 0; spin_lock_irqsave(&(nb->connid_lock), iflags); @@ -1420,7 +1415,7 @@ int cor_connid_alloc(struct cor_neighbor *nb, struct cor_conn *src_in_ll) BUG_ON(trgt_out_ll->targettype != TARGET_OUT); spin_lock_irqsave(&cor_connid_gen, iflags); - for (i=0;i<16;i++) { + for (i = 0; i < 16; i++) { conn_id = 0; get_random_bytes((char *) &conn_id, sizeof(conn_id)); conn_id = (conn_id & ~(1 << 31)); diff --git a/net/cor/neigh_ann_rcv.c b/net/cor/neigh_ann_rcv.c index 4835a8e4b292..032a38217868 100644 --- a/net/cor/neigh_ann_rcv.c +++ b/net/cor/neigh_ann_rcv.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" @@ -274,16 +269,16 @@ static void _cor_rcv_announce(struct work_struct *work) goto discard; len = (__u16) skb->len; - msg = cor_pull_skb(skb, len); + msg = cor_pull_skb(skb, len); if (msg == 0) goto discard; - mutex_lock(&(cor_announce_rcv_lock)); - cor_parse_announce(skb->dev, source_hw, msg, len); - mutex_unlock(&(cor_announce_rcv_lock)); + mutex_lock(&cor_announce_rcv_lock); + cor_parse_announce(skb->dev, source_hw, msg, len); + mutex_unlock(&cor_announce_rcv_lock); discard: - kfree_skb(skb); + kfree_skb(skb); atomic_dec(&cor_packets_in_workqueue); } diff --git a/net/cor/neigh_ann_snd.c b/net/cor/neigh_ann_snd.c index d7d2944e3887..0012a19ca0e9 100644 --- a/net/cor/neigh_ann_snd.c +++ b/net/cor/neigh_ann_snd.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" @@ -77,7 +72,7 @@ static int __cor_send_announce(struct cor_announce_data *ann, int *sent) skb_reserve(skb, headroom); #warning net_device locking? (other places too) - if(unlikely(dev_hard_header(skb, ann->dev, ETH_P_COR, + if (unlikely(dev_hard_header(skb, ann->dev, ETH_P_COR, ann->mac, ann->dev->dev_addr, skb->len) < 0)) goto out_err; diff --git a/net/cor/neigh_rcv.c b/net/cor/neigh_rcv.c index b01d441f53ed..ef04bcc106e0 100644 --- a/net/cor/neigh_rcv.c +++ b/net/cor/neigh_rcv.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include diff --git a/net/cor/neigh_snd.c b/net/cor/neigh_snd.c index 83d69b418397..182e91669b81 100644 --- a/net/cor/neigh_snd.c +++ b/net/cor/neigh_snd.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -54,12 +49,12 @@ struct cor_control_msg_out{ ktime_t ping_rcvtime; ktime_t time_enqueued; - }pong; + } pong; struct{ __u64 seqno; __u8 fast; - }ack; + } ack; struct{ struct cor_conn *src_in; @@ -80,25 +75,25 @@ struct cor_control_msg_out{ __u8 queue; __u32 ack_seqno; - }ack_conn; + } ack_conn; struct{ __u32 conn_id; __u64 seqno1; __u64 seqno2; struct cor_conn *src_in; - }connect; + } connect; struct{ __u32 conn_id; struct cor_conn *src_in; - }connect_success; + } connect_success; struct{ struct rb_node rbn; __u8 in_pending_conn_resets; __u32 conn_id; - }reset_conn; + } reset_conn; struct{ __u32 conn_id; @@ -118,12 +113,12 @@ struct cor_control_msg_out{ __u32 ackconn_lowlatency_delay; __u32 ackconn_highlatency_delay; __u32 pong_delay; - }set_max_cmsg_delay; + } set_max_cmsg_delay; struct{ __u32 rcvmtu; - }set_rcvmtu; - }msg; + } set_rcvmtu; + } msg; }; struct cor_control_retrans { @@ -786,7 +781,7 @@ static __u32 cor_add_ack_conn(struct sk_buff *skb, BUG_ON(cm->msg.ack_conn.priority > 4095); cor_put_u16(dst + offset, priority); - offset+=2; + offset += 2; } list_add_tail(&(cm->lh), &(cr->msgs)); @@ -1973,7 +1968,7 @@ static void _cor_reset_timeouted_conns(struct cor_neighbor *nb, struct list_head *nb_snd_conn_list) { int i; - for (i=0;i<10000;i++) { + for (i = 0; i < 10000; i++) { unsigned long iflags; struct cor_conn *trgt_out; diff --git a/net/cor/sock.c b/net/cor/sock.c index bf0be4ac3f66..39818bc020f3 100644 --- a/net/cor/sock.c +++ b/net/cor/sock.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include diff --git a/net/cor/sock_managed.c b/net/cor/sock_managed.c index f99e47092e64..bdf061c71158 100644 --- a/net/cor/sock_managed.c +++ b/net/cor/sock_managed.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -120,7 +115,7 @@ static int cor_alloc_corsock_cookie(struct cor_sock *cs_m_l) BUG_ON(cs_m_l->data.conn_managed.cookie != 0); spin_lock_bh(&cor_cookie_gen); - for(i=0;i<16;i++) { + for(i = 0; i < 16; i++) { struct cor_sock *cs2 = 0; cookie = 0; @@ -859,7 +854,7 @@ static int __cor_mngdsocket_sendmsg(struct msghdr *msg, __u32 totallen, &(msg->msg_iter)); if (unlikely(st_rc != len)) - return -EFAULT; + return -EFAULT; cs_m_l->data.conn_managed.snd_data_len += (__u16) len; @@ -1446,10 +1441,10 @@ const struct proto_ops cor_mngd_proto_ops = { .shutdown = cor_mngdsocket_shutdown, .ioctl = cor_mngdsocket_ioctl, .setsockopt = cor_mngdsocket_setsockopt, - .getsockopt = cor_mngdsocket_getsockopt, + .getsockopt = cor_mngdsocket_getsockopt, #ifdef CONFIG_COMPAT - .combat_ioctl = cor_mngdsocket_ioctl, - .compat_setsockopt = cor_mngdsocket_setsockopt, + .combat_ioctl = cor_mngdsocket_ioctl, + .compat_setsockopt = cor_mngdsocket_setsockopt, .compat_getsockopt = cor_mngdsocket_getsockopt, #endif .sendmsg = cor_mngdsocket_sendmsg, diff --git a/net/cor/sock_raw.c b/net/cor/sock_raw.c index 65da33aaaa0a..2feff19f73c0 100644 --- a/net/cor/sock_raw.c +++ b/net/cor/sock_raw.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include @@ -482,9 +477,9 @@ static int __cor_rawsocket_sendmsg(struct msghdr *msg, __u32 totallen, st_rc = copy_from_iter(buf + bufread, len, &(msg->msg_iter)); - if (unlikely(st_rc != len)) { + if (unlikely(st_rc != len)) { kfree(buf); - return -EFAULT; + return -EFAULT; } rc = ___cor_rawsocket_sendmsg(buf, len, buflen, flush, cs_r_l); @@ -741,10 +736,10 @@ const struct proto_ops cor_raw_proto_ops = { .shutdown = cor_rawsocket_shutdown, .ioctl = cor_rawsocket_ioctl, .setsockopt = cor_rawsocket_setsockopt, - .getsockopt = cor_rawsocket_getsockopt, + .getsockopt = cor_rawsocket_getsockopt, #ifdef CONFIG_COMPAT - .combat_ioctl = cor_rawsocket_ioctl, - .compat_setsockopt = cor_rawsocket_setsockopt, + .combat_ioctl = cor_rawsocket_ioctl, + .compat_setsockopt = cor_rawsocket_setsockopt, .compat_getsockopt = cor_rawsocket_getsockopt, #endif .sendmsg = cor_rawsocket_sendmsg, diff --git a/net/cor/sock_rdaemon.c b/net/cor/sock_rdaemon.c index 272cf15d67c9..146de0e0ea38 100644 --- a/net/cor/sock_rdaemon.c +++ b/net/cor/sock_rdaemon.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" @@ -31,7 +26,7 @@ struct cor_rd_msg{ __u32 type; union{ - }msg; + } msg; }; struct cor_rdsock{ @@ -58,7 +53,7 @@ struct cor_rdsock{ struct{ char snd_cmdplen_buf[8]; char rcvbuf[MAX_MSG_LEN+8]; - }user_copy; + } user_copy; }; static struct kmem_cache *cor_rdmsg_slab; @@ -225,7 +220,7 @@ static int _cor_rd_parse_up_interfaces(struct cor_rdsock *crd, char *param, memset(newconfig, 0, num_intf * sizeof(struct cor_interface_config)); - for (i=0;i paramlen)) @@ -252,7 +247,7 @@ static int _cor_rd_parse_up_interfaces(struct cor_rdsock *crd, char *param, return 0; out_err: - while (i>0) { + while (i > 0) { struct cor_interface_config *newconfig_curr; i--; @@ -369,10 +364,10 @@ static int _cor_rd_sendmsg_hdr(struct cor_rdsock *crd, struct msghdr *msg, cpy = len; st_rc = copy_from_iter(crd->user_copy.snd_cmdplen_buf + - crd->snd_cmdplen_read, cpy, &(msg->msg_iter)); + crd->snd_cmdplen_read, cpy, &(msg->msg_iter)); if (unlikely(st_rc != cpy)) - return -EFAULT; + return -EFAULT; crd->snd_cmdplen_read += cpy; @@ -408,19 +403,19 @@ static int _cor_rd_sendmsg_body(struct cor_rdsock *crd, struct msghdr *msg, if (crd->param_read < paramlen) { size_t st_rc; - cpy = (paramlen - crd->param_read); - if (cpy > len) + cpy = (paramlen - crd->param_read); + if (cpy > len) cpy = len; BUG_ON(crd->cmdparams == 0); - st_rc = copy_from_iter(crd->cmdparams + - crd->param_read, cpy, &(msg->msg_iter)); + st_rc = copy_from_iter(crd->cmdparams + + crd->param_read, cpy, &(msg->msg_iter)); - if (unlikely(st_rc != cpy)) - return -EFAULT; + if (unlikely(st_rc != cpy)) + return -EFAULT; - crd->param_read += cpy; + crd->param_read += cpy; } BUG_ON(crd->param_read > paramlen); @@ -551,7 +546,7 @@ static int cor_fill_msgbuf(struct socket *sock, struct cor_rdsock *crd, int rc = 0; struct cor_rd_msg *rdm = 0; - while(1) { + while (1) { mutex_lock(&cor_rds_lock); if (list_empty(&(crd->rcv_msgs)) == 0) break; @@ -696,10 +691,10 @@ const struct proto_ops cor_rd_proto_ops = { .shutdown = cor_rd_socket_shutdown, .ioctl = cor_rd_ioctl, .setsockopt = cor_rd_setsockopt, - .getsockopt = cor_rd_getsockopt, + .getsockopt = cor_rd_getsockopt, #ifdef CONFIG_COMPAT - .combat_ioctl = cor_rd_ioctl, - .compat_setsockopt = cor_rd_setsockopt, + .combat_ioctl = cor_rd_ioctl, + .compat_setsockopt = cor_rd_setsockopt, .compat_getsockopt = cor_rd_getsockopt, #endif .sendmsg = cor_rd_sendmsg, diff --git a/net/cor/util.c b/net/cor/util.c index dc748a2415b9..4130fac63547 100644 --- a/net/cor/util.c +++ b/net/cor/util.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. */ #include "cor.h" @@ -76,7 +71,7 @@ __u8 __attribute__((const)) cor_enc_log_64_11(__u32 value) { int i; BUG_ON(cor_log_64_11_table[255] != 571789581); - for (i=1;i<256;i++) { + for (i = 1; i < 256; i++) { if (cor_log_64_11_table[i] > value) break; } @@ -94,7 +89,7 @@ static void __init cor_check_log_64_11_table(void) { int i; BUG_ON(cor_log_64_11_table[0] != 0); - for (i=1;i<256;i++) { + for (i = 1; i < 256; i++) { BUG_ON(cor_log_64_11_table[i] <= cor_log_64_11_table[i-1]); } } -- 2.11.4.GIT