On 2/11/2020 6:03 AM, Richard Cochran wrote: > 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 <richardcoch...@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.kel...@intel.com> > --- > rtnl.c | 6 +++--- > rtnl.h | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/rtnl.c b/rtnl.c > index 59ed0ec..d9c76d7 100644 > --- a/rtnl.c > +++ b/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; > diff --git a/rtnl.h b/rtnl.h > index f877cd2..c5ea979 100644 > --- a/rtnl.h > +++ b/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. > _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel