Commit 1c662018 authored by Xin Long's avatar Xin Long Committed by David S. Miller

sctp: remove the typedef sctp_scope_t

This patch is to remove the typedef sctp_scope_t, and
replace with enum sctp_scope in the places where it's
using this typedef.
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 701ef3e6
...@@ -333,13 +333,13 @@ typedef enum { ...@@ -333,13 +333,13 @@ typedef enum {
* At this point, the IPv6 scopes will be mapped to these internal scopes * At this point, the IPv6 scopes will be mapped to these internal scopes
* as much as possible. * as much as possible.
*/ */
typedef enum { enum sctp_scope {
SCTP_SCOPE_GLOBAL, /* IPv4 global addresses */ SCTP_SCOPE_GLOBAL, /* IPv4 global addresses */
SCTP_SCOPE_PRIVATE, /* IPv4 private addresses */ SCTP_SCOPE_PRIVATE, /* IPv4 private addresses */
SCTP_SCOPE_LINK, /* IPv4 link local address */ SCTP_SCOPE_LINK, /* IPv4 link local address */
SCTP_SCOPE_LOOPBACK, /* IPv4 loopback address */ SCTP_SCOPE_LOOPBACK, /* IPv4 loopback address */
SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */ SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */
} sctp_scope_t; };
enum { enum {
SCTP_SCOPE_POLICY_DISABLE, /* Disable IPv4 address scoping */ SCTP_SCOPE_POLICY_DISABLE, /* Disable IPv4 address scoping */
......
...@@ -94,8 +94,8 @@ ...@@ -94,8 +94,8 @@
/* /*
* sctp/protocol.c * sctp/protocol.c
*/ */
int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *, int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *addr,
sctp_scope_t, gfp_t gfp, int flags); enum sctp_scope, gfp_t gfp, int flags);
struct sctp_pf *sctp_get_pf_specific(sa_family_t family); struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
int sctp_register_pf(struct sctp_pf *, sa_family_t); int sctp_register_pf(struct sctp_pf *, sa_family_t);
void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int); void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
......
...@@ -449,7 +449,7 @@ struct sctp_af { ...@@ -449,7 +449,7 @@ struct sctp_af {
int (*addr_valid) (union sctp_addr *, int (*addr_valid) (union sctp_addr *,
struct sctp_sock *, struct sctp_sock *,
const struct sk_buff *); const struct sk_buff *);
sctp_scope_t (*scope) (union sctp_addr *); enum sctp_scope (*scope)(union sctp_addr *);
void (*inaddr_any) (union sctp_addr *, __be16); void (*inaddr_any) (union sctp_addr *, __be16);
int (*is_any) (const union sctp_addr *); int (*is_any) (const union sctp_addr *);
int (*available) (union sctp_addr *, int (*available) (union sctp_addr *,
...@@ -1111,7 +1111,7 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); ...@@ -1111,7 +1111,7 @@ void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
void sctp_bind_addr_free(struct sctp_bind_addr *); void sctp_bind_addr_free(struct sctp_bind_addr *);
int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest, int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
const struct sctp_bind_addr *src, const struct sctp_bind_addr *src,
sctp_scope_t scope, gfp_t gfp, enum sctp_scope scope, gfp_t gfp,
int flags); int flags);
int sctp_bind_addr_dup(struct sctp_bind_addr *dest, int sctp_bind_addr_dup(struct sctp_bind_addr *dest,
const struct sctp_bind_addr *src, const struct sctp_bind_addr *src,
...@@ -1135,8 +1135,9 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, ...@@ -1135,8 +1135,9 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len, int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
__u16 port, gfp_t gfp); __u16 port, gfp_t gfp);
sctp_scope_t sctp_scope(const union sctp_addr *); enum sctp_scope sctp_scope(const union sctp_addr *addr);
int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope); int sctp_in_scope(struct net *net, const union sctp_addr *addr,
const enum sctp_scope scope);
int sctp_is_any(struct sock *sk, const union sctp_addr *addr); int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
int sctp_is_ep_boundall(struct sock *sk); int sctp_is_ep_boundall(struct sock *sk);
...@@ -1925,8 +1926,8 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base) ...@@ -1925,8 +1926,8 @@ static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
struct sctp_association * struct sctp_association *
sctp_association_new(const struct sctp_endpoint *, const struct sock *, sctp_association_new(const struct sctp_endpoint *ep, const struct sock *sk,
sctp_scope_t scope, gfp_t gfp); enum sctp_scope scope, gfp_t gfp);
void sctp_association_free(struct sctp_association *); void sctp_association_free(struct sctp_association *);
void sctp_association_put(struct sctp_association *); void sctp_association_put(struct sctp_association *);
void sctp_association_hold(struct sctp_association *); void sctp_association_hold(struct sctp_association *);
...@@ -1967,8 +1968,8 @@ void sctp_assoc_set_primary(struct sctp_association *, ...@@ -1967,8 +1968,8 @@ void sctp_assoc_set_primary(struct sctp_association *,
struct sctp_transport *); struct sctp_transport *);
void sctp_assoc_del_nonprimary_peers(struct sctp_association *, void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
struct sctp_transport *); struct sctp_transport *);
int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
sctp_scope_t, gfp_t); enum sctp_scope scope, gfp_t gfp);
int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
struct sctp_cookie*, struct sctp_cookie*,
gfp_t gfp); gfp_t gfp);
......
...@@ -63,11 +63,11 @@ static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc); ...@@ -63,11 +63,11 @@ static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc);
/* 1st Level Abstractions. */ /* 1st Level Abstractions. */
/* Initialize a new association from provided memory. */ /* Initialize a new association from provided memory. */
static struct sctp_association *sctp_association_init(struct sctp_association *asoc, static struct sctp_association *sctp_association_init(
const struct sctp_endpoint *ep, struct sctp_association *asoc,
const struct sock *sk, const struct sctp_endpoint *ep,
sctp_scope_t scope, const struct sock *sk,
gfp_t gfp) enum sctp_scope scope, gfp_t gfp)
{ {
struct net *net = sock_net(sk); struct net *net = sock_net(sk);
struct sctp_sock *sp; struct sctp_sock *sp;
...@@ -301,9 +301,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a ...@@ -301,9 +301,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
/* Allocate and initialize a new association */ /* Allocate and initialize a new association */
struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep, struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep,
const struct sock *sk, const struct sock *sk,
sctp_scope_t scope, enum sctp_scope scope, gfp_t gfp)
gfp_t gfp)
{ {
struct sctp_association *asoc; struct sctp_association *asoc;
...@@ -1564,7 +1563,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len) ...@@ -1564,7 +1563,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
* local endpoint and the remote peer. * local endpoint and the remote peer.
*/ */
int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
sctp_scope_t scope, gfp_t gfp) enum sctp_scope scope, gfp_t gfp)
{ {
int flags; int flags;
......
...@@ -45,9 +45,9 @@ ...@@ -45,9 +45,9 @@
#include <net/sctp/sm.h> #include <net/sctp/sm.h>
/* Forward declarations for internal helpers. */ /* Forward declarations for internal helpers. */
static int sctp_copy_one_addr(struct net *, struct sctp_bind_addr *, static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest,
union sctp_addr *, sctp_scope_t scope, gfp_t gfp, union sctp_addr *addr, enum sctp_scope scope,
int flags); gfp_t gfp, int flags);
static void sctp_bind_addr_clean(struct sctp_bind_addr *); static void sctp_bind_addr_clean(struct sctp_bind_addr *);
/* First Level Abstractions. */ /* First Level Abstractions. */
...@@ -57,7 +57,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *); ...@@ -57,7 +57,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *);
*/ */
int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest, int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
const struct sctp_bind_addr *src, const struct sctp_bind_addr *src,
sctp_scope_t scope, gfp_t gfp, enum sctp_scope scope, gfp_t gfp,
int flags) int flags)
{ {
struct sctp_sockaddr_entry *addr; struct sctp_sockaddr_entry *addr;
...@@ -440,9 +440,8 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, ...@@ -440,9 +440,8 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
/* Copy out addresses from the global local address list. */ /* Copy out addresses from the global local address list. */
static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest, static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest,
union sctp_addr *addr, union sctp_addr *addr, enum sctp_scope scope,
sctp_scope_t scope, gfp_t gfp, gfp_t gfp, int flags)
int flags)
{ {
int error = 0; int error = 0;
...@@ -485,9 +484,10 @@ int sctp_is_any(struct sock *sk, const union sctp_addr *addr) ...@@ -485,9 +484,10 @@ int sctp_is_any(struct sock *sk, const union sctp_addr *addr)
} }
/* Is 'addr' valid for 'scope'? */ /* Is 'addr' valid for 'scope'? */
int sctp_in_scope(struct net *net, const union sctp_addr *addr, sctp_scope_t scope) int sctp_in_scope(struct net *net, const union sctp_addr *addr,
enum sctp_scope scope)
{ {
sctp_scope_t addr_scope = sctp_scope(addr); enum sctp_scope addr_scope = sctp_scope(addr);
/* The unusable SCTP addresses will not be considered with /* The unusable SCTP addresses will not be considered with
* any defined scopes. * any defined scopes.
...@@ -545,7 +545,7 @@ int sctp_is_ep_boundall(struct sock *sk) ...@@ -545,7 +545,7 @@ int sctp_is_ep_boundall(struct sock *sk)
********************************************************************/ ********************************************************************/
/* What is the scope of 'addr'? */ /* What is the scope of 'addr'? */
sctp_scope_t sctp_scope(const union sctp_addr *addr) enum sctp_scope sctp_scope(const union sctp_addr *addr)
{ {
struct sctp_af *af; struct sctp_af *af;
......
...@@ -243,8 +243,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, ...@@ -243,8 +243,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
union sctp_addr *daddr = &t->ipaddr; union sctp_addr *daddr = &t->ipaddr;
union sctp_addr dst_saddr; union sctp_addr dst_saddr;
struct in6_addr *final_p, final; struct in6_addr *final_p, final;
enum sctp_scope scope;
__u8 matchlen = 0; __u8 matchlen = 0;
sctp_scope_t scope;
memset(fl6, 0, sizeof(struct flowi6)); memset(fl6, 0, sizeof(struct flowi6));
fl6->daddr = daddr->v6.sin6_addr; fl6->daddr = daddr->v6.sin6_addr;
...@@ -624,10 +624,10 @@ static int sctp_v6_addr_valid(union sctp_addr *addr, ...@@ -624,10 +624,10 @@ static int sctp_v6_addr_valid(union sctp_addr *addr,
} }
/* What is the scope of 'addr'? */ /* What is the scope of 'addr'? */
static sctp_scope_t sctp_v6_scope(union sctp_addr *addr) static enum sctp_scope sctp_v6_scope(union sctp_addr *addr)
{ {
enum sctp_scope retval;
int v6scope; int v6scope;
sctp_scope_t retval;
/* The IPv6 scope is really a set of bit fields. /* The IPv6 scope is really a set of bit fields.
* See IFA_* in <net/if_inet6.h>. Map to a generic SCTP scope. * See IFA_* in <net/if_inet6.h>. Map to a generic SCTP scope.
......
...@@ -196,7 +196,7 @@ static void sctp_free_local_addr_list(struct net *net) ...@@ -196,7 +196,7 @@ static void sctp_free_local_addr_list(struct net *net)
/* Copy the local addresses which are valid for 'scope' into 'bp'. */ /* Copy the local addresses which are valid for 'scope' into 'bp'. */
int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp, int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp,
sctp_scope_t scope, gfp_t gfp, int copy_flags) enum sctp_scope scope, gfp_t gfp, int copy_flags)
{ {
struct sctp_sockaddr_entry *addr; struct sctp_sockaddr_entry *addr;
union sctp_addr laddr; union sctp_addr laddr;
...@@ -400,9 +400,9 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) ...@@ -400,9 +400,9 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
* IPv4 scoping can be controlled through sysctl option * IPv4 scoping can be controlled through sysctl option
* net.sctp.addr_scope_policy * net.sctp.addr_scope_policy
*/ */
static sctp_scope_t sctp_v4_scope(union sctp_addr *addr) static enum sctp_scope sctp_v4_scope(union sctp_addr *addr)
{ {
sctp_scope_t retval; enum sctp_scope retval;
/* Check for unusable SCTP addresses. */ /* Check for unusable SCTP addresses. */
if (IS_IPV4_UNUSABLE_ADDRESS(addr->v4.sin_addr.s_addr)) { if (IS_IPV4_UNUSABLE_ADDRESS(addr->v4.sin_addr.s_addr)) {
......
...@@ -1578,8 +1578,8 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep, ...@@ -1578,8 +1578,8 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
gfp_t gfp) gfp_t gfp)
{ {
struct sctp_association *asoc; struct sctp_association *asoc;
enum sctp_scope scope;
struct sk_buff *skb; struct sk_buff *skb;
sctp_scope_t scope;
/* Create the bare association. */ /* Create the bare association. */
scope = sctp_scope(sctp_source(chunk)); scope = sctp_scope(sctp_source(chunk));
...@@ -1701,7 +1701,7 @@ struct sctp_association *sctp_unpack_cookie( ...@@ -1701,7 +1701,7 @@ struct sctp_association *sctp_unpack_cookie(
int headersize, bodysize, fixed_size; int headersize, bodysize, fixed_size;
__u8 *digest = ep->digest; __u8 *digest = ep->digest;
unsigned int len; unsigned int len;
sctp_scope_t scope; enum sctp_scope scope;
struct sk_buff *skb = chunk->skb; struct sk_buff *skb = chunk->skb;
ktime_t kt; ktime_t kt;
...@@ -2502,7 +2502,7 @@ static int sctp_process_param(struct sctp_association *asoc, ...@@ -2502,7 +2502,7 @@ static int sctp_process_param(struct sctp_association *asoc,
int i; int i;
__u16 sat; __u16 sat;
int retval = 1; int retval = 1;
sctp_scope_t scope; enum sctp_scope scope;
u32 stale; u32 stale;
struct sctp_af *af; struct sctp_af *af;
union sctp_addr_param *addr_param; union sctp_addr_param *addr_param;
......
...@@ -1055,7 +1055,7 @@ static int __sctp_connect(struct sock *sk, ...@@ -1055,7 +1055,7 @@ static int __sctp_connect(struct sock *sk,
struct sctp_association *asoc2; struct sctp_association *asoc2;
struct sctp_transport *transport; struct sctp_transport *transport;
union sctp_addr to; union sctp_addr to;
sctp_scope_t scope; enum sctp_scope scope;
long timeo; long timeo;
int err = 0; int err = 0;
int addrcnt = 0; int addrcnt = 0;
...@@ -1610,7 +1610,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) ...@@ -1610,7 +1610,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
struct sctp_initmsg *sinit; struct sctp_initmsg *sinit;
sctp_assoc_t associd = 0; sctp_assoc_t associd = 0;
sctp_cmsgs_t cmsgs = { NULL }; sctp_cmsgs_t cmsgs = { NULL };
sctp_scope_t scope; enum sctp_scope scope;
bool fill_sinfo_ttl = false, wait_connect = false; bool fill_sinfo_ttl = false, wait_connect = false;
struct sctp_datamsg *datamsg; struct sctp_datamsg *datamsg;
int msg_flags = msg->msg_flags; int msg_flags = msg->msg_flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment