sock: make impl_name const char * in all functions
There's no reason for this parameter to be non-const and it makes this functions pain to use when you want to hardcode a specific sock implementation. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Ifed4426a02ab54cbd51c8a2051b1eac010f86db9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14303 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
b3e1db32a3
commit
ab58ddf107
@ -241,7 +241,7 @@ int spdk_sock_getaddr(struct spdk_sock *sock, char *saddr, int slen, uint16_t *s
|
||||
*
|
||||
* \return a pointer to the connected socket on success, or NULL on failure.
|
||||
*/
|
||||
struct spdk_sock *spdk_sock_connect(const char *ip, int port, char *impl_name);
|
||||
struct spdk_sock *spdk_sock_connect(const char *ip, int port, const char *impl_name);
|
||||
|
||||
/**
|
||||
* Create a socket using the specific sock implementation, connect the socket
|
||||
@ -258,7 +258,7 @@ struct spdk_sock *spdk_sock_connect(const char *ip, int port, char *impl_name);
|
||||
*
|
||||
* \return a pointer to the connected socket on success, or NULL on failure.
|
||||
*/
|
||||
struct spdk_sock *spdk_sock_connect_ext(const char *ip, int port, char *impl_name,
|
||||
struct spdk_sock *spdk_sock_connect_ext(const char *ip, int port, const char *impl_name,
|
||||
struct spdk_sock_opts *opts);
|
||||
|
||||
/**
|
||||
@ -275,7 +275,7 @@ struct spdk_sock *spdk_sock_connect_ext(const char *ip, int port, char *impl_nam
|
||||
*
|
||||
* \return a pointer to the listened socket on success, or NULL on failure.
|
||||
*/
|
||||
struct spdk_sock *spdk_sock_listen(const char *ip, int port, char *impl_name);
|
||||
struct spdk_sock *spdk_sock_listen(const char *ip, int port, const char *impl_name);
|
||||
|
||||
/**
|
||||
* Create a socket using the specific sock implementation, bind the socket to
|
||||
@ -292,7 +292,7 @@ struct spdk_sock *spdk_sock_listen(const char *ip, int port, char *impl_name);
|
||||
*
|
||||
* \return a pointer to the listened socket on success, or NULL on failure.
|
||||
*/
|
||||
struct spdk_sock *spdk_sock_listen_ext(const char *ip, int port, char *impl_name,
|
||||
struct spdk_sock *spdk_sock_listen_ext(const char *ip, int port, const char *impl_name,
|
||||
struct spdk_sock_opts *opts);
|
||||
|
||||
/**
|
||||
|
@ -292,7 +292,7 @@ sock_init_opts(struct spdk_sock_opts *opts, struct spdk_sock_opts *opts_user)
|
||||
}
|
||||
|
||||
struct spdk_sock *
|
||||
spdk_sock_connect(const char *ip, int port, char *impl_name)
|
||||
spdk_sock_connect(const char *ip, int port, const char *impl_name)
|
||||
{
|
||||
struct spdk_sock_opts opts;
|
||||
|
||||
@ -302,7 +302,7 @@ spdk_sock_connect(const char *ip, int port, char *impl_name)
|
||||
}
|
||||
|
||||
struct spdk_sock *
|
||||
spdk_sock_connect_ext(const char *ip, int port, char *_impl_name, struct spdk_sock_opts *opts)
|
||||
spdk_sock_connect_ext(const char *ip, int port, const char *_impl_name, struct spdk_sock_opts *opts)
|
||||
{
|
||||
struct spdk_net_impl *impl = NULL;
|
||||
struct spdk_sock *sock;
|
||||
@ -346,7 +346,7 @@ spdk_sock_connect_ext(const char *ip, int port, char *_impl_name, struct spdk_so
|
||||
}
|
||||
|
||||
struct spdk_sock *
|
||||
spdk_sock_listen(const char *ip, int port, char *impl_name)
|
||||
spdk_sock_listen(const char *ip, int port, const char *impl_name)
|
||||
{
|
||||
struct spdk_sock_opts opts;
|
||||
|
||||
@ -356,7 +356,7 @@ spdk_sock_listen(const char *ip, int port, char *impl_name)
|
||||
}
|
||||
|
||||
struct spdk_sock *
|
||||
spdk_sock_listen_ext(const char *ip, int port, char *_impl_name, struct spdk_sock_opts *opts)
|
||||
spdk_sock_listen_ext(const char *ip, int port, const char *_impl_name, struct spdk_sock_opts *opts)
|
||||
{
|
||||
struct spdk_net_impl *impl = NULL;
|
||||
struct spdk_sock *sock;
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
DEFINE_STUB(spdk_sock_getaddr, int, (struct spdk_sock *sock, char *saddr, int slen, uint16_t *sport,
|
||||
char *caddr, int clen, uint16_t *cport), 0);
|
||||
DEFINE_STUB(spdk_sock_connect, struct spdk_sock *, (const char *ip, int port, char *impl_name),
|
||||
DEFINE_STUB(spdk_sock_connect, struct spdk_sock *, (const char *ip, int port,
|
||||
const char *impl_name), NULL);
|
||||
DEFINE_STUB(spdk_sock_listen, struct spdk_sock *, (const char *ip, int port, const char *impl_name),
|
||||
NULL);
|
||||
DEFINE_STUB(spdk_sock_listen, struct spdk_sock *, (const char *ip, int port, char *impl_name),
|
||||
NULL);
|
||||
DEFINE_STUB(spdk_sock_listen_ext, struct spdk_sock *, (const char *ip, int port, char *impl_name,
|
||||
struct spdk_sock_opts *opts), NULL);
|
||||
DEFINE_STUB(spdk_sock_listen_ext, struct spdk_sock *, (const char *ip, int port,
|
||||
const char *impl_name, struct spdk_sock_opts *opts), NULL);
|
||||
DEFINE_STUB_V(spdk_sock_get_default_opts, (struct spdk_sock_opts *opts));
|
||||
DEFINE_STUB(spdk_sock_accept, struct spdk_sock *, (struct spdk_sock *sock), NULL);
|
||||
DEFINE_STUB(spdk_sock_close, int, (struct spdk_sock **sock), 0);
|
||||
|
@ -1046,7 +1046,7 @@ test_nvme_tcp_pdu_ch_handle(void)
|
||||
DEFINE_RETURN_MOCK(spdk_sock_connect_ext, struct spdk_sock *);
|
||||
struct spdk_sock *
|
||||
spdk_sock_connect_ext(const char *ip, int port,
|
||||
char *_impl_name, struct spdk_sock_opts *opts)
|
||||
const char *_impl_name, struct spdk_sock_opts *opts)
|
||||
{
|
||||
HANDLE_RETURN_MOCK(spdk_sock_connect_ext);
|
||||
CU_ASSERT(port == 23);
|
||||
|
Loading…
Reference in New Issue
Block a user