[fprint] [PATCH 4/8] lib: Mark internal API functions with API_INTERNAL.
Kunal Gangakhedkar
kunal.gangakhedkar at gmail.com
Mon Oct 8 07:39:28 PDT 2012
Commit ce298bea07b04665f850ce7d3553c90d44c96d00 defines new visibility
class for internal API; use it for such functions.
Signed-off-by: Kunal Gangakhedkar <kunal.gangakhedkar at gmail.com>
---
libfprint/async.c | 26 +++++++++++++-------------
libfprint/core.c | 12 +++++++++---
libfprint/data.c | 10 ++++++----
libfprint/drv.c | 19 ++++++++++---------
libfprint/fp_internal.h | 2 ++
libfprint/gdkpixbuf.c | 3 ++-
libfprint/imagemagick.c | 3 ++-
libfprint/img.c | 18 +++++++++---------
libfprint/imgdev.c | 23 +++++++++++++----------
libfprint/poll.c | 10 +++++-----
10 files changed, 71 insertions(+), 55 deletions(-)
diff --git a/libfprint/async.c b/libfprint/async.c
index 67e3481..be50e16 100644
--- a/libfprint/async.c
+++ b/libfprint/async.c
@@ -26,7 +26,7 @@
#include "fp_internal.h"
/* Drivers call this when device initialisation has completed */
-void fpi_drvcb_open_complete(struct fp_dev *dev, int status)
+API_INTERNAL void fpi_drvcb_open_complete(struct fp_dev *dev, int status)
{
fp_dbg("status %d", status);
BUG_ON(dev->state != DEV_STATE_INITIALIZING);
@@ -76,7 +76,7 @@ API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb,
}
/* Drivers call this when device deinitialisation has completed */
-void fpi_drvcb_close_complete(struct fp_dev *dev)
+API_INTERNAL void fpi_drvcb_close_complete(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_DEINITIALIZING);
@@ -109,7 +109,7 @@ API_EXPORTED void fp_async_dev_close(struct fp_dev *dev,
}
/* Drivers call this when enrollment has started */
-void fpi_drvcb_enroll_started(struct fp_dev *dev, int status)
+API_INTERNAL void fpi_drvcb_enroll_started(struct fp_dev *dev, int status)
{
fp_dbg("status %d", status);
BUG_ON(dev->state != DEV_STATE_ENROLL_STARTING);
@@ -155,8 +155,8 @@ API_EXPORTED int fp_async_enroll_start(struct fp_dev *dev,
}
/* Drivers call this when an enroll stage has completed */
-void fpi_drvcb_enroll_stage_completed(struct fp_dev *dev, int result,
- struct fp_print_data *data, struct fp_img *img)
+API_INTERNAL void fpi_drvcb_enroll_stage_completed(struct fp_dev *dev,
+ int result, struct fp_print_data *data, struct fp_img *img)
{
BUG_ON(dev->state != DEV_STATE_ENROLLING);
fp_dbg("result %d", result);
@@ -172,7 +172,7 @@ void fpi_drvcb_enroll_stage_completed(struct fp_dev *dev, int result,
}
/* Drivers call this when enrollment has stopped */
-void fpi_drvcb_enroll_stopped(struct fp_dev *dev)
+API_INTERNAL void fpi_drvcb_enroll_stopped(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_ENROLL_STOPPING);
@@ -235,7 +235,7 @@ API_EXPORTED int fp_async_verify_start(struct fp_dev *dev,
}
/* Drivers call this when verification has started */
-void fpi_drvcb_verify_started(struct fp_dev *dev, int status)
+API_INTERNAL void fpi_drvcb_verify_started(struct fp_dev *dev, int status)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_VERIFY_STARTING);
@@ -253,7 +253,7 @@ void fpi_drvcb_verify_started(struct fp_dev *dev, int status)
}
/* Drivers call this to report a verify result (which might mark completion) */
-void fpi_drvcb_report_verify_result(struct fp_dev *dev, int result,
+API_INTERNAL void fpi_drvcb_report_verify_result(struct fp_dev *dev, int result,
struct fp_img *img)
{
fp_dbg("result %d", result);
@@ -269,7 +269,7 @@ void fpi_drvcb_report_verify_result(struct fp_dev *dev, int result,
}
/* Drivers call this when verification has stopped */
-void fpi_drvcb_verify_stopped(struct fp_dev *dev)
+API_INTERNAL void fpi_drvcb_verify_stopped(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_VERIFY_STOPPING);
@@ -335,7 +335,7 @@ API_EXPORTED int fp_async_identify_start(struct fp_dev *dev,
}
/* Driver-lib: identification has started, expect results soon */
-void fpi_drvcb_identify_started(struct fp_dev *dev, int status)
+API_INTERNAL void fpi_drvcb_identify_started(struct fp_dev *dev, int status)
{
fp_dbg("status %d", status);
BUG_ON(dev->state != DEV_STATE_IDENTIFY_STARTING);
@@ -353,8 +353,8 @@ void fpi_drvcb_identify_started(struct fp_dev *dev, int status)
}
/* Drivers report an identify result (which might mark completion) */
-void fpi_drvcb_report_identify_result(struct fp_dev *dev, int result,
- size_t match_offset, struct fp_img *img)
+API_INTERNAL void fpi_drvcb_report_identify_result(struct fp_dev *dev,
+ int result, size_t match_offset, struct fp_img *img)
{
fp_dbg("result %d", result);
BUG_ON(dev->state != DEV_STATE_IDENTIFYING
@@ -403,7 +403,7 @@ API_EXPORTED int fp_async_identify_stop(struct fp_dev *dev,
}
/* Drivers call this when identification has stopped */
-void fpi_drvcb_identify_stopped(struct fp_dev *dev)
+API_INTERNAL void fpi_drvcb_identify_stopped(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_IDENTIFY_STOPPING);
diff --git a/libfprint/core.c b/libfprint/core.c
index 3a430b7..84f3c92 100644
--- a/libfprint/core.c
+++ b/libfprint/core.c
@@ -281,7 +281,7 @@ GSList *opened_devices = NULL;
static GSList *registered_drivers = NULL;
-void fpi_log(enum fpi_log_level level, const char *component,
+API_INTERNAL void fpi_log(enum fpi_log_level level, const char *component,
const char *function, const char *format, ...)
{
va_list args;
@@ -329,7 +329,7 @@ void fpi_log(enum fpi_log_level level, const char *component,
fprintf(stream, "\n");
}
-static void register_driver(struct fp_driver *drv)
+API_INTERNAL void register_driver(struct fp_driver *drv)
{
if (drv->id == 0) {
fp_err("not registering driver %s: driver ID is 0", drv->name);
@@ -339,6 +339,12 @@ static void register_driver(struct fp_driver *drv)
fp_dbg("registered driver %s", drv->name);
}
+API_INTERNAL void unregister_driver(struct fp_driver *drv)
+{
+ registered_drivers = g_slist_remove(registered_drivers, (gpointer) drv);
+ fp_dbg("unregistered driver %s", drv->name);
+}
+
static struct fp_driver * const primitive_drivers[] = {
#ifdef ENABLE_UPEKTS
&upekts_driver,
@@ -592,7 +598,7 @@ API_EXPORTED uint32_t fp_dscv_dev_get_devtype(struct fp_dscv_dev *dev)
return dev->devtype;
}
-enum fp_print_data_type fpi_driver_get_data_type(struct fp_driver *drv)
+API_INTERNAL enum fp_print_data_type fpi_driver_get_data_type(struct fp_driver *drv)
{
switch (drv->type) {
case DRIVER_PRIMITIVE:
diff --git a/libfprint/data.c b/libfprint/data.c
index 3371a0c..c20a7a3 100644
--- a/libfprint/data.c
+++ b/libfprint/data.c
@@ -107,7 +107,8 @@ static struct fp_print_data *print_data_new(uint16_t driver_id,
return data;
}
-struct fp_print_data *fpi_print_data_new(struct fp_dev *dev, size_t length)
+API_INTERNAL struct fp_print_data *fpi_print_data_new(struct fp_dev *dev,
+ size_t length)
{
return print_data_new(dev->drv->id, dev->devtype,
fpi_driver_get_data_type(dev->drv), length);
@@ -269,9 +270,10 @@ API_EXPORTED int fp_print_data_save(struct fp_print_data *data,
return 0;
}
-gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
- enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2,
- enum fp_print_data_type type2)
+API_INTERNAL gboolean fpi_print_data_compatible(uint16_t driver_id1,
+ uint32_t devtype1, enum fp_print_data_type type1,
+ uint16_t driver_id2, uint32_t devtype2,
+ enum fp_print_data_type type2)
{
if (driver_id1 != driver_id2) {
fp_dbg("driver ID mismatch: %02x vs %02x", driver_id1, driver_id2);
diff --git a/libfprint/drv.c b/libfprint/drv.c
index a7ba846..43150f5 100644
--- a/libfprint/drv.c
+++ b/libfprint/drv.c
@@ -69,8 +69,8 @@
*/
/* Allocate a new ssm */
-struct fpi_ssm *fpi_ssm_new(struct fp_dev *dev, ssm_handler_fn handler,
- int nr_states)
+API_INTERNAL struct fpi_ssm *fpi_ssm_new(struct fp_dev *dev,
+ ssm_handler_fn handler, int nr_states)
{
struct fpi_ssm *machine;
BUG_ON(nr_states < 1);
@@ -84,7 +84,7 @@ struct fpi_ssm *fpi_ssm_new(struct fp_dev *dev, ssm_handler_fn handler,
}
/* Free a ssm */
-void fpi_ssm_free(struct fpi_ssm *machine)
+API_INTERNAL void fpi_ssm_free(struct fpi_ssm *machine)
{
if (!machine)
return;
@@ -99,7 +99,7 @@ static void __ssm_call_handler(struct fpi_ssm *machine)
}
/* Start a ssm. You can also restart a completed or aborted ssm. */
-void fpi_ssm_start(struct fpi_ssm *ssm, ssm_completed_fn callback)
+API_INTERNAL void fpi_ssm_start(struct fpi_ssm *ssm, ssm_completed_fn callback)
{
BUG_ON(!ssm->completed);
ssm->callback = callback;
@@ -124,14 +124,15 @@ static void __subsm_complete(struct fpi_ssm *ssm)
* parent will be advanced to the next state. if the child aborts, the parent
* will be aborted with the same error code. the child will be automatically
* freed upon completion/abortion. */
-void fpi_ssm_start_subsm(struct fpi_ssm *parent, struct fpi_ssm *child)
+API_INTERNAL void fpi_ssm_start_subsm(struct fpi_ssm *parent,
+ struct fpi_ssm *child)
{
child->parentsm = parent;
fpi_ssm_start(child, __subsm_complete);
}
/* Mark a ssm as completed successfully. */
-void fpi_ssm_mark_completed(struct fpi_ssm *machine)
+API_INTERNAL void fpi_ssm_mark_completed(struct fpi_ssm *machine)
{
BUG_ON(machine->completed);
machine->completed = TRUE;
@@ -141,7 +142,7 @@ void fpi_ssm_mark_completed(struct fpi_ssm *machine)
}
/* Mark a ssm as aborted with error. */
-void fpi_ssm_mark_aborted(struct fpi_ssm *machine, int error)
+API_INTERNAL void fpi_ssm_mark_aborted(struct fpi_ssm *machine, int error)
{
fp_dbg("error %d from state %d", error, machine->cur_state);
BUG_ON(error == 0);
@@ -150,7 +151,7 @@ void fpi_ssm_mark_aborted(struct fpi_ssm *machine, int error)
}
/* Iterate to next state of a ssm */
-void fpi_ssm_next_state(struct fpi_ssm *machine)
+API_INTERNAL void fpi_ssm_next_state(struct fpi_ssm *machine)
{
BUG_ON(machine->completed);
machine->cur_state++;
@@ -161,7 +162,7 @@ void fpi_ssm_next_state(struct fpi_ssm *machine)
}
}
-void fpi_ssm_jump_to_state(struct fpi_ssm *machine, int state)
+API_INTERNAL void fpi_ssm_jump_to_state(struct fpi_ssm *machine, int state)
{
BUG_ON(machine->completed);
BUG_ON(state >= machine->nr_states);
diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h
index 44881cd..da0276c 100644
--- a/libfprint/fp_internal.h
+++ b/libfprint/fp_internal.h
@@ -276,6 +276,8 @@ extern libusb_context *fpi_usb_ctx;
extern GSList *opened_devices;
void fpi_img_driver_setup(struct fp_img_driver *idriver);
+void register_driver(struct fp_driver *drv);
+void unregister_driver(struct fp_driver *drv);
#define fpi_driver_to_img_driver(drv) \
container_of((drv), struct fp_img_driver, driver)
diff --git a/libfprint/gdkpixbuf.c b/libfprint/gdkpixbuf.c
index ea2d5bc..b4acc22 100644
--- a/libfprint/gdkpixbuf.c
+++ b/libfprint/gdkpixbuf.c
@@ -22,7 +22,8 @@
#include "fp_internal.h"
-struct fp_img *fpi_im_resize(struct fp_img *img, unsigned int factor)
+API_INTERNAL struct fp_img *fpi_im_resize(struct fp_img *img,
+ unsigned int factor)
{
int new_width = img->width * factor;
int new_height = img->height * factor;
diff --git a/libfprint/imagemagick.c b/libfprint/imagemagick.c
index ed6a1ca..4dee612 100644
--- a/libfprint/imagemagick.c
+++ b/libfprint/imagemagick.c
@@ -22,7 +22,8 @@
#include "fp_internal.h"
-struct fp_img *fpi_im_resize(struct fp_img *img, unsigned int factor)
+API_INTERNAL struct fp_img *fpi_im_resize(struct fp_img *img,
+ unsigned int factor)
{
Image *mimg;
Image *resized;
diff --git a/libfprint/img.c b/libfprint/img.c
index 1c70858..1958908 100644
--- a/libfprint/img.c
+++ b/libfprint/img.c
@@ -45,7 +45,7 @@
* natural upright orientation.
*/
-struct fp_img *fpi_img_new(size_t length)
+API_INTERNAL struct fp_img *fpi_img_new(size_t length)
{
struct fp_img *img = g_malloc(sizeof(*img) + length);
memset(img, 0, sizeof(*img));
@@ -54,7 +54,7 @@ struct fp_img *fpi_img_new(size_t length)
return img;
}
-struct fp_img *fpi_img_new_for_imgdev(struct fp_img_dev *imgdev)
+API_INTERNAL struct fp_img *fpi_img_new_for_imgdev(struct fp_img_dev *imgdev)
{
struct fp_img_driver *imgdrv = fpi_driver_to_img_driver(imgdev->dev->drv);
int width = imgdrv->img_width;
@@ -65,7 +65,7 @@ struct fp_img *fpi_img_new_for_imgdev(struct fp_img_dev *imgdev)
return img;
}
-gboolean fpi_img_is_sane(struct fp_img *img)
+API_INTERNAL gboolean fpi_img_is_sane(struct fp_img *img)
{
/* basic checks */
if (!img->length || !img->width || !img->height)
@@ -78,7 +78,7 @@ gboolean fpi_img_is_sane(struct fp_img *img)
return TRUE;
}
-struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize)
+API_INTERNAL struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize)
{
return g_realloc(img, sizeof(*img) + newsize);
}
@@ -268,7 +268,7 @@ static void minutiae_to_xyt(struct fp_minutiae *minutiae, int bwidth,
xyt->nrows = nmin;
}
-int fpi_img_detect_minutiae(struct fp_img *img)
+API_INTERNAL int fpi_img_detect_minutiae(struct fp_img *img)
{
struct fp_minutiae *minutiae;
int r;
@@ -310,8 +310,8 @@ int fpi_img_detect_minutiae(struct fp_img *img)
return minutiae->num;
}
-int fpi_img_to_print_data(struct fp_img_dev *imgdev, struct fp_img *img,
- struct fp_print_data **ret)
+API_INTERNAL int fpi_img_to_print_data(struct fp_img_dev *imgdev,
+ struct fp_img *img, struct fp_print_data **ret)
{
struct fp_print_data *print;
int r;
@@ -340,7 +340,7 @@ int fpi_img_to_print_data(struct fp_img_dev *imgdev, struct fp_img *img,
return 0;
}
-int fpi_img_compare_print_data(struct fp_print_data *enrolled_print,
+API_INTERNAL int fpi_img_compare_print_data(struct fp_print_data *enrolled_print,
struct fp_print_data *new_print)
{
struct xyt_struct *gstruct = (struct xyt_struct *) enrolled_print->data;
@@ -364,7 +364,7 @@ int fpi_img_compare_print_data(struct fp_print_data *enrolled_print,
return r;
}
-int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print,
+API_INTERNAL int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print,
struct fp_print_data **gallery, int match_threshold, size_t *match_offset)
{
struct xyt_struct *pstruct = (struct xyt_struct *) print->data;
diff --git a/libfprint/imgdev.c b/libfprint/imgdev.c
index 14e41ae..1c80a6e 100644
--- a/libfprint/imgdev.c
+++ b/libfprint/imgdev.c
@@ -53,7 +53,8 @@ err:
return r;
}
-void fpi_imgdev_open_complete(struct fp_img_dev *imgdev, int status)
+API_INTERNAL void fpi_imgdev_open_complete(struct fp_img_dev *imgdev,
+ int status)
{
fpi_drvcb_open_complete(imgdev->dev, status);
}
@@ -69,7 +70,7 @@ static void img_dev_close(struct fp_dev *dev)
fpi_drvcb_close_complete(dev);
}
-void fpi_imgdev_close_complete(struct fp_img_dev *imgdev)
+API_INTERNAL void fpi_imgdev_close_complete(struct fp_img_dev *imgdev)
{
fpi_drvcb_close_complete(imgdev->dev);
g_free(imgdev);
@@ -116,7 +117,7 @@ static int sanitize_image(struct fp_img_dev *imgdev, struct fp_img **_img)
return 0;
}
-void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
+API_INTERNAL void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
gboolean present)
{
int r = imgdev->action_result;
@@ -203,7 +204,8 @@ static void identify_process_img(struct fp_img_dev *imgdev)
imgdev->identify_match_offset = match_offset;
}
-void fpi_imgdev_image_captured(struct fp_img_dev *imgdev, struct fp_img *img)
+API_INTERNAL void fpi_imgdev_image_captured(struct fp_img_dev *imgdev,
+ struct fp_img *img)
{
struct fp_print_data *print;
int r;
@@ -263,7 +265,7 @@ next_state:
dev_change_state(imgdev, IMGDEV_STATE_AWAIT_FINGER_OFF);
}
-void fpi_imgdev_session_error(struct fp_img_dev *imgdev, int error)
+API_INTERNAL void fpi_imgdev_session_error(struct fp_img_dev *imgdev, int error)
{
fp_dbg("error %d", error);
BUG_ON(error == 0);
@@ -283,7 +285,8 @@ void fpi_imgdev_session_error(struct fp_img_dev *imgdev, int error)
}
}
-void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev, int status)
+API_INTERNAL void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev,
+ int status)
{
fp_dbg("status %d", status);
@@ -308,7 +311,7 @@ void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev, int status)
}
}
-void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev)
+API_INTERNAL void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev)
{
fp_dbg("");
@@ -331,7 +334,7 @@ void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev)
imgdev->action_state = 0;
}
-int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev)
+API_INTERNAL int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev)
{
struct fp_driver *drv = imgdev->dev->drv;
struct fp_img_driver *imgdrv = fpi_driver_to_img_driver(drv);
@@ -343,7 +346,7 @@ int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev)
return width;
}
-int fpi_imgdev_get_img_height(struct fp_img_dev *imgdev)
+API_INTERNAL int fpi_imgdev_get_img_height(struct fp_img_dev *imgdev)
{
struct fp_driver *drv = imgdev->dev->drv;
struct fp_img_driver *imgdrv = fpi_driver_to_img_driver(drv);
@@ -443,7 +446,7 @@ static int img_dev_identify_stop(struct fp_dev *dev, gboolean iterating)
return 0;
}
-void fpi_img_driver_setup(struct fp_img_driver *idriver)
+API_INTERNAL void fpi_img_driver_setup(struct fp_img_driver *idriver)
{
idriver->driver.type = DRIVER_IMAGING;
idriver->driver.open = img_dev_open;
diff --git a/libfprint/poll.c b/libfprint/poll.c
index e849ea4..ea95625 100644
--- a/libfprint/poll.c
+++ b/libfprint/poll.c
@@ -89,8 +89,8 @@ static int timeout_sort_fn(gconstpointer _a, gconstpointer _b)
/* A timeout is the asynchronous equivalent of sleeping. You create a timeout
* saying that you'd like to have a function invoked at a certain time in
* the future. */
-struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback,
- void *data)
+API_INTERNAL struct fpi_timeout *fpi_timeout_add(unsigned int msec,
+ fpi_timeout_fn callback, void *data)
{
struct timespec ts;
struct timeval add_msec;
@@ -122,7 +122,7 @@ struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback,
return timeout;
}
-void fpi_timeout_cancel(struct fpi_timeout *timeout)
+API_INTERNAL void fpi_timeout_cancel(struct fpi_timeout *timeout)
{
fp_dbg("");
active_timers = g_slist_remove(active_timers, timeout);
@@ -346,12 +346,12 @@ static void remove_pollfd(int fd, void *user_data)
fd_removed_cb(fd);
}
-void fpi_poll_init(void)
+API_INTERNAL void fpi_poll_init(void)
{
libusb_set_pollfd_notifiers(fpi_usb_ctx, add_pollfd, remove_pollfd, NULL);
}
-void fpi_poll_exit(void)
+API_INTERNAL void fpi_poll_exit(void)
{
g_slist_free(active_timers);
active_timers = NULL;
--
1.7.9.5
More information about the fprint
mailing list