Commit d94d9fee authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: cleanup include/linux



This cleanup patch puts struct/union/enum opening braces,
in first line to ease grep games.

struct something
{

becomes :

struct something {
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8883a65
......@@ -71,14 +71,12 @@
/* Structures */
struct dn_naddr
{
struct dn_naddr {
__le16 a_len;
__u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */
};
struct sockaddr_dn
{
struct sockaddr_dn {
__u16 sdn_family;
__u8 sdn_flags;
__u8 sdn_objnum;
......@@ -101,8 +99,7 @@ struct optdata_dn {
__u8 opt_data[16]; /* User data */
};
struct accessdata_dn
{
struct accessdata_dn {
__u8 acc_accl;
__u8 acc_acc[DN_MAXACCL];
__u8 acc_passl;
......
......@@ -3,8 +3,7 @@
#include <linux/types.h>
struct sock_extended_err
{
struct sock_extended_err {
__u32 ee_errno;
__u8 ee_origin;
__u8 ee_type;
......@@ -31,8 +30,7 @@ struct sock_extended_err
#define SKB_EXT_ERR(skb) ((struct sock_exterr_skb *) ((skb)->cb))
struct sock_exterr_skb
{
struct sock_exterr_skb {
union {
struct inet_skb_parm h4;
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
......
......@@ -13,8 +13,7 @@
/* try to find source address in routing lookups */
#define FIB_RULE_FIND_SADDR 0x00010000
struct fib_rule_hdr
{
struct fib_rule_hdr {
__u8 family;
__u8 dst_len;
__u8 src_len;
......@@ -28,8 +27,7 @@ struct fib_rule_hdr
__u32 flags;
};
enum
{
enum {
FRA_UNSPEC,
FRA_DST, /* destination address */
FRA_SRC, /* source address */
......@@ -52,8 +50,7 @@ enum
#define FRA_MAX (__FRA_MAX - 1)
enum
{
enum {
FR_ACT_UNSPEC,
FR_ACT_TO_TBL, /* Pass to fixed table */
FR_ACT_GOTO, /* Jump to another rule */
......
......@@ -23,16 +23,14 @@
* the BPF code definitions which need to match so you can share filters
*/
struct sock_filter /* Filter block */
{
struct sock_filter { /* Filter block */
__u16 code; /* Actual filter code */
__u8 jt; /* Jump true */
__u8 jf; /* Jump false */
__u32 k; /* Generic multiuse field */
};
struct sock_fprog /* Required for SO_ATTACH_FILTER. */
{
struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
unsigned short len; /* Number of filter blocks */
struct sock_filter __user *filter;
};
......
......@@ -18,13 +18,11 @@ enum {
* @bytes: number of seen bytes
* @packets: number of seen packets
*/
struct gnet_stats_basic
{
struct gnet_stats_basic {
__u64 bytes;
__u32 packets;
};
struct gnet_stats_basic_packed
{
struct gnet_stats_basic_packed {
__u64 bytes;
__u32 packets;
} __attribute__ ((packed));
......@@ -34,8 +32,7 @@ struct gnet_stats_basic_packed
* @bps: current byte rate
* @pps: current packet rate
*/
struct gnet_stats_rate_est
{
struct gnet_stats_rate_est {
__u32 bps;
__u32 pps;
};
......@@ -48,8 +45,7 @@ struct gnet_stats_rate_est
* @requeues: number of requeues
* @overlimits: number of enqueues over the limit
*/
struct gnet_stats_queue
{
struct gnet_stats_queue {
__u32 qlen;
__u32 backlog;
__u32 drops;
......@@ -62,8 +58,7 @@ struct gnet_stats_queue
* @interval: sampling period
* @ewma_log: the log of measurement window weight
*/
struct gnet_estimator
{
struct gnet_estimator {
signed char interval;
unsigned char ewma_log;
};
......
......@@ -125,8 +125,7 @@ enum {
* being very small might be worth keeping for clean configuration.
*/
struct ifmap
{
struct ifmap {
unsigned long mem_start;
unsigned long mem_end;
unsigned short base_addr;
......@@ -136,8 +135,7 @@ struct ifmap
/* 3 bytes spare */
};
struct if_settings
{
struct if_settings {
unsigned int type; /* Type of physical device or protocol */
unsigned int size; /* Size of the data allocated by the caller */
union {
......@@ -161,8 +159,7 @@ struct if_settings
* remainder may be interface specific.
*/
struct ifreq
{
struct ifreq {
#define IFHWADDRLEN 6
union
{
......@@ -211,11 +208,9 @@ struct ifreq
* must know all networks accessible).
*/
struct ifconf
{
struct ifconf {
int ifc_len; /* size of buffer */
union
{
union {
char __user *ifcu_buf;
struct ifreq __user *ifcu_req;
} ifc_ifcu;
......
......@@ -4,8 +4,7 @@
#include <linux/types.h>
#include <linux/netlink.h>
struct ifaddrmsg
{
struct ifaddrmsg {
__u8 ifa_family;
__u8 ifa_prefixlen; /* The prefix length */
__u8 ifa_flags; /* Flags */
......@@ -20,8 +19,7 @@ struct ifaddrmsg
* but for point-to-point IFA_ADDRESS is DESTINATION address,
* local address is supplied in IFA_LOCAL attribute.
*/
enum
{
enum {
IFA_UNSPEC,
IFA_ADDRESS,
IFA_LOCAL,
......@@ -47,8 +45,7 @@ enum
#define IFA_F_TENTATIVE 0x40
#define IFA_F_PERMANENT 0x80
struct ifa_cacheinfo
{
struct ifa_cacheinfo {
__u32 ifa_prefered;
__u32 ifa_valid;
__u32 cstamp; /* created timestamp, hundredths of seconds */
......
......@@ -12,8 +12,7 @@
#include <linux/types.h>
struct ifaddrlblmsg
{
struct ifaddrlblmsg {
__u8 ifal_family; /* Address family */
__u8 __ifal_reserved; /* Reserved */
__u8 ifal_prefixlen; /* Prefix length */
......@@ -22,8 +21,7 @@ struct ifaddrlblmsg
__u32 ifal_seq; /* sequence number */
};
enum
{
enum {
IFAL_ADDRESS = 1,
IFAL_LABEL = 2,
__IFAL_MAX
......
......@@ -56,8 +56,7 @@
/*
* The RFC1201-specific components of an arcnet packet header.
*/
struct arc_rfc1201
{
struct arc_rfc1201 {
__u8 proto; /* protocol ID field - varies */
__u8 split_flag; /* for use with split packets */
__be16 sequence; /* sequence number */
......@@ -69,8 +68,7 @@ struct arc_rfc1201
/*
* The RFC1051-specific components.
*/
struct arc_rfc1051
{
struct arc_rfc1051 {
__u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */
__u8 payload[0]; /* 507 bytes */
};
......@@ -81,8 +79,7 @@ struct arc_rfc1051
* The ethernet-encap-specific components. We have a real ethernet header
* and some data.
*/
struct arc_eth_encap
{
struct arc_eth_encap {
__u8 proto; /* Always ARC_P_ETHER */
struct ethhdr eth; /* standard ethernet header (yuck!) */
__u8 payload[0]; /* 493 bytes */
......@@ -90,8 +87,7 @@ struct arc_eth_encap
#define ETH_ENCAP_HDR_SIZE 14
struct arc_cap
{
struct arc_cap {
__u8 proto;
__u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */
union {
......@@ -108,8 +104,7 @@ struct arc_cap
* the _end_ of the 512-byte buffer. We hide this complexity inside the
* driver.
*/
struct arc_hardware
{
struct arc_hardware {
__u8 source, /* source ARCnet - filled in automagically */
dest, /* destination ARCnet - 0 for broadcast */
offset[2]; /* offset bytes (some weird semantics) */
......@@ -120,8 +115,7 @@ struct arc_hardware
* This is an ARCnet frame header, as seen by the kernel (and userspace,
* when you do a raw packet capture).
*/
struct archdr
{
struct archdr {
/* hardware requirements */
struct arc_hardware hard;
......
......@@ -133,8 +133,7 @@ struct arpreq_old {
* This structure defines an ethernet arp header.
*/
struct arphdr
{
struct arphdr {
__be16 ar_hrd; /* format of hardware address */
__be16 ar_pro; /* format of protocol address */
unsigned char ar_hln; /* length of hardware address */
......
......@@ -94,8 +94,7 @@ typedef struct ifbond {
__s32 miimon;
} ifbond;
typedef struct ifslave
{
typedef struct ifslave {
__s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */
char slave_name[IFNAMSIZ];
__s8 link;
......
......@@ -49,8 +49,7 @@
#define BR_STATE_FORWARDING 3
#define BR_STATE_BLOCKING 4
struct __bridge_info
{
struct __bridge_info {
__u64 designated_root;
__u64 bridge_id;
__u32 root_path_cost;
......@@ -72,8 +71,7 @@ struct __bridge_info
__u32 gc_timer_value;
};
struct __port_info
{
struct __port_info {
__u64 designated_root;
__u64 designated_bridge;
__u16 port_id;
......@@ -89,8 +87,7 @@ struct __port_info
__u32 hold_timer_value;
};
struct __fdb_entry
{
struct __fdb_entry {
__u8 mac_addr[6];
__u8 port_no;
__u8 is_local;
......
......@@ -5,14 +5,12 @@
/* User visible stuff. Glibc provides its own but libc5 folk will use these */
struct ec_addr
{
struct ec_addr {
unsigned char station; /* Station number. */
unsigned char net; /* Network number. */
};
struct sockaddr_ec
{
struct sockaddr_ec {
unsigned short sec_family;
unsigned char port; /* Port number. */
unsigned char cb; /* Control/flag byte. */
......@@ -37,8 +35,7 @@ struct sockaddr_ec
#define EC_HLEN 6
/* This is what an Econet frame looks like on the wire. */
struct ec_framehdr
{
struct ec_framehdr {
unsigned char dst_stn;
unsigned char dst_net;
unsigned char src_stn;
......@@ -62,8 +59,7 @@ static inline struct econet_sock *ec_sk(const struct sock *sk)
return (struct econet_sock *)sk;
}
struct ec_device
{
struct ec_device {
unsigned char station, net; /* Econet protocol address */
};
......
......@@ -63,36 +63,32 @@
#define FDDI_UI_CMD 0x03
/* Define 802.2 Type 1 header */
struct fddi_8022_1_hdr
{
struct fddi_8022_1_hdr {
__u8 dsap; /* destination service access point */
__u8 ssap; /* source service access point */
__u8 ctrl; /* control byte #1 */
} __attribute__ ((packed));
} __attribute__ ((packed));
/* Define 802.2 Type 2 header */
struct fddi_8022_2_hdr
{
struct fddi_8022_2_hdr {
__u8 dsap; /* destination service access point */
__u8 ssap; /* source service access point */
__u8 ctrl_1; /* control byte #1 */
__u8 ctrl_2; /* control byte #2 */
} __attribute__ ((packed));
} __attribute__ ((packed));
/* Define 802.2 SNAP header */
#define FDDI_K_OUI_LEN 3
struct fddi_snap_hdr
{
struct fddi_snap_hdr {
__u8 dsap; /* always 0xAA */
__u8 ssap; /* always 0xAA */
__u8 ctrl; /* always 0x03 */
__u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
__be16 ethertype; /* packet type ID field */
} __attribute__ ((packed));
} __attribute__ ((packed));
/* Define FDDI LLC frame header */
struct fddihdr
{
struct fddihdr {
__u8 fc; /* frame control */
__u8 daddr[FDDI_K_ALEN]; /* destination address */
__u8 saddr[FDDI_K_ALEN]; /* source address */
......@@ -102,7 +98,7 @@ struct fddihdr
struct fddi_8022_2_hdr llc_8022_2;
struct fddi_snap_hdr llc_snap;
} hdr;
} __attribute__ ((packed));
} __attribute__ ((packed));
#ifdef __KERNEL__
#include <linux/netdevice.h>
......@@ -197,7 +193,7 @@ struct fddi_statistics {
__u32 port_pc_withhold[2];
__u32 port_ler_flag[2];
__u32 port_hardware_present[2];
};
};
#endif /* __KERNEL__ */
#endif /* _LINUX_IF_FDDI_H */
......@@ -51,8 +51,7 @@
* HIPPI statistics collection data.
*/
struct hipnet_statistics
{
struct hipnet_statistics {
int rx_packets; /* total packets received */
int tx_packets; /* total packets transmitted */
int rx_errors; /* bad packets received */
......@@ -77,8 +76,7 @@ struct hipnet_statistics
};
struct hippi_fp_hdr
{
struct hippi_fp_hdr {
#if 0
__u8 ulp; /* must contain 4 */
#if defined (__BIG_ENDIAN_BITFIELD)
......@@ -108,8 +106,7 @@ struct hippi_fp_hdr
__be32 d2_size;
} __attribute__ ((packed));
struct hippi_le_hdr
{
struct hippi_le_hdr {
#if defined (__BIG_ENDIAN_BITFIELD)
__u8 fc:3;
__u8 double_wide:1;
......@@ -139,8 +136,7 @@ struct hippi_le_hdr
* Looks like the dsap and ssap fields have been swapped by mistake in
* RFC 2067 "IP over HIPPI".
*/
struct hippi_snap_hdr
{
struct hippi_snap_hdr {
__u8 dsap; /* always 0xAA */
__u8 ssap; /* always 0xAA */
__u8 ctrl; /* always 0x03 */
......@@ -148,8 +144,7 @@ struct hippi_snap_hdr
__be16 ethertype; /* packet type ID field */
} __attribute__ ((packed));
struct hippi_hdr
{
struct hippi_hdr {
struct hippi_fp_hdr fp;
struct hippi_le_hdr le;
struct hippi_snap_hdr snap;
......
......@@ -5,8 +5,7 @@
#include <linux/netlink.h>
/* The struct should be in sync with struct net_device_stats */
struct rtnl_link_stats
{
struct rtnl_link_stats {
__u32 rx_packets; /* total packets received */
__u32 tx_packets; /* total packets transmitted */
__u32 rx_bytes; /* total bytes received */
......@@ -39,8 +38,7 @@ struct rtnl_link_stats
};
/* The struct should be in sync with struct ifmap */
struct rtnl_link_ifmap
{
struct rtnl_link_ifmap {
__u64 mem_start;
__u64 mem_end;
__u64 base_addr;
......@@ -49,8 +47,7 @@ struct rtnl_link_ifmap
__u8 port;
};
enum
{
enum {
IFLA_UNSPEC,
IFLA_ADDRESS,
IFLA_BROADCAST,
......@@ -123,8 +120,7 @@ enum
*/
/* Subtype attributes for IFLA_PROTINFO */
enum
{
enum {
IFLA_INET6_UNSPEC,
IFLA_INET6_FLAGS, /* link flags */
IFLA_INET6_CONF, /* sysctl parameters */
......@@ -137,16 +133,14 @@ enum
#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
struct ifla_cacheinfo
{
struct ifla_cacheinfo {
__u32 max_reasm_len;
__u32 tstamp; /* ipv6InterfaceTable updated timestamp */
__u32 reachable_time;
__u32 retrans_time;
};
enum
{
enum {
IFLA_INFO_UNSPEC,
IFLA_INFO_KIND,
IFLA_INFO_DATA,
......@@ -158,8 +152,7 @@ enum
/* VLAN section */
enum
{
enum {
IFLA_VLAN_UNSPEC,
IFLA_VLAN_ID,
IFLA_VLAN_FLAGS,
......@@ -175,8 +168,7 @@ struct ifla_vlan_flags {
__u32 mask;
};
enum
{
enum {
IFLA_VLAN_QOS_UNSPEC,
IFLA_VLAN_QOS_MAPPING,
__IFLA_VLAN_QOS_MAX
......@@ -184,8 +176,7 @@ enum
#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1)
struct ifla_vlan_qos_mapping
{
struct ifla_vlan_qos_mapping {
__u32 from;
__u32 to;
};
......
......@@ -3,15 +3,13 @@
#include <linux/types.h>
struct sockaddr_pkt
{
struct sockaddr_pkt {
unsigned short spkt_family;
unsigned char spkt_device[14];
__be16 spkt_protocol;
};
struct sockaddr_ll
{
struct sockaddr_ll {
unsigned short sll_family;
__be16 sll_protocol;
int sll_ifindex;
......@@ -49,14 +47,12 @@ struct sockaddr_ll
#define PACKET_TX_RING 13
#define PACKET_LOSS 14
struct tpacket_stats
{
struct tpacket_stats {
unsigned int tp_packets;
unsigned int tp_drops;
};
struct tpacket_auxdata
{
struct tpacket_auxdata {
__u32 tp_status;
__u32 tp_len;
__u32 tp_snaplen;
......@@ -78,8 +74,7 @@ struct tpacket_auxdata
#define TP_STATUS_SENDING 0x2
#define TP_STATUS_WRONG_FORMAT 0x4
struct tpacket_hdr
{
struct tpacket_hdr {
unsigned long tp_status;
unsigned int tp_len;
unsigned int tp_snaplen;
......@@ -93,8 +88,7 @@ struct tpacket_hdr
#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1))
#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
struct tpacket2_hdr
{
struct tpacket2_hdr {
__u32 tp_status;
__u32 tp_len;
__u32 tp_snaplen;
......@@ -107,8 +101,7 @@ struct tpacket2_hdr
#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll))
enum tpacket_versions
{
enum tpacket_versions {
TPACKET_V1,
TPACKET_V2,
};
......@@ -126,16 +119,14 @@ enum tpacket_versions
- Pad to align to TPACKET_ALIGNMENT=16
*/
struct tpacket_req
{
struct tpacket_req {
unsigned int tp_block_size; /* Minimal size of contiguous block */
unsigned int tp_block_nr; /* Number of blocks */
unsigned int tp_frame_size; /* Size of frame */
unsigned int tp_frame_nr; /* Total number of frames */