rtnl: Constify the public interface.
Three of the rtnl methods never modify the strings passed in. This patch adds the const keyword to ensure these functions stay that way. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>master
parent
831f7e073b
commit
e4d1988f54
6
rtnl.c
6
rtnl.c
|
@ -87,7 +87,7 @@ static void rtnl_get_ts_device_callback(void *ctx, int linkup, int ts_index)
|
|||
*dst = ts_index;
|
||||
}
|
||||
|
||||
int rtnl_get_ts_device(char *device, char *ts_device)
|
||||
int rtnl_get_ts_device(const char *device, char *ts_device)
|
||||
{
|
||||
int err, fd;
|
||||
int ts_index = -1;
|
||||
|
@ -112,7 +112,7 @@ no_info:
|
|||
return err;
|
||||
}
|
||||
|
||||
int rtnl_link_query(int fd, char *device)
|
||||
int rtnl_link_query(int fd, const char *device)
|
||||
{
|
||||
struct sockaddr_nl sa;
|
||||
struct msghdr msg;
|
||||
|
@ -227,7 +227,7 @@ static int rtnl_linkinfo_parse(int master_index, struct rtattr *rta)
|
|||
return index;
|
||||
}
|
||||
|
||||
int rtnl_link_status(int fd, char *device, rtnl_callback cb, void *ctx)
|
||||
int rtnl_link_status(int fd, const char *device, rtnl_callback cb, void *ctx)
|
||||
{
|
||||
struct rtattr *tb[IFLA_MAX+1];
|
||||
struct ifinfomsg *info = NULL;
|
||||
|
|
6
rtnl.h
6
rtnl.h
|
@ -37,7 +37,7 @@ int rtnl_close(int fd);
|
|||
* at least IF_NAMESIZE bytes long.
|
||||
* @return Zero on success, or -1 on error.
|
||||
*/
|
||||
int rtnl_get_ts_device(char *device, char *ts_device);
|
||||
int rtnl_get_ts_device(const char *device, char *ts_device);
|
||||
|
||||
/**
|
||||
* Request the link status from the kernel.
|
||||
|
@ -45,7 +45,7 @@ int rtnl_get_ts_device(char *device, char *ts_device);
|
|||
* @param device Interface name. Request all iface's status if set NULL.
|
||||
* @return Zero on success, non-zero otherwise.
|
||||
*/
|
||||
int rtnl_link_query(int fd, char *device);
|
||||
int rtnl_link_query(int fd, const char *device);
|
||||
|
||||
/**
|
||||
* Read kernel messages looking for a link up/down events.
|
||||
|
@ -55,7 +55,7 @@ int rtnl_link_query(int fd, char *device);
|
|||
* @param ctx Private context passed to the callback.
|
||||
* @return Zero on success, non-zero otherwise.
|
||||
*/
|
||||
int rtnl_link_status(int fd, char *device, rtnl_callback cb, void *ctx);
|
||||
int rtnl_link_status(int fd, const char *device, rtnl_callback cb, void *ctx);
|
||||
|
||||
/**
|
||||
* Open a RT netlink socket for monitoring link state.
|
||||
|
|
Loading…
Reference in New Issue