diff options
author | Kristof Provost <kp@FreeBSD.org> | 2016-09-02 18:33:08 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2016-09-02 18:33:08 +0000 |
commit | ec21434933d775bd60d0fed62c978fb07fa9ccdf (patch) | |
tree | 81f746879128bfa6684612cd981fb717af0d28c2 /share | |
parent | 2279a9a428305ee43111f62f4addf6a9826eacde (diff) | |
download | src-ec21434933d775bd60d0fed62c978fb07fa9ccdf.tar.gz src-ec21434933d775bd60d0fed62c978fb07fa9ccdf.zip |
Renaming libifc to libifconfig in response to feedback on initial commit of
this library. Sticking to 'libifconfig' (and 'ifconfig_' as function prefix)
should reduce chances of namespace collisions, make it more clear what the
library does, and be more in line with existing libraries.
Submitted by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D7742
Reviewed by: cem, kp
Notes
Notes:
svn path=/head/; revision=305290
Diffstat (limited to 'share')
-rw-r--r-- | share/examples/libifc/Makefile | 9 | ||||
-rw-r--r-- | share/examples/libifconfig/Makefile | 8 | ||||
-rw-r--r-- | share/examples/libifconfig/ifcreate.c (renamed from share/examples/libifc/ifcreate.c) | 16 | ||||
-rw-r--r-- | share/examples/libifconfig/ifdestroy.c (renamed from share/examples/libifc/ifdestroy.c) | 14 | ||||
-rw-r--r-- | share/examples/libifconfig/setdescription.c (renamed from share/examples/libifc/setdescription.c) | 20 | ||||
-rw-r--r-- | share/examples/libifconfig/setmtu.c (renamed from share/examples/libifc/setmtu.c) | 18 | ||||
-rw-r--r-- | share/mk/bsd.libnames.mk | 2 | ||||
-rw-r--r-- | share/mk/src.libnames.mk | 2 |
8 files changed, 44 insertions, 45 deletions
diff --git a/share/examples/libifc/Makefile b/share/examples/libifc/Makefile deleted file mode 100644 index 876c3caeac8e..000000000000 --- a/share/examples/libifc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -default: - $(CC) -Wall -fPIC -lifc -g -o example_setdescription setdescription.c - $(CC) -Wall -fPIC -lifc -g -o example_setmtu setmtu.c - $(CC) -Wall -fPIC -lifc -g -o example_ifdestroy ifdestroy.c - $(CC) -Wall -fPIC -lifc -g -o example_ifcreate ifcreate.c -clean: - rm -f example_* diff --git a/share/examples/libifconfig/Makefile b/share/examples/libifconfig/Makefile new file mode 100644 index 000000000000..6926f65b1afa --- /dev/null +++ b/share/examples/libifconfig/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ +default: + $(CC) -Wall -fPIC -lifconfig -g -o example_setdescription setdescription.c + $(CC) -Wall -fPIC -lifconfig -g -o example_setmtu setmtu.c + $(CC) -Wall -fPIC -lifconfig -g -o example_ifdestroy ifdestroy.c + $(CC) -Wall -fPIC -lifconfig -g -o example_ifcreate ifcreate.c +clean: + rm -f example_* diff --git a/share/examples/libifc/ifcreate.c b/share/examples/libifconfig/ifcreate.c index 0c461c8f5720..8f5dde506d2e 100644 --- a/share/examples/libifc/ifcreate.c +++ b/share/examples/libifconfig/ifcreate.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -55,21 +55,21 @@ int main(int argc, char *argv[]) printf("Requested interface name: %s\n", ifname); - libifc_handle_t *lifh = libifc_open(); - if (libifc_create_interface(lifh, ifname, &ifactualname) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_create_interface(lifh, ifname, &ifactualname) == 0) { printf("Successfully created interface '%s'\n", ifactualname); - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); free(ifactualname); return (0); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: warnx("couldn't create socket. This shouldn't happen.\n"); break; case IOCTL: - if (libifc_err_ioctlreq(lifh) == SIOCIFCREATE2) { + if (ifconfig_err_ioctlreq(lifh) == SIOCIFCREATE2) { warnx( "Failed to create interface (SIOCIFCREATE2)\n"); } @@ -79,12 +79,12 @@ int main(int argc, char *argv[]) "This is a thorough example accommodating for temporary" " 'not implemented yet' errors. That's likely what happened" " now. If not, your guess is as good as mine. ;)" - " Error code: %d\n", libifc_err_errno( + " Error code: %d\n", ifconfig_err_errno( lifh)); break; } - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); free(ifactualname); diff --git a/share/examples/libifc/ifdestroy.c b/share/examples/libifconfig/ifdestroy.c index bcfa11113f5e..029e70a8d9b0 100644 --- a/share/examples/libifc/ifdestroy.c +++ b/share/examples/libifconfig/ifdestroy.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -55,20 +55,20 @@ int main(int argc, char *argv[]) printf("Interface name: %s\n", ifname); - libifc_handle_t *lifh = libifc_open(); - if (libifc_destroy_interface(lifh, ifname) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_destroy_interface(lifh, ifname) == 0) { printf("Successfully destroyed interface '%s'.", ifname); - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (0); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: warnx("couldn't create socket. This shouldn't happen.\n"); break; case IOCTL: - if (libifc_err_ioctlreq(lifh) == SIOCIFDESTROY) { + if (ifconfig_err_ioctlreq(lifh) == SIOCIFDESTROY) { warnx( "Failed to destroy interface (SIOCIFDESTROY)\n"); } @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) break; } - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (-1); diff --git a/share/examples/libifc/setdescription.c b/share/examples/libifconfig/setdescription.c index d66a883a0e61..656aba75976f 100644 --- a/share/examples/libifc/setdescription.c +++ b/share/examples/libifconfig/setdescription.c @@ -35,7 +35,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -54,27 +54,27 @@ int main(int argc, char *argv[]) printf("Interface name: %s\n", ifname); - libifc_handle_t *lifh = libifc_open(); - if (libifc_get_description(lifh, ifname, &curdescr) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_get_description(lifh, ifname, &curdescr) == 0) { printf("Old description: %s\n", curdescr); } printf("New description: %s\n\n", ifdescr); - if (libifc_set_description(lifh, ifname, ifdescr) == 0) { + if (ifconfig_set_description(lifh, ifname, ifdescr) == 0) { printf("New description successfully set.\n"); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: - err(libifc_err_errno(lifh), "Socket error"); + err(ifconfig_err_errno(lifh), "Socket error"); break; case IOCTL: - err(libifc_err_errno( + err(ifconfig_err_errno( lifh), "IOCTL(%lu) error", - libifc_err_ioctlreq(lifh)); + ifconfig_err_ioctlreq(lifh)); break; case OTHER: - err(libifc_err_errno(lifh), "Other error"); + err(ifconfig_err_errno(lifh), "Other error"); break; } } @@ -86,6 +86,6 @@ int main(int argc, char *argv[]) ifdescr = NULL; curdescr = NULL; - libifc_close(lifh); + ifconfig_close(lifh); return (0); } diff --git a/share/examples/libifc/setmtu.c b/share/examples/libifconfig/setmtu.c index be63e18dafa7..4d5a0f8d5f92 100644 --- a/share/examples/libifc/setmtu.c +++ b/share/examples/libifconfig/setmtu.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libifc.h> +#include <libifconfig.h> int main(int argc, char *argv[]) @@ -58,26 +58,26 @@ int main(int argc, char *argv[]) printf("Interface name: %s\n", ifname); printf("New MTU: %d", mtu); - libifc_handle_t *lifh = libifc_open(); - if (libifc_set_mtu(lifh, ifname, mtu) == 0) { + ifconfig_handle_t *lifh = ifconfig_open(); + if (ifconfig_set_mtu(lifh, ifname, mtu) == 0) { printf("Successfully changed MTU of %s to %d\n", ifname, mtu); - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (0); } else { - switch (libifc_err_errtype(lifh)) { + switch (ifconfig_err_errtype(lifh)) { case SOCKET: warnx("couldn't create socket. This shouldn't happen.\n"); break; case IOCTL: - if (libifc_err_ioctlreq(lifh) == SIOCSIFMTU) { + if (ifconfig_err_ioctlreq(lifh) == SIOCSIFMTU) { warnx("Failed to set MTU (SIOCSIFMTU)\n"); } else { warnx( "Failed to set MTU due to error in unexpected ioctl() call %lu. Error code: %i.\n", - libifc_err_ioctlreq(lifh), - libifc_err_errno(lifh)); + ifconfig_err_ioctlreq(lifh), + ifconfig_err_errno(lifh)); } break; default: @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) break; } - libifc_close(lifh); + ifconfig_close(lifh); lifh = NULL; free(ifname); return (-1); diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index ff051f243f76..a3e6f2e0f622 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -82,7 +82,7 @@ LIBIBMAD?= ${DESTDIR}${LIBDIR}/libibmad.a LIBIBSDP?= ${DESTDIR}${LIBDIR}/libibsdp.a LIBIBUMAD?= ${DESTDIR}${LIBDIR}/libibumad.a LIBIBVERBS?= ${DESTDIR}${LIBDIR}/libibverbs.a -LIBIFC?= ${DESTDIR}${LIBDIR}/libifc.a +LIBIFCONFIG?= ${DESTDIR}${LIBDIR}/libifconfig.a LIBIPSEC?= ${DESTDIR}${LIBDIR}/libipsec.a LIBJAIL?= ${DESTDIR}${LIBDIR}/libjail.a LIBKADM5CLNT?= ${DESTDIR}${LIBDIR}/libkadm5clnt.a diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 94b5d6190cd2..f65ce01c0081 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -105,7 +105,7 @@ _LIBRARIES= \ heimntlm \ heimsqlite \ hx509 \ - ifc \ + ifconfig \ ipsec \ jail \ kadm5clnt \ |