Skip to content

Commit

Permalink
More type cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
tuexen committed Jun 13, 2020
1 parent 04fd4dd commit 55bdb97
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 47 deletions.
7 changes: 2 additions & 5 deletions usrsctplib/netinet/sctp_os_userspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,12 @@ typedef __int8 int8_t;
#typedef __int32 size_t;
#endif
typedef unsigned __int32 u_int;
typedef unsigned __int32 u_int32_t;
typedef unsigned __int16 u_int16_t;
typedef unsigned __int8 u_int8_t;
typedef unsigned char u_char;
typedef unsigned __int16 n_short;
typedef unsigned __int16 u_short;
typedef unsigned __int32 n_time;
typedef unsigned __int8 sa_family_t;
#ifndef _SSIZE_T_DEFINED
typedef __int64 ssize_t;
#endif
#if !defined(__MINGW32__)
#define __func__ __FUNCTION__
#endif
Expand Down
14 changes: 7 additions & 7 deletions usrsctplib/user_inpcb.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ LIST_HEAD(inpcbporthead, inpcbport);
* the following structure.
*/
struct in_addr_4in6 {
u_int32_t ia46_pad32[3];
uint32_t ia46_pad32[3];
struct in_addr ia46_addr4;
};

Expand All @@ -63,8 +63,8 @@ struct in_addr_4in6 {
* some extra padding to accomplish this.
*/
struct in_endpoints {
u_int16_t ie_fport; /* foreign port */
u_int16_t ie_lport; /* local port */
uint16_t ie_fport; /* foreign port */
uint16_t ie_lport; /* local port */
/* protocol dependent part, local and foreign addr */
union {
/* foreign host table entry */
Expand All @@ -87,9 +87,9 @@ struct in_endpoints {
* references.
*/
struct in_conninfo {
u_int8_t inc_flags;
u_int8_t inc_len;
u_int16_t inc_pad; /* XXX alignment for in_endpoints */
uint8_t inc_flags;
uint8_t inc_len;
uint16_t inc_pad; /* XXX alignment for in_endpoints */
/* protocol dependent part */
struct in_endpoints inc_ie;
};
Expand All @@ -110,7 +110,7 @@ struct inpcb {
struct inpcbinfo *inp_pcbinfo; /* PCB list info */
struct socket *inp_socket; /* back pointer to socket */

u_int32_t inp_flow;
uint32_t inp_flow;
int inp_flags; /* generic IP/datagram flags */

u_char inp_vflag; /* IP version flag (v4/v6) */
Expand Down
10 changes: 5 additions & 5 deletions usrsctplib/user_ip6_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
struct ip6_hdr {
union {
struct ip6_hdrctl {
u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */
u_int16_t ip6_un1_plen; /* payload length */
u_int8_t ip6_un1_nxt; /* next header */
u_int8_t ip6_un1_hlim; /* hop limit */
uint32_t ip6_un1_flow; /* 20 bits of flow-ID */
uint16_t ip6_un1_plen; /* payload length */
uint8_t ip6_un1_nxt; /* next header */
uint8_t ip6_un1_hlim; /* hop limit */
} ip6_un1;
u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */
uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */
} ip6_ctlun;
struct in6_addr ip6_src; /* source address */
struct in6_addr ip6_dst; /* destination address */
Expand Down
20 changes: 10 additions & 10 deletions usrsctplib/user_ip_icmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
* Internal of an ICMP Router Advertisement
*/
struct icmp_ra_addr {
u_int32_t ira_addr;
u_int32_t ira_preference;
uint32_t ira_addr;
uint32_t ira_preference;
};

/*
Expand All @@ -56,13 +56,13 @@ struct icmphdr {
#if defined(_WIN32)
#pragma pack (push, 1)
struct icmp6_hdr {
u_int8_t icmp6_type;
u_int8_t icmp6_code;
u_int16_t icmp6_cksum;
uint8_t icmp6_type;
uint8_t icmp6_code;
uint16_t icmp6_cksum;
union {
u_int32_t icmp6_un_data32[1];
u_int16_t icmp6_un_data16[2];
u_int8_t icmp6_un_data8[4];
uint32_t icmp6_un_data32[1];
uint16_t icmp6_un_data16[2];
uint8_t icmp6_un_data8[4];
} icmp6_dataun;
};
#pragma pack(pop)
Expand Down Expand Up @@ -98,7 +98,7 @@ struct icmp {
struct ih_rtradv {
u_char irt_num_addrs;
u_char irt_wpa;
u_int16_t irt_lifetime;
uint16_t irt_lifetime;
} ih_rtradv;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
Expand Down Expand Up @@ -126,7 +126,7 @@ struct icmp {
/* options and then 64 bits of data */
} id_ip;
struct icmp_ra_addr id_radv;
u_int32_t id_mask;
uint32_t id_mask;
char id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime
Expand Down
4 changes: 2 additions & 2 deletions usrsctplib/user_mbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ m_tag_free(struct m_tag *t)
* XXX probably should be called m_tag_init, but that was already taken.
*/
static __inline void
m_tag_setup(struct m_tag *t, u_int32_t cookie, int type, int len)
m_tag_setup(struct m_tag *t, uint32_t cookie, int type, int len)
{

t->m_tag_id = type;
Expand Down Expand Up @@ -1239,7 +1239,7 @@ m_tag_copy(struct m_tag *t, int how)

/* Get a packet tag structure along with specified data following. */
struct m_tag *
m_tag_alloc(u_int32_t cookie, int type, int len, int wait)
m_tag_alloc(uint32_t cookie, int type, int len, int wait)
{
struct m_tag *t;

Expand Down
12 changes: 6 additions & 6 deletions usrsctplib/user_mbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void m_cat(struct mbuf *m, struct mbuf *n);
void m_adj(struct mbuf *, int);
void mb_free_ext(struct mbuf *);
void m_freem(struct mbuf *);
struct m_tag *m_tag_alloc(u_int32_t, int, int, int);
struct m_tag *m_tag_alloc(uint32_t, int, int, int);
struct mbuf *m_copym(struct mbuf *, int, int, int);
void m_copyback(struct mbuf *, int, int, caddr_t);
struct mbuf *m_pullup(struct mbuf *, int);
Expand Down Expand Up @@ -161,9 +161,9 @@ struct m_hdr {
*/
struct m_tag {
SLIST_ENTRY(m_tag) m_tag_link; /* List of packet tags */
u_int16_t m_tag_id; /* Tag ID */
u_int16_t m_tag_len; /* Length of data */
u_int32_t m_tag_cookie; /* ABI/Module ID */
uint16_t m_tag_id; /* Tag ID */
uint16_t m_tag_len; /* Length of data */
uint32_t m_tag_cookie; /* ABI/Module ID */
void (*m_tag_free)(struct m_tag *);
};

Expand All @@ -178,8 +178,8 @@ struct pkthdr {
/* variables for hardware checksum */
int csum_flags; /* flags regarding checksum */
int csum_data; /* data field used by csum routines */
u_int16_t tso_segsz; /* TSO segment size */
u_int16_t ether_vtag; /* Ethernet 802.1p+q vlan tag */
uint16_t tso_segsz; /* TSO segment size */
uint16_t ether_vtag; /* Ethernet 802.1p+q vlan tag */
SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
};

Expand Down
20 changes: 10 additions & 10 deletions usrsctplib/user_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,11 +741,11 @@ userspace_sctp_sendmsg(struct socket *so,
size_t len,
struct sockaddr *to,
socklen_t tolen,
u_int32_t ppid,
u_int32_t flags,
u_int16_t stream_no,
u_int32_t timetolive,
u_int32_t context)
uint32_t ppid,
uint32_t flags,
uint16_t stream_no,
uint32_t timetolive,
uint32_t context)
{
struct sctp_sndrcvinfo sndrcvinfo, *sinfo = &sndrcvinfo;
struct uio auio;
Expand Down Expand Up @@ -925,11 +925,11 @@ userspace_sctp_sendmbuf(struct socket *so,
size_t len,
struct sockaddr *to,
socklen_t tolen,
u_int32_t ppid,
u_int32_t flags,
u_int16_t stream_no,
u_int32_t timetolive,
u_int32_t context)
uint32_t ppid,
uint32_t flags,
uint16_t stream_no,
uint32_t timetolive,
uint32_t context)
{

struct sctp_sndrcvinfo sndrcvinfo, *sinfo = &sndrcvinfo;
Expand Down
4 changes: 2 additions & 2 deletions usrsctplib/user_uma.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ struct uma_zone {
/* Prototype */
uma_zone_t
uma_zcreate(char *name, size_t size, uma_ctor ctor, uma_dtor dtor,
uma_init uminit, uma_fini fini, int align, u_int32_t flags);
uma_init uminit, uma_fini fini, int align, uint32_t flags);


#define uma_zone_set_max(zone, number) /* stub TODO __Userspace__ */

uma_zone_t
uma_zcreate(char *name, size_t size, uma_ctor ctor, uma_dtor dtor,
uma_init uminit, uma_fini fini, int align, u_int32_t flags) {
uma_init uminit, uma_fini fini, int align, uint32_t flags) {
return NULL; /* stub TODO __Userspace__. Also place implementation in a separate .c file */
}
#endif

0 comments on commit 55bdb97

Please sign in to comment.