From 0a45ed7af68f7d44211844ba7d8f90dd42bf2de0 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 11 Jun 2019 16:48:35 +0200 Subject: [PATCH] data: Deprecate print storage API The only API user currently seems to be the examples. fprintd has its own storage and that will be a good idea in general. So deprecate the API, we'll need to find a different solution for the examples eventually. --- examples/enroll.c | 3 +++ examples/verify.c | 3 +++ libfprint/fpi-data.c | 23 +++++++++++++++++++---- libfprint/fprint.h | 8 +++++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/examples/enroll.c b/examples/enroll.c index 2c42a9e..0fe10bb 100644 --- a/examples/enroll.c +++ b/examples/enroll.c @@ -142,7 +142,10 @@ int main(void) if (!data) goto out_close; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" r = fp_print_data_save(data, RIGHT_INDEX); +#pragma GCC diagnostic pop if (r < 0) fprintf(stderr, "Data save failed, code %d\n", r); diff --git a/examples/verify.c b/examples/verify.c index 26566ed..713c39c 100644 --- a/examples/verify.c +++ b/examples/verify.c @@ -117,7 +117,10 @@ int main(void) printf("Opened device. Loading previously enrolled right index finger " "data...\n"); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" r = fp_print_data_load(dev, RIGHT_INDEX, &data); +#pragma GCC diagnostic pop if (r != 0) { fprintf(stderr, "Failed to load fingerprint, error %d\n", r); fprintf(stderr, "Did you remember to enroll your right index finger " diff --git a/libfprint/fpi-data.c b/libfprint/fpi-data.c index 0ac0f98..f377404 100644 --- a/libfprint/fpi-data.c +++ b/libfprint/fpi-data.c @@ -56,12 +56,15 @@ struct fpi_print_data_item_fp2 { * * This page documents the various operations you can do with a stored print. * Note that by default, "stored prints" are not actually stored anywhere - * except in RAM. For the simple scenarios, libfprint provides a simple API - * for you to save and load the stored prints referring to a single user in - * their home directory. For more advanced users, libfprint provides APIs for - * you to convert print data to a byte string, and to reconstruct stored prints + * except in RAM. Storage needs to be handled by the API user by using the + * fp_print_data_get_data() and fp_print_data_from_data(). This API allows + * to convert print data into byte strings, and to reconstruct stored prints * from such data at a later point. You are welcome to store these byte strings * in any fashion that suits you. + * + * The provided API to store data on disk is deprecated and should not be + * used anymore. This API stored the prints in the current user's home + * directory. */ /* @@ -366,6 +369,10 @@ static char *get_path_to_print(struct fp_dev *dev, enum fp_finger finger) * directory beneath the current user's home directory. * * Returns: 0 on success, non-zero on error. + * + * Deprecated: Data storage should be handled outside of libfprint. + * See stored prints description + * for more information. */ API_EXPORTED int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger) @@ -478,6 +485,10 @@ static int load_from_file(char *path, struct fp_print_data **data) * obscure error conditions (e.g. corruption). * * Returns: 0 on success, non-zero on error + * + * Deprecated: Data storage should be handled outside of libfprint. + * See stored prints description + * for more information. */ API_EXPORTED int fp_print_data_load(struct fp_dev *dev, enum fp_finger finger, struct fp_print_data **data) @@ -513,6 +524,10 @@ API_EXPORTED int fp_print_data_load(struct fp_dev *dev, * Removes a stored print from disk previously saved with fp_print_data_save(). * * Returns: 0 on success, negative on error + * + * Deprecated: Data storage should be handled outside of libfprint. + * See stored prints description + * for more information. */ API_EXPORTED int fp_print_data_delete(struct fp_dev *dev, enum fp_finger finger) diff --git a/libfprint/fprint.h b/libfprint/fprint.h index b9b0909..4b68e4a 100644 --- a/libfprint/fprint.h +++ b/libfprint/fprint.h @@ -275,11 +275,13 @@ int fp_identify_finger(struct fp_dev *dev, /* Data handling */ int fp_print_data_load(struct fp_dev *dev, enum fp_finger finger, - struct fp_print_data **data); + struct fp_print_data **data) LIBFPRINT_DEPRECATED; int fp_print_data_from_dscv_print(struct fp_dscv_print *print, struct fp_print_data **data) LIBFPRINT_DEPRECATED; -int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger); -int fp_print_data_delete(struct fp_dev *dev, enum fp_finger finger); +int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger) + LIBFPRINT_DEPRECATED; +int fp_print_data_delete(struct fp_dev *dev, enum fp_finger finger) + LIBFPRINT_DEPRECATED; void fp_print_data_free(struct fp_print_data *data); size_t fp_print_data_get_data(struct fp_print_data *data, unsigned char **ret); struct fp_print_data *fp_print_data_from_data(unsigned char *buf,