Skip to content

Commit 17f9c0c

Browse files
D. WytheNipaLocal
authored andcommitted
net/smc: expose smc proto operations
Externalize smc proto operations (smc_xxx) to allow access from files other that af_smc.c This is in preparation for the subsequent implementation of the AF_INET version of SMC. Signed-off-by: D. Wythe <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent da3f1d7 commit 17f9c0c

File tree

2 files changed

+63
-30
lines changed

2 files changed

+63
-30
lines changed

net/smc/af_smc.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ static bool smc_hs_congested(const struct sock *sk)
170170
return false;
171171
}
172172

173-
static struct smc_hashinfo smc_v4_hashinfo = {
173+
struct smc_hashinfo smc_v4_hashinfo = {
174174
.lock = __RW_LOCK_UNLOCKED(smc_v4_hashinfo.lock),
175175
};
176176

177-
static struct smc_hashinfo smc_v6_hashinfo = {
177+
struct smc_hashinfo smc_v6_hashinfo = {
178178
.lock = __RW_LOCK_UNLOCKED(smc_v6_hashinfo.lock),
179179
};
180180

181-
static int smc_hash_sk(struct sock *sk)
181+
int smc_hash_sk(struct sock *sk)
182182
{
183183
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
184184
struct hlist_head *head;
@@ -193,7 +193,7 @@ static int smc_hash_sk(struct sock *sk)
193193
return 0;
194194
}
195195

196-
static void smc_unhash_sk(struct sock *sk)
196+
void smc_unhash_sk(struct sock *sk)
197197
{
198198
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
199199

@@ -207,7 +207,7 @@ static void smc_unhash_sk(struct sock *sk)
207207
* work which we didn't do because of user hold the sock_lock in the
208208
* BH context
209209
*/
210-
static void smc_release_cb(struct sock *sk)
210+
void smc_release_cb(struct sock *sk)
211211
{
212212
struct smc_sock *smc = smc_sk(sk);
213213

@@ -307,7 +307,7 @@ static int __smc_release(struct smc_sock *smc)
307307
return rc;
308308
}
309309

310-
static int smc_release(struct socket *sock)
310+
int smc_release(struct socket *sock)
311311
{
312312
struct sock *sk = sock->sk;
313313
struct smc_sock *smc;
@@ -401,8 +401,8 @@ static struct sock *smc_sock_alloc(struct net *net, struct socket *sock,
401401
return sk;
402402
}
403403

404-
static int smc_bind(struct socket *sock, struct sockaddr *uaddr,
405-
int addr_len)
404+
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
405+
int addr_len)
406406
{
407407
struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
408408
struct sock *sk = sock->sk;
@@ -1649,8 +1649,8 @@ static void smc_connect_work(struct work_struct *work)
16491649
release_sock(&smc->sk);
16501650
}
16511651

1652-
static int smc_connect(struct socket *sock, struct sockaddr *addr,
1653-
int alen, int flags)
1652+
int smc_connect(struct socket *sock, struct sockaddr *addr,
1653+
int alen, int flags)
16541654
{
16551655
struct sock *sk = sock->sk;
16561656
struct smc_sock *smc;
@@ -2631,7 +2631,7 @@ static void smc_clcsock_data_ready(struct sock *listen_clcsock)
26312631
read_unlock_bh(&listen_clcsock->sk_callback_lock);
26322632
}
26332633

2634-
static int smc_listen(struct socket *sock, int backlog)
2634+
int smc_listen(struct socket *sock, int backlog)
26352635
{
26362636
struct sock *sk = sock->sk;
26372637
struct smc_sock *smc;
@@ -2696,8 +2696,8 @@ static int smc_listen(struct socket *sock, int backlog)
26962696
return rc;
26972697
}
26982698

2699-
static int smc_accept(struct socket *sock, struct socket *new_sock,
2700-
int flags, bool kern)
2699+
int smc_accept(struct socket *sock, struct socket *new_sock,
2700+
int flags, bool kern)
27012701
{
27022702
struct sock *sk = sock->sk, *nsk;
27032703
DECLARE_WAITQUEUE(wait, current);
@@ -2766,8 +2766,8 @@ static int smc_accept(struct socket *sock, struct socket *new_sock,
27662766
return rc;
27672767
}
27682768

2769-
static int smc_getname(struct socket *sock, struct sockaddr *addr,
2770-
int peer)
2769+
int smc_getname(struct socket *sock, struct sockaddr *addr,
2770+
int peer)
27712771
{
27722772
struct smc_sock *smc;
27732773

@@ -2780,7 +2780,7 @@ static int smc_getname(struct socket *sock, struct sockaddr *addr,
27802780
return smc->clcsock->ops->getname(smc->clcsock, addr, peer);
27812781
}
27822782

2783-
static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
2783+
int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
27842784
{
27852785
struct sock *sk = sock->sk;
27862786
struct smc_sock *smc;
@@ -2818,8 +2818,8 @@ static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
28182818
return rc;
28192819
}
28202820

2821-
static int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
2822-
int flags)
2821+
int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
2822+
int flags)
28232823
{
28242824
struct sock *sk = sock->sk;
28252825
struct smc_sock *smc;
@@ -2868,8 +2868,8 @@ static __poll_t smc_accept_poll(struct sock *parent)
28682868
return mask;
28692869
}
28702870

2871-
static __poll_t smc_poll(struct file *file, struct socket *sock,
2872-
poll_table *wait)
2871+
__poll_t smc_poll(struct file *file, struct socket *sock,
2872+
poll_table *wait)
28732873
{
28742874
struct sock *sk = sock->sk;
28752875
struct smc_sock *smc;
@@ -2921,7 +2921,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
29212921
return mask;
29222922
}
29232923

2924-
static int smc_shutdown(struct socket *sock, int how)
2924+
int smc_shutdown(struct socket *sock, int how)
29252925
{
29262926
struct sock *sk = sock->sk;
29272927
bool do_shutdown = true;
@@ -3061,8 +3061,8 @@ static int __smc_setsockopt(struct socket *sock, int level, int optname,
30613061
return rc;
30623062
}
30633063

3064-
static int smc_setsockopt(struct socket *sock, int level, int optname,
3065-
sockptr_t optval, unsigned int optlen)
3064+
int smc_setsockopt(struct socket *sock, int level, int optname,
3065+
sockptr_t optval, unsigned int optlen)
30663066
{
30673067
struct sock *sk = sock->sk;
30683068
struct smc_sock *smc;
@@ -3148,8 +3148,8 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
31483148
return rc;
31493149
}
31503150

3151-
static int smc_getsockopt(struct socket *sock, int level, int optname,
3152-
char __user *optval, int __user *optlen)
3151+
int smc_getsockopt(struct socket *sock, int level, int optname,
3152+
char __user *optval, int __user *optlen)
31533153
{
31543154
struct smc_sock *smc;
31553155
int rc;
@@ -3174,8 +3174,8 @@ static int smc_getsockopt(struct socket *sock, int level, int optname,
31743174
return rc;
31753175
}
31763176

3177-
static int smc_ioctl(struct socket *sock, unsigned int cmd,
3178-
unsigned long arg)
3177+
int smc_ioctl(struct socket *sock, unsigned int cmd,
3178+
unsigned long arg)
31793179
{
31803180
union smc_host_cursor cons, urg;
31813181
struct smc_connection *conn;
@@ -3261,9 +3261,9 @@ static int smc_ioctl(struct socket *sock, unsigned int cmd,
32613261
* Note that subsequent recv() calls have to wait till all splice() processing
32623262
* completed.
32633263
*/
3264-
static ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
3265-
struct pipe_inode_info *pipe, size_t len,
3266-
unsigned int flags)
3264+
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
3265+
struct pipe_inode_info *pipe, size_t len,
3266+
unsigned int flags)
32673267
{
32683268
struct sock *sk = sock->sk;
32693269
struct smc_sock *smc;

net/smc/smc.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,39 @@
3434
extern struct proto smc_proto;
3535
extern struct proto smc_proto6;
3636

37+
extern struct smc_hashinfo smc_v4_hashinfo;
38+
extern struct smc_hashinfo smc_v6_hashinfo;
39+
40+
int smc_hash_sk(struct sock *sk);
41+
void smc_unhash_sk(struct sock *sk);
42+
void smc_release_cb(struct sock *sk);
43+
44+
int smc_release(struct socket *sock);
45+
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
46+
int addr_len);
47+
int smc_connect(struct socket *sock, struct sockaddr *addr,
48+
int alen, int flags);
49+
int smc_accept(struct socket *sock, struct socket *new_sock,
50+
int flags, bool kern);
51+
int smc_getname(struct socket *sock, struct sockaddr *addr,
52+
int peer);
53+
__poll_t smc_poll(struct file *file, struct socket *sock,
54+
poll_table *wait);
55+
int smc_ioctl(struct socket *sock, unsigned int cmd,
56+
unsigned long arg);
57+
int smc_listen(struct socket *sock, int backlog);
58+
int smc_shutdown(struct socket *sock, int how);
59+
int smc_setsockopt(struct socket *sock, int level, int optname,
60+
sockptr_t optval, unsigned int optlen);
61+
int smc_getsockopt(struct socket *sock, int level, int optname,
62+
char __user *optval, int __user *optlen);
63+
int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len);
64+
int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
65+
int flags);
66+
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
67+
struct pipe_inode_info *pipe, size_t len,
68+
unsigned int flags);
69+
3770
/* smc sock initialization */
3871
void smc_sock_init(struct net *net, struct sock *sk, int protocol);
3972
/* clcsock initialization */

0 commit comments

Comments
 (0)