rename library and API prefix

library is now called libsocketcan, API carry the prefix can_

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
pull/106/head^2
Luotao Fu 2009-11-27 11:53:41 +01:00
parent 1751269c33
commit 257877f315
11 changed files with 51 additions and 61 deletions

6
.gitignore vendored
View File

@ -4,14 +4,14 @@ GNUmakefile
GNUmakefile.in GNUmakefile.in
aclocal.m4 aclocal.m4
config/libsocketcan-nl.pc config/libsocketcan.pc
config/m4/libtool.m4 config/m4/libtool.m4
config/m4/ltoptions.m4 config/m4/ltoptions.m4
config/m4/ltsugar.m4 config/m4/ltsugar.m4
config/m4/ltversion.m4 config/m4/ltversion.m4
config/m4/lt~obsolete.m4 config/m4/lt~obsolete.m4
include/libsocketcan-nl_config.h include/libsocketcan_config.h
include/libsocketcan-nl_config.h.in include/libsocketcan_config.h.in
include/stamp-h1 include/stamp-h1
config.log config.log

View File

@ -1,8 +1,8 @@
EXTRA_DIST = \ EXTRA_DIST = \
libsocketcan-nl.pc.in libsocketcan.pc.in
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libsocketcan-nl.pc pkgconfig_DATA = libsocketcan.pc
MAINTAINERCLEANFILES = \ MAINTAINERCLEANFILES = \
GNUmakefile.in GNUmakefile.in

View File

@ -3,10 +3,10 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
Name: libsocketcan-nl Name: libsocketcan
Description: provides access to socketcan netlink interface Description: provides access to socketcan configuration interface
Requires: Requires:
Version: @VERSION@ Version: @VERSION@
Libs: -L${libdir} -lsocketcan-nl Libs: -L${libdir} -lsocketcan
#Libs.private: -lm -lpthread ...etc... #Libs.private: -lm -lpthread ...etc...
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -2,9 +2,9 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT([libsocketcan-nl], [trunk], [bugs@pengutronix.de]) AC_INIT([libsocketcan], [trunk], [bugs@pengutronix.de])
AC_CONFIG_HEADERS([include/libsocketcan-nl_config.h]) AC_CONFIG_HEADERS([include/libsocketcan_config.h])
AC_CONFIG_SRCDIR([src/socketcan_netlink.c]) AC_CONFIG_SRCDIR([src/libsocketcan.c])
AC_CONFIG_MACRO_DIR([config/m4]) AC_CONFIG_MACRO_DIR([config/m4])
AC_CONFIG_AUX_DIR([config/autoconf]) AC_CONFIG_AUX_DIR([config/autoconf])
AC_CANONICAL_BUILD AC_CANONICAL_BUILD
@ -110,7 +110,7 @@ fi
AC_CONFIG_FILES([ AC_CONFIG_FILES([
GNUmakefile GNUmakefile
config/libsocketcan-nl.pc config/libsocketcan.pc
config/GNUmakefile config/GNUmakefile
include/GNUmakefile include/GNUmakefile
src/GNUmakefile src/GNUmakefile

View File

@ -1,9 +1,9 @@
noinst_HEADERS = \ # noinst_HEADERS = \
libsocketcan-nlstuff.h # libsocketcan-stuff.h
nobase_include_HEADERS = \ nobase_include_HEADERS = \
socketcan_netlink.h libsocketcan.h
MAINTAINERCLEANFILES = \ MAINTAINERCLEANFILES = \
libsocketcan-nl_config.h.in \ libsocketcan_config.h.in \
GNUmakefile.in GNUmakefile.in

View File

@ -1,5 +0,0 @@
#ifndef LIBSOCKETCAN-NL_H
#define LIBSOCKETCAN-NL_H
#endif

View File

@ -1,5 +0,0 @@
#ifndef LIBSOCKETCAN-NL_H
#define LIBSOCKETCAN-NL_H
#endif

View File

@ -1,5 +1,5 @@
/* /*
* socketcan_netlink.h * libsocketcan.h
* *
* (C) 2009 Luotao Fu <l.fu@pengutronix.de> * (C) 2009 Luotao Fu <l.fu@pengutronix.de>
* *
@ -23,19 +23,19 @@
#include <linux/can/netlink.h> #include <linux/can/netlink.h>
int scan_do_restart(const char *name); int can_do_restart(const char *name);
int scan_do_stop(const char *name); int can_do_stop(const char *name);
int scan_do_start(const char *name); int can_do_start(const char *name);
int scan_set_restart_ms(const char *name, __u32 restart_ms); int can_set_restart_ms(const char *name, __u32 restart_ms);
int scan_set_bittiming(const char *name, struct can_bittiming *bt); int can_set_bittiming(const char *name, struct can_bittiming *bt);
int scan_set_ctrlmode(const char *name, struct can_ctrlmode *cm); int can_set_ctrlmode(const char *name, struct can_ctrlmode *cm);
int scan_set_bitrate(const char *name, __u32 bitrate, __u32 sample_point); int can_set_bitrate(const char *name, __u32 bitrate, __u32 sample_point);
int scan_get_restart_ms(const char *name, __u32 *restart_ms); int can_get_restart_ms(const char *name, __u32 *restart_ms);
int scan_get_bittiming(const char *name, struct can_bittiming *bt); int can_get_bittiming(const char *name, struct can_bittiming *bt);
int scan_get_ctrlmode(const char *name, struct can_ctrlmode *cm); int can_get_ctrlmode(const char *name, struct can_ctrlmode *cm);
int scan_get_state(const char *name, int *state); int can_get_state(const char *name, int *state);
int scan_get_clock(const char *name, struct can_clock *clock); int can_get_clock(const char *name, struct can_clock *clock);
#endif #endif

View File

@ -1,16 +1,16 @@
lib_LTLIBRARIES = libsocketcan-nl.la lib_LTLIBRARIES = libsocketcan.la
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \
-I$(top_builddir)/include -I$(top_builddir)/include
libsocketcan_nl_la_SOURCES = socketcan_netlink.c libsocketcan_la_SOURCES = libsocketcan.c
libsocketcan_nl_la_LDFLAGS = \ libsocketcan_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
# -no-undefined # win32_dll stuff only # -no-undefined # win32_dll stuff only
#libsocketcan-nl_LDADD = \ #libsocketcan_LDADD = \
# $(librn_LIBS) # $(librn_LIBS)
# #
MAINTAINERCLEANFILES = \ MAINTAINERCLEANFILES = \

View File

@ -1,5 +1,5 @@
/* /*
* socketcan_netlink.c * libsocketcan.c
* *
* (C) 2009 Luotao Fu <l.fu@pengutronix.de> * (C) 2009 Luotao Fu <l.fu@pengutronix.de>
* *
@ -29,7 +29,7 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <socketcan_netlink.h> #include <libsocketcan.h>
#define parse_rtattr_nested(tb, max, rta) \ #define parse_rtattr_nested(tb, max, rta) \
(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta))) (parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))
@ -508,18 +508,18 @@ err_out:
return err; return err;
} }
int scan_do_start(const char *name) int can_do_start(const char *name)
{ {
return set_link(name, IF_UP, NULL); return set_link(name, IF_UP, NULL);
} }
int scan_do_stop(const char *name) int can_do_stop(const char *name)
{ {
return set_link(name, IF_DOWN, NULL); return set_link(name, IF_DOWN, NULL);
} }
int scan_do_restart(const char *name) int can_do_restart(const char *name)
{ {
int fd; int fd;
int err = -1; int err = -1;
@ -527,7 +527,7 @@ int scan_do_restart(const char *name)
__u32 restart_ms; __u32 restart_ms;
/* first we check if we can restart the device at all */ /* first we check if we can restart the device at all */
if ((scan_get_state(name, &state)) < 0) { if ((can_get_state(name, &state)) < 0) {
fprintf(stderr, "cannot get bustate, " fprintf(stderr, "cannot get bustate, "
"something is seriously wrong\n"); "something is seriously wrong\n");
goto err_out; goto err_out;
@ -538,7 +538,7 @@ int scan_do_restart(const char *name)
goto err_out; goto err_out;
} }
if ((scan_get_restart_ms(name, &restart_ms)) < 0) { if ((can_get_restart_ms(name, &restart_ms)) < 0) {
fprintf(stderr, "cannot get restart_ms, " fprintf(stderr, "cannot get restart_ms, "
"something is seriously wrong\n"); "something is seriously wrong\n");
goto err_out; goto err_out;
@ -567,7 +567,7 @@ err_out:
return err; return err;
} }
int scan_set_restart_ms(const char *name, __u32 restart_ms) int can_set_restart_ms(const char *name, __u32 restart_ms)
{ {
struct req_info req_info = { struct req_info req_info = {
.restart_ms = restart_ms, .restart_ms = restart_ms,
@ -579,7 +579,7 @@ int scan_set_restart_ms(const char *name, __u32 restart_ms)
return set_link(name, 0, &req_info); return set_link(name, 0, &req_info);
} }
int scan_set_ctrlmode(const char *name, struct can_ctrlmode *cm) int can_set_ctrlmode(const char *name, struct can_ctrlmode *cm)
{ {
struct req_info req_info = { struct req_info req_info = {
.ctrlmode = cm, .ctrlmode = cm,
@ -588,7 +588,7 @@ int scan_set_ctrlmode(const char *name, struct can_ctrlmode *cm)
return set_link(name, 0, &req_info); return set_link(name, 0, &req_info);
} }
int scan_set_bittiming(const char *name, struct can_bittiming *bt) int can_set_bittiming(const char *name, struct can_bittiming *bt)
{ {
struct req_info req_info = { struct req_info req_info = {
.bittiming = bt, .bittiming = bt,
@ -597,7 +597,7 @@ int scan_set_bittiming(const char *name, struct can_bittiming *bt)
return set_link(name, 0, &req_info); return set_link(name, 0, &req_info);
} }
int scan_set_bitrate(const char *name, __u32 bitrate, __u32 sample_point) int can_set_bitrate(const char *name, __u32 bitrate, __u32 sample_point)
{ {
struct can_bittiming bt; struct can_bittiming bt;
@ -605,30 +605,30 @@ int scan_set_bitrate(const char *name, __u32 bitrate, __u32 sample_point)
bt.bitrate = bitrate; bt.bitrate = bitrate;
bt.sample_point = sample_point; bt.sample_point = sample_point;
return scan_set_bittiming(name, &bt); return can_set_bittiming(name, &bt);
} }
int scan_get_state(const char *name, int *state) int can_get_state(const char *name, int *state)
{ {
return get_link(name, GET_STATE, state); return get_link(name, GET_STATE, state);
} }
int scan_get_restart_ms(const char *name, __u32 *restart_ms) int can_get_restart_ms(const char *name, __u32 *restart_ms)
{ {
return get_link(name, GET_RESTART_MS, restart_ms); return get_link(name, GET_RESTART_MS, restart_ms);
} }
int scan_get_bittiming(const char *name, struct can_bittiming *bt) int can_get_bittiming(const char *name, struct can_bittiming *bt)
{ {
return get_link(name, GET_BITTIMING, bt); return get_link(name, GET_BITTIMING, bt);
} }
int scan_get_ctrlmode(const char *name, struct can_ctrlmode *cm) int can_get_ctrlmode(const char *name, struct can_ctrlmode *cm)
{ {
return get_link(name, GET_CTRLMODE, cm); return get_link(name, GET_CTRLMODE, cm);
} }
int scan_get_clock(const char *name, struct can_clock *clock) int can_get_clock(const char *name, struct can_clock *clock)
{ {
return get_link(name, GET_CLOCK, clock); return get_link(name, GET_CLOCK, clock);
} }

View File

@ -7,7 +7,7 @@ noinst_PROGRAMS = \
test_SOURCES = \ test_SOURCES = \
test.c test.c
test_LDADD = \ test_LDADD = \
$(top_builddir)/src/libsocketcan-nl.la $(top_builddir)/src/libsocketcan.la
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \