Skip to contentSkip to conversation

whitespace: remove spacing irregularities

PATCH Superseded Duncan Roe 2 participants 3 messages Nov 11, 2024 – Nov 12, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

PATCH 1/1 whitespace: remove spacing irregularities

Two distinct actions:
1. Remove trailing spaces and tabs.
2. Remove spaces that are followed by a tab, inserting extra tabs as required.
Action 2 is only performed in the indent region of a line.

---
 include/linux/netlink.h | 6 +++---
 src/callback.c          | 4 ++--
 src/socket.c            | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
include/linux/netlink.h +3 -3
index ced0e1a..7c26175 100644
@@ -14,7 +14,7 @@
 #define NETLINK_SELINUX		7	/* SELinux event notifications */
 #define NETLINK_ISCSI		8	/* Open-iSCSI */
 #define NETLINK_AUDIT		9	/* auditing */
-#define NETLINK_FIB_LOOKUP	10	
+#define NETLINK_FIB_LOOKUP	10
 #define NETLINK_CONNECTOR	11
 #define NETLINK_NETFILTER	12	/* netfilter subsystem */
 #define NETLINK_IP6_FW		13
@@ -29,13 +29,13 @@
 
 #define NETLINK_INET_DIAG	NETLINK_SOCK_DIAG
 
-#define MAX_LINKS 32		
+#define MAX_LINKS 32
 
 struct sockaddr_nl {
 	__kernel_sa_family_t	nl_family;	/* AF_NETLINK	*/
 	unsigned short	nl_pad;		/* zero		*/
 	__u32		nl_pid;		/* port ID	*/
-       	__u32		nl_groups;	/* multicast groups mask */
+	__u32		nl_groups;	/* multicast groups mask */
 };
 
 struct nlmsghdr {
src/callback.c +2 -2
index f5349c3..703ae80 100644
@@ -21,7 +21,7 @@ static int mnl_cb_error(const struct nlmsghdr *nlh, void *data)
 	const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);
 
 	if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) {
-		errno = EBADMSG; 
+		errno = EBADMSG;
 		return MNL_CB_ERROR;
 	}
 	/* Netlink subsystems returns the errno value with different signess */
@@ -73,7 +73,7 @@ static inline int __mnl_cb_run(const void *buf, size_t numbytes,
 		}
 
 		/* netlink data message handling */
-		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) { 
+		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
 			if (cb_data){
 				ret = cb_data(nlh, data);
 				if (ret <= MNL_CB_STOP)
src/socket.c +3 -3
index 85b6bcc..60ba2cd 100644
@@ -206,7 +206,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
 
 	addr_len = sizeof(nl->addr);
 	ret = getsockname(nl->fd, (struct sockaddr *) &nl->addr, &addr_len);
-	if (ret < 0)	
+	if (ret < 0)
 		return ret;
 
 	if (addr_len != sizeof(nl->addr)) {
@@ -226,7 +226,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
  * \param buf buffer containing the netlink message to be sent
  * \param len number of bytes in the buffer that you want to send
  *
- * On error, it returns -1 and errno is appropriately set. Otherwise, it 
+ * On error, it returns -1 and errno is appropriately set. Otherwise, it
  * returns the number of bytes sent.
  */
 EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
@@ -235,7 +235,7 @@ EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
 	static const struct sockaddr_nl snl = {
 		.nl_family = AF_NETLINK
 	};
-	return sendto(nl->fd, buf, len, 0, 
+	return sendto(nl->fd, buf, len, 0,
 		      (struct sockaddr *) &snl, sizeof(snl));
 }
 
Signature · 1 line
2.46.2
#1 lore raw
Quoted 27 lines · Duncan Roe

Two distinct actions:
1. Remove trailing spaces and tabs.
2. Remove spaces that are followed by a tab, inserting extra tabs as required.
Action 2 is only performed in the indent region of a line.

---
 include/linux/netlink.h | 6 +++---
 src/callback.c          | 4 ++--
 src/socket.c            | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
include/linux/netlink.h +1 -1
index ced0e1a..7c26175 100644
@@ -14,7 +14,7 @@
 #define NETLINK_SELINUX		7	/* SELinux event notifications */
 #define NETLINK_ISCSI		8	/* Open-iSCSI */
 #define NETLINK_AUDIT		9	/* auditing */
-#define NETLINK_FIB_LOOKUP	10	
+#define NETLINK_FIB_LOOKUP	10
 #define NETLINK_CONNECTOR	11
 #define NETLINK_NETFILTER	12	/* netfilter subsystem */
 #define NETLINK_IP6_FW		13

include/linux/netlink.h line 32

Quoted 5 lines
include/linux/netlink.h +1 -1
@@ -29,13 +29,13 @@
 
 #define NETLINK_INET_DIAG	NETLINK_SOCK_DIAG
 
-#define MAX_LINKS 32		
+#define MAX_LINKS 32

Submit uapi/netlink.h update upstream via netdev@

This is a cached copy of uapi/netlink.h

If I take this, the extra line spaces and indentation will come back sooner or later.

Thanks.

author
#2 lore raw

Hi Pablo,

Quoted 14 lines · Pablo Neira Ayuso
Quoted 6 lines · Duncan Roe

Two distinct actions:
1. Remove trailing spaces and tabs.
2. Remove spaces that are followed by a tab, inserting extra tabs as required.
Action 2 is only performed in the indent region of a line.

Quoted 6 lines
---
 include/linux/netlink.h | 6 +++---
 src/callback.c          | 4 ++--
 src/socket.c            | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
Quoted 8 lines

Submit uapi/netlink.h update upstream via netdev@

This is a cached copy of uapi/netlink.h

If I take this, the extra line spaces and indentation will come back sooner or later.

Thanks.

Thanks for that advice, I've submitted a v2 which only fixes spacing in 2 .c files. The .c files are the ones giving me grief because q, the editor I use, is configured to fix spacing on saving any file. I could change the configuration but would rather not.

As for uapi/linux/netlink.h, well hmm. One of the q editor's "party tricks" is to go through the entire kernel tree correcting all the space irregularities. I've wondered about sending a kernel-wide patch except there are a few sources which seem to assume 4-char tabs: I'd leave them out for now.

q finds 120 space-irregular files under uapi/linux alone, but obviously only a few are appropriate for netdev@.

Just these 2?

| include/uapi/linux/netlink.h                        |   6 +++---
| include/uapi/linux/rtnetlink.h                      |   8 ++++----

Or these as well?

| include/uapi/linux/netfilter/nf_conntrack_common.h  |   2 +-
| include/uapi/linux/netfilter/nfnetlink.h            |   6 +++---
| include/uapi/linux/netfilter/nfnetlink_compat.h     |   8 ++++----
| include/uapi/linux/netfilter/x_tables.h             |   4 ++--
| include/uapi/linux/netfilter/xt_NFQUEUE.h           |   2 +-
| include/uapi/linux/netfilter/xt_ecn.h               |   2 +-
| include/uapi/linux/netfilter_arp/arp_tables.h       |   2 +-
| include/uapi/linux/netfilter_bridge.h               |   2 +-
| include/uapi/linux/netfilter_bridge/ebt_802_3.h     |   2 +-
| include/uapi/linux/netfilter_bridge/ebt_among.h     |   4 ++--
| include/uapi/linux/netfilter_bridge/ebt_vlan.h      |   2 +-
| include/uapi/linux/netfilter_bridge/ebtables.h      |  10 +++++-----
| include/uapi/linux/netfilter_ipv4.h                 |   2 +-
| include/uapi/linux/netfilter_ipv4/ip_tables.h       |   2 +-
| include/uapi/linux/netfilter_ipv4/ipt_ECN.h         |   2 +-
| include/uapi/linux/netfilter_ipv6.h                 |   4 ++--
| include/uapi/linux/netfilter_ipv6/ip6_tables.h      |   6 +++---
| include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h |   2 +-

and what about this lot?

| include/uapi/linux/ax25.h                           |  14 +++++++-------
| include/uapi/linux/icmpv6.h                         |  24 ++++++++++++------------
| include/uapi/linux/if.h                             |   6 +++---
| include/uapi/linux/if_eql.h                         |   2 +-
| include/uapi/linux/if_hippi.h                       |   6 +++---
| include/uapi/linux/if_plip.h                        |   2 +-
| include/uapi/linux/if_pppox.h                       |  14 +++++++-------
| include/uapi/linux/if_slip.h                        |   8 ++++----
| include/uapi/linux/if_tun.h                         |   8 ++++----
| include/uapi/linux/if_vlan.h                        |   6 +++---
| include/uapi/linux/in.h                             |   2 +-
| include/uapi/linux/in6.h                            |   8 ++++----
| include/uapi/linux/inet_diag.h                      |   2 +-
| include/uapi/linux/ip.h                             |   2 +-
| include/uapi/linux/ipv6.h                           |   4 ++--
| include/uapi/linux/ipv6_route.h                     |   6 +++---
| include/uapi/linux/netdevice.h                      |  14 +++++++-------
| include/uapi/linux/ppp_defs.h                       |   2 +-
| include/uapi/linux/sockios.h                        |   8 ++++----
| include/uapi/linux/x25.h                            |   4 ++--

Any advice greatly appreciated,

Cheers ... Duncan.