提交 befa5866 编写于 作者: R Rich Felker

make brace placement in public header struct definitions consistent

placing the opening brace on the same line as the struct keyword/tag
is the style I prefer and seems to be the prevailing practice in more
recent additions.

these changes were generated by the command:

find include/ arch/*/bits -name '*.h' \
-exec sed -i '/^struct [^;{]*$/{N;s/\n/ /;}' {} +

and subsequently checked by hand to ensure that the regex did not pick
up any false positives.
上级 093288dc
struct ipc_perm
{
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
......
#define SHMLBA 4096
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
......
#include <endian.h>
struct msghdr
{
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
......@@ -21,8 +20,7 @@ struct msghdr
int msg_flags;
};
struct cmsghdr
{
struct cmsghdr {
#if __BYTE_ORDER == __BIG_ENDIAN
int __pad1;
socklen_t cmsg_len;
......
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat
{
struct stat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
......
struct ipc_perm
{
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
int __unused1;
......
#define SHMLBA 4096
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
......
struct msghdr
{
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
......@@ -9,8 +8,7 @@ struct msghdr
int msg_flags;
};
struct cmsghdr
{
struct cmsghdr {
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
......
struct termios
{
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
......
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat
{
struct stat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
......
......@@ -13,8 +13,7 @@ typedef struct user_fpxregs_struct
long st_space[32], xmm_space[32], padding[56];
} elf_fpxregset_t;
struct user_regs_struct
{
struct user_regs_struct {
long ebx, ecx, edx, esi, edi, ebp, eax, xds, xes, xfs, xgs;
long orig_eax, eip, xcs, eflags, esp, xss;
};
......@@ -22,8 +21,7 @@ struct user_regs_struct
#define ELF_NGREG 17
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
struct user
{
struct user {
struct user_regs_struct regs;
int u_fpvalid;
struct user_fpregs_struct i387;
......
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat
{
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
#if _MIPSEL || __MIPSEL || __MIPSEL__
time_t msg_stime;
......
#define SHMLBA 4096
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
......
......@@ -17,8 +17,7 @@ typedef struct {
} fp_fregs[32];
} fp_r;
} fpregset_t;
struct sigcontext
{
struct sigcontext {
unsigned sc_regmask, sc_status;
unsigned long long sc_pc, sc_regs[32], sc_fpregs[32];
unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp;
......
struct msghdr
{
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
......@@ -9,8 +8,7 @@ struct msghdr
int msg_flags;
};
struct cmsghdr
{
struct cmsghdr {
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
......
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat
{
struct stat {
dev_t st_dev;
long __st_padding1[2];
ino_t st_ino;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
#if _MIPSEL || __MIPSEL || __MIPSEL__
time_t msg_stime;
......
struct ipc_perm
{
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
int __unused1;
time_t msg_stime;
......
#define SHMLBA 4096
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
int __unused1;
time_t shm_atime;
......
......@@ -23,8 +23,7 @@ typedef struct {
unsigned vscr;
} vrregset_t;
struct sigcontext
{
struct sigcontext {
unsigned long _unused[4];
int signal;
unsigned long handler;
......
struct msghdr
{
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
......@@ -9,8 +8,7 @@ struct msghdr
int msg_flags;
};
struct cmsghdr
{
struct cmsghdr {
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
......
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat
{
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
......
#undef NCCS
#define NCCS 19
struct termios
{
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
......
struct ipc_perm
{
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
......
#define SHMLBA 4096
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
time_t shm_atime;
time_t shm_dtime;
......
#include <endian.h>
struct msghdr
{
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
......@@ -21,8 +20,7 @@ struct msghdr
int msg_flags;
};
struct cmsghdr
{
struct cmsghdr {
#if __BYTE_ORDER == __BIG_ENDIAN
int __pad1;
socklen_t cmsg_len;
......
struct stat
{
struct stat {
dev_t st_dev;
ino_t st_ino;
nlink_t st_nlink;
......
#undef NCCS
#define NCCS 19
struct termios
{
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
......
#define SHMLBA 16384
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
......
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat
{
struct stat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
......
struct ipc_perm
{
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
......
#define SHMLBA 4096
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
......
struct msghdr
{
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
......@@ -9,8 +8,7 @@ struct msghdr
int msg_flags;
};
struct cmsghdr
{
struct cmsghdr {
socklen_t cmsg_len;
int __pad1;
int cmsg_level;
......
......@@ -9,8 +9,7 @@ typedef struct user_fpregs_struct
uint32_t st_space[32], xmm_space[64], padding[24];
} elf_fpregset_t;
struct user_regs_struct
{
struct user_regs_struct {
unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
......@@ -18,8 +17,7 @@ struct user_regs_struct
#define ELF_NGREG 27
typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
struct user
{
struct user {
struct user_regs_struct regs;
int u_fpvalid;
struct user_fpregs_struct i387;
......
struct ipc_perm
{
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
......
struct msqid_ds
{
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
......
#define SHMLBA 4096
struct shmid_ds
{
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
......
struct msghdr
{
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
......@@ -9,8 +8,7 @@ struct msghdr
int msg_flags;
};
struct cmsghdr
{
struct cmsghdr {
socklen_t cmsg_len;
int __pad1;
int cmsg_level;
......
......@@ -9,8 +9,7 @@ typedef struct user_fpregs_struct
uint32_t st_space[32], xmm_space[64], padding[24];
} elf_fpregset_t;
struct user_regs_struct
{
struct user_regs_struct {
unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
......@@ -18,8 +17,7 @@ struct user_regs_struct
#define ELF_NGREG 27
typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
struct user
{
struct user {
struct user_regs_struct regs;
int u_fpvalid;
struct user_fpregs_struct i387;
......
......@@ -17,8 +17,7 @@ extern "C" {
typedef struct __dirstream DIR;
struct dirent
{
struct dirent {
ino_t d_ino;
off_t d_off;
unsigned short d_reclen;
......
......@@ -21,8 +21,7 @@ extern "C" {
#include <bits/fcntl.h>
struct flock
{
struct flock {
short l_type;
short l_whence;
off_t l_start;
......
......@@ -21,8 +21,7 @@ extern "C" {
#define FTW_CHDIR 4
#define FTW_DEPTH 8
struct FTW
{
struct FTW {
int base;
int level;
};
......
......@@ -9,8 +9,7 @@ int getopt(int, char * const [], const char *);
extern char *optarg;
extern int optind, opterr, optopt, optreset;
struct option
{
struct option {
const char *name;
int has_arg;
int *flag;
......
......@@ -16,8 +16,7 @@ extern "C" {
#include <bits/alltypes.h>
struct group
{
struct group {
char *gr_name;
char *gr_passwd;
gid_t gr_gid;
......
......@@ -20,8 +20,7 @@ extern "C" {
#define MNTOPT_NOSUID "nosuid"
#define MNTOPT_NOAUTO "noauto"
struct mntent
{
struct mntent {
char *mnt_fsname;
char *mnt_dir;
char *mnt_type;
......
......@@ -9,8 +9,7 @@ extern "C" {
#define IF_NAMESIZE 16
struct if_nameindex
{
struct if_nameindex {
unsigned int if_index;
char *if_name;
};
......
......@@ -13,8 +13,7 @@ extern "C" {
#include <bits/alltypes.h>
#endif
struct addrinfo
{
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
......@@ -62,16 +61,14 @@ const char *gai_strerror(int);
/* Legacy functions follow (marked OBsolete in SUS) */
struct netent
{
struct netent {
char *n_name;
char **n_aliases;
int n_addrtype;
uint32_t n_net;
};
struct hostent
{
struct hostent {
char *h_name;
char **h_aliases;
int h_addrtype;
......@@ -80,16 +77,14 @@ struct hostent
};
#define h_addr h_addr_list[0]
struct servent
{
struct servent {
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
struct protoent
{
struct protoent {
char *p_name;
char **p_aliases;
int p_proto;
......
......@@ -13,16 +13,14 @@ typedef uint16_t in_port_t;
typedef uint32_t in_addr_t;
struct in_addr { in_addr_t s_addr; };
struct sockaddr_in
{
struct sockaddr_in {
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
uint8_t sin_zero[8];
};
struct in6_addr
{
struct in6_addr {
union {
uint8_t __s6_addr[16];
uint16_t __s6_addr16[8];
......@@ -33,8 +31,7 @@ struct in6_addr
#define s6_addr16 __in6_union.__s6_addr16
#define s6_addr32 __in6_union.__s6_addr32
struct sockaddr_in6
{
struct sockaddr_in6 {
sa_family_t sin6_family;
in_port_t sin6_port;
uint32_t sin6_flowinfo;
......@@ -42,8 +39,7 @@ struct sockaddr_in6
uint32_t sin6_scope_id;
};
struct ipv6_mreq
{
struct ipv6_mreq {
struct in6_addr ipv6mr_multiaddr;
unsigned ipv6mr_interface;
};
......@@ -228,8 +224,7 @@ uint16_t ntohs(uint16_t);
#define IP_DEFAULT_MULTICAST_LOOP 1
#define IP_MAX_MEMBERSHIPS 20
struct ip_opts
{
struct ip_opts {
struct in_addr ip_dst;
char ip_opts[40];
};
......@@ -247,14 +242,12 @@ struct ip_opts
#define MCAST_EXCLUDE 0
#define MCAST_INCLUDE 1
struct ip_mreq
{
struct ip_mreq {
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
};
struct ip_mreqn
{
struct ip_mreqn {
struct in_addr imr_multiaddr;
struct in_addr imr_address;
int imr_ifindex;
......@@ -299,21 +292,18 @@ struct group_filter {
(sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
+ (numsrc) * sizeof(struct sockaddr_storage))
struct in_pktinfo
{
struct in_pktinfo {
int ipi_ifindex;
struct in_addr ipi_spec_dst;
struct in_addr ipi_addr;
};
struct in6_pktinfo
{
struct in6_pktinfo {
struct in6_addr ipi6_addr;
unsigned ipi6_ifindex;
};
struct ip6_mtuinfo
{
struct ip6_mtuinfo {
struct sockaddr_in6 ip6m_addr;
uint32_t ip6m_mtu;
};
......
......@@ -145,8 +145,7 @@ struct tcphdr {
#define TCP_CA_Recovery 3
#define TCP_CA_Loss 4
struct tcp_info
{
struct tcp_info {
uint8_t tcpi_state;
uint8_t tcpi_ca_state;
uint8_t tcpi_retransmits;
......@@ -192,8 +191,7 @@ struct tcp_info
#define TCP_MD5SIG_MAXKEYLEN 80
struct tcp_md5sig
{
struct tcp_md5sig {
struct sockaddr_storage tcpm_addr;
uint16_t __tcpm_pad1;
uint16_t tcpm_keylen;
......
......@@ -28,8 +28,7 @@ extern "C" {
typedef unsigned long nfds_t;
struct pollfd
{
struct pollfd {
int fd;
short events;
short revents;
......
......@@ -17,8 +17,7 @@ extern "C" {
#include <bits/alltypes.h>
struct passwd
{
struct passwd {
char *pw_name;
char *pw_passwd;
uid_t pw_uid;
......
......@@ -14,8 +14,7 @@ extern "C" {
typedef uint16_t comp_t;
struct acct
{
struct acct {
char ac_flag;
uint16_t ac_uid;
uint16_t ac_gid;
......@@ -36,8 +35,7 @@ struct acct
};
struct acct_v3
{
struct acct_v3 {
char ac_flag;
char ac_version;
uint16_t ac_tty;
......
......@@ -33,8 +33,7 @@ struct elf_prstatus {
#define ELF_PRARGSZ 80
struct elf_prpsinfo
{
struct elf_prpsinfo {
char pr_state;
char pr_sname;
char pr_zomb;
......
......@@ -57,8 +57,7 @@ extern "C" {
#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
struct dqblk
{
struct dqblk {
uint64_t dqb_bhardlimit;
uint64_t dqb_bsoftlimit;
uint64_t dqb_curspace;
......@@ -87,8 +86,7 @@ struct dqblk
#define IIF_FLAGS 4
#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
struct dqinfo
{
struct dqinfo {
uint64_t dqi_bgrace;
uint64_t dqi_igrace;
uint32_t dqi_flags;
......
......@@ -19,14 +19,12 @@ extern "C" {
typedef unsigned long long rlim_t;
struct rlimit
{
struct rlimit {
rlim_t rlim_cur;
rlim_t rlim_max;
};
struct rusage
{
struct rusage {
struct timeval ru_utime;
struct timeval ru_stime;
/* linux extentions, but useful */
......
......@@ -20,15 +20,13 @@ extern "C" {
#include <bits/socket.h>
#ifdef _GNU_SOURCE
struct ucred
{
struct ucred {
pid_t pid;
uid_t uid;
gid_t gid;
};
struct mmsghdr
{
struct mmsghdr {
struct msghdr msg_hdr;
unsigned int msg_len;
};
......@@ -39,8 +37,7 @@ int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
#endif
struct linger
{
struct linger {
int l_onoff;
int l_linger;
};
......@@ -297,14 +294,12 @@ struct linger
#define SCM_RIGHTS 0x01
#define SCM_CREDENTIALS 0x02
struct sockaddr
{
struct sockaddr {
sa_family_t sa_family;
char sa_data[14];
};
struct sockaddr_storage
{
struct sockaddr_storage {
sa_family_t ss_family;
char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
unsigned long __ss_align;
......
......@@ -17,8 +17,7 @@ int gettimeofday (struct timeval *__restrict, void *__restrict);
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
struct itimerval
{
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
......
......@@ -8,8 +8,7 @@ extern "C" {
#define __NEED_clock_t
#include <bits/alltypes.h>
struct tms
{
struct tms {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
......
......@@ -14,8 +14,7 @@ extern "C" {
#include <bits/alltypes.h>
struct sockaddr_un
{
struct sockaddr_un {
sa_family_t sun_family;
char sun_path[108];
};
......
......@@ -7,8 +7,7 @@ extern "C" {
#include <features.h>
struct utsname
{
struct utsname {
char sysname[65];
char nodename[65];
char release[65];
......
......@@ -35,8 +35,7 @@ extern "C" {
#define __tm_zone tm_zone
#endif
struct tm
{
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
......@@ -78,8 +77,7 @@ char *ctime_r (const time_t *, char *);
void tzset (void);
struct itimerspec
{
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
......
......@@ -9,8 +9,7 @@ extern "C" {
#include <bits/alltypes.h>
struct utimbuf
{
struct utimbuf {
time_t actime;
time_t modtime;
};
......
......@@ -14,8 +14,7 @@ extern "C" {
#include <bits/alltypes.h>
struct utmpx
{
struct utmpx {
short ut_type;
pid_t ut_pid;
char ut_line[32];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册