diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2007-12-28 22:36:43 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2007-12-28 22:36:43 +0000 |
commit | 1b214c3addadec53d5fe53c9b90f7c53bb0fd239 (patch) | |
tree | 1bbac47395bb865a893ae8dd6c30733dacbb679d /libgphoto2_port | |
parent | fbbd5ea9f0a37f2099b815ea3b4a73e576158411 (diff) | |
download | libgphoto2-1b214c3addadec53d5fe53c9b90f7c53bb0fd239.tar.gz |
switch to use symbol versioning
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@10905 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port')
-rw-r--r-- | libgphoto2_port/gphoto2/gphoto2-port-info-list.h | 24 | ||||
-rw-r--r-- | libgphoto2_port/gphoto2/gphoto2-port.h | 15 | ||||
-rw-r--r-- | libgphoto2_port/libgphoto2_port/Makefile.am | 6 | ||||
-rw-r--r-- | libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c | 57 | ||||
-rw-r--r-- | libgphoto2_port/libgphoto2_port/gphoto2-port.c | 44 | ||||
-rw-r--r-- | libgphoto2_port/libgphoto2_port/libgphoto2_port.sym | 64 | ||||
-rw-r--r-- | libgphoto2_port/libgphoto2_port/libgphoto2_port.ver | 81 |
7 files changed, 222 insertions, 69 deletions
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-info-list.h b/libgphoto2_port/gphoto2/gphoto2-port-info-list.h index 560941527..ea8635a76 100644 --- a/libgphoto2_port/gphoto2/gphoto2-port-info-list.h +++ b/libgphoto2_port/gphoto2/gphoto2-port-info-list.h @@ -57,6 +57,17 @@ typedef struct _GPPortInfo { char library_filename[1024]; /**< \brief Internal pathname of the port driver. Do not use outside of the port library. */ } GPPortInfo; +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +typedef struct _GPPortInfo_v240 { + GPPortType type; + char name[64]; + char path[64]; + + /* Private */ + char library_filename[1024]; +} GPPortInfo_v240; +#endif + #include <gphoto2/gphoto2-port.h> #ifdef __cplusplus @@ -90,6 +101,19 @@ const char *gp_port_message_codeset (const char*); /* DEPRECATED */ typedef GPPortInfo gp_port_info; +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +int gp_port_info_list_append_v240 (GPPortInfoList *list, GPPortInfo_v240 info); +int gp_port_info_list_append_v250 (GPPortInfoList *list, GPPortInfo info); +asm(".symver gp_port_info_list_append_v240, gp_port_info_list_append@LIBGPHOTO2_0_0"); +asm(".symver gp_port_info_list_append_v250, gp_port_info_list_append@@LIBGPHOTO2_5_0"); +#define gp_port_info_list_append gp_port_info_list_append_v250 + +int gp_port_info_list_get_info_v240 (GPPortInfoList *list, int n, GPPortInfo_v240 *info); +int gp_port_info_list_get_info_v250 (GPPortInfoList *list, int n, GPPortInfo *info); +asm(".symver gp_port_info_list_get_info_v240, gp_port_info_list_get_info@LIBGPHOTO2_0_0"); +asm(".symver gp_port_info_list_get_info_v250, gp_port_info_list_get_info@@LIBGPHOTO2_5_0"); +#define gp_port_info_list_get_info gp_port_info_list_get_info_v250 +#endif /** * Name of the environment variable which may contain the path where diff --git a/libgphoto2_port/gphoto2/gphoto2-port.h b/libgphoto2_port/gphoto2/gphoto2-port.h index 817cec554..7580d4dcc 100644 --- a/libgphoto2_port/gphoto2/gphoto2-port.h +++ b/libgphoto2_port/gphoto2/gphoto2-port.h @@ -220,6 +220,19 @@ int gp_port_set_error (GPPort *port, const char *format, ...) ; const char *gp_port_get_error (GPPort *port); +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +int gp_port_set_info_v240 (GPPort *port, GPPortInfo_v240 info); +int gp_port_set_info_v250 (GPPort *port, GPPortInfo info); +asm(".symver gp_port_set_info_v240, gp_port_set_info@LIBGPHOTO2_0_0"); +asm(".symver gp_port_set_info_v250, gp_port_set_info@@LIBGPHOTO2_5_0"); +#define gp_port_set_info gp_port_set_info_v250 +int gp_port_get_info_v240 (GPPort *port, GPPortInfo_v240 *info); +int gp_port_get_info_v250 (GPPort *port, GPPortInfo *info); +asm(".symver gp_port_get_info_v240, gp_port_get_info@LIBGPHOTO2_0_0"); +asm(".symver gp_port_get_info_v250, gp_port_get_info@@LIBGPHOTO2_5_0"); +#define gp_port_get_info gp_port_get_info_v250 +#endif + /* DEPRECATED */ /** \deprecated internal typedef */ typedef GPPort gp_port; @@ -233,5 +246,3 @@ typedef GPPortSettings gp_port_settings; #endif /* __cplusplus */ #endif /* __GPHOTO2_PORT_H__ */ - - diff --git a/libgphoto2_port/libgphoto2_port/Makefile.am b/libgphoto2_port/libgphoto2_port/Makefile.am index 4371e6d63..5f271f52f 100644 --- a/libgphoto2_port/libgphoto2_port/Makefile.am +++ b/libgphoto2_port/libgphoto2_port/Makefile.am @@ -26,7 +26,7 @@ libgphoto2_port_la_CPPFLAGS = \ libgphoto2_port_la_LDFLAGS = \ -no-undefined \ - -export-symbols $(srcdir)/libgphoto2_port.sym \ + @VERSIONMAPLDFLAGS@ \ -version-info @LIBGPHOTO2_PORT_VERSION_INFO@ libgphoto2_port_la_LIBADD = \ @@ -48,14 +48,14 @@ libgphoto2_port_la_SOURCES = \ libgphoto2_port_la_DEPENDENCIES = \ $(top_srcdir)/gphoto2/gphoto2-port-version.h \ $(top_srcdir)/gphoto2/gphoto2-port-library.h \ - $(srcdir)/libgphoto2_port.sym + $(srcdir)/libgphoto2_port.ver # Note: If you have problem with this file not being put into # the source tarball correctly at "make dist", this may # be the result of tar not creating archives with >99 # characters of path length. EXTRA_DIST = \ - libgphoto2_port.sym + libgphoto2_port.ver ../libltdl/libltdlc.la: cd ../libltdl && $(MAKE) libltdlc.la diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c index a7358a63e..afbecf259 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c @@ -22,6 +22,11 @@ */ #include "config.h" + +#ifdef HAVE_ASM_SYMVERS +# define __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +#endif + #include <gphoto2/gphoto2-port-info-list.h> #include <stdlib.h> @@ -161,7 +166,11 @@ gp_port_info_list_free (GPPortInfoList *list) * \return A non-negative number or a gphoto2 error code **/ int +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +gp_port_info_list_append_v250 (GPPortInfoList *list, GPPortInfo info) +#else gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info) +#endif { int generic, i; GPPortInfo *new_info; @@ -188,6 +197,21 @@ gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info) return (list->count - 1 - generic); } +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +int +gp_port_info_list_append_v240 (GPPortInfoList *list, GPPortInfo_v240 info) +{ + GPPortInfo newinfo; + int ret; + + newinfo.type = info.type; + strcpy (newinfo.name,info.name); + strncpy (newinfo.path,info.path, sizeof(newinfo.path)); + strcpy (newinfo.library_filename,info.library_filename); + ret = gp_port_info_list_append_v250 (list, newinfo); + return ret; +} +#endif static int foreach_func (const char *filename, lt_ptr data) @@ -464,7 +488,11 @@ gp_port_info_list_lookup_name (GPPortInfoList *list, const char *name) * \return a gphoto2 error code **/ int +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +gp_port_info_list_get_info_v250 (GPPortInfoList *list, int n, GPPortInfo *info) +#else gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info) +#endif { int i; @@ -489,6 +517,35 @@ gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info) return (GP_OK); } +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +/** + * \brief Get port information of specific entry + * \param list a #GPPortInfoList + * \param n the index of the entry + * \param info the returned information + * + * Retreives an entry from the list and stores it into info. + * This is the version used before libgphoto2 2.5.0 + * + * \return a gphoto2 error code + **/ +int +gp_port_info_list_get_info_v240 (GPPortInfoList *list, int n, GPPortInfo_v240 *info) +{ + int ret; + GPPortInfo newinfo; + + ret = gp_port_info_list_get_info_v250 (list, n, &newinfo); + if (ret != GP_OK) + return ret; + info->type = newinfo.type; + strcpy(info->name, newinfo.name); /* same size */ + /* FIXME: handle overflows by error return? */ + strncpy(info->path, newinfo.path, sizeof(info->path)); /* larger size */ + strcpy(info->library_filename, newinfo.library_filename); /* same size */ + return (GP_OK); +} +#endif #ifdef _GPHOTO2_INTERNAL_CODE /** diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port.c b/libgphoto2_port/libgphoto2_port/gphoto2-port.c index 46534a183..ad202c95f 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.c @@ -32,6 +32,10 @@ #include <ltdl.h> +#ifdef HAVE_ASM_SYMVERS +# define __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +#endif + #include <gphoto2/gphoto2-port-result.h> #include <gphoto2/gphoto2-port-library.h> #include <gphoto2/gphoto2-port-log.h> @@ -139,7 +143,11 @@ gp_port_exit (GPPort *port) * \return a gphoto2 error code **/ int +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +gp_port_set_info_v250 (GPPort *port, GPPortInfo info) +#else gp_port_set_info (GPPort *port, GPPortInfo info) +#endif { GPPortLibraryOperations ops_func; @@ -218,6 +226,20 @@ gp_port_set_info (GPPort *port, GPPortInfo info) return (GP_OK); } +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +int +gp_port_set_info_v240 (GPPort *port, GPPortInfo_v240 info) +{ + GPPortInfo newinfo; + + newinfo.type = info.type; + strcpy (newinfo.name, info.name); + strncpy(newinfo.path, info.path, sizeof(newinfo.path)); + strcpy (newinfo.library_filename, info.library_filename); + return gp_port_set_info_v250 (port, newinfo); +} +#endif + /** * \brief Retreives information about the port. * @@ -228,7 +250,11 @@ gp_port_set_info (GPPort *port, GPPortInfo info) * \return a gphoto2 error code **/ int +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +gp_port_get_info_v250 (GPPort *port, GPPortInfo *info) +#else gp_port_get_info (GPPort *port, GPPortInfo *info) +#endif { CHECK_NULL (port && info); @@ -237,6 +263,24 @@ gp_port_get_info (GPPort *port, GPPortInfo *info) return (GP_OK); } +#ifdef __LIBGPHOTO2_INCLUDE_OLD_VERSIONS +int +gp_port_get_info_v240 (GPPort *port, GPPortInfo_v240 *info) +{ + int ret; + GPPortInfo newinfo; + + ret = gp_port_get_info_v250 (port, &newinfo); + if (ret != GP_OK) + return ret; + info->type = newinfo.type; + strcpy (info->name, newinfo.name); + strncpy (info->path, newinfo.path, sizeof(info->path)); + strcpy (info->library_filename, newinfo.library_filename); + return GP_OK; +} +#endif + /** * \brief Open a port. * \param port a #GPPort diff --git a/libgphoto2_port/libgphoto2_port/libgphoto2_port.sym b/libgphoto2_port/libgphoto2_port/libgphoto2_port.sym deleted file mode 100644 index 18e9f131d..000000000 --- a/libgphoto2_port/libgphoto2_port/libgphoto2_port.sym +++ /dev/null @@ -1,64 +0,0 @@ -gp_log -gp_log_add_func -gp_log_data -gp_log_remove_func -gp_logv -gp_port_message_codeset -gp_port_check_int -gp_port_check_int_fast -gp_port_close -gp_port_flush -gp_port_free -gp_port_get_error -gp_port_get_info -gp_port_get_pin -gp_port_get_settings -gp_port_get_timeout -gp_port_info_list_append -gp_port_info_list_count -gp_port_info_list_free -gp_port_info_list_get_info -gp_port_info_list_load -gp_port_info_list_lookup_name -gp_port_info_list_lookup_path -gp_port_info_list_new -gp_port_library_version -gp_port_new -gp_port_open -gp_port_read -gp_port_result_as_string -gp_port_send_break -gp_port_set_error -gp_port_set_info -gp_port_set_pin -gp_port_set_settings -gp_port_set_timeout -gp_port_settings_get -gp_port_settings_set -gp_port_timeout_get -gp_port_timeout_set -gp_port_usb_clear_halt -gp_port_usb_find_device -gp_port_usb_find_device_by_class -gp_port_usb_msg_interface_read -gp_port_usb_msg_interface_write -gp_port_usb_msg_read -gp_port_usb_msg_write -gp_port_usb_msg_class_write -gp_port_usb_msg_class_read -gp_port_write -gp_system_mkdir -gp_system_rmdir -gp_system_opendir -gp_system_readdir -gp_system_filename -gp_system_closedir -gp_system_is_file -gp_system_is_dir -gpi_gphoto_port_type_map -gpi_enum_to_string -gpi_string_to_enum -gpi_string_to_flag -gpi_string_or_to_flags -gpi_string_list_to_flags -gpi_flags_to_string_list diff --git a/libgphoto2_port/libgphoto2_port/libgphoto2_port.ver b/libgphoto2_port/libgphoto2_port/libgphoto2_port.ver new file mode 100644 index 000000000..0fb369521 --- /dev/null +++ b/libgphoto2_port/libgphoto2_port/libgphoto2_port.ver @@ -0,0 +1,81 @@ +LIBGPHOTO2_0_0 { + global: + gp_log; + gp_log_add_func; + gp_log_data; + gp_log_remove_func; + gp_logv; + gp_port_message_codeset; + gp_port_check_int; + gp_port_check_int_fast; + gp_port_close; + gp_port_flush; + gp_port_free; + gp_port_get_error; + gp_port_get_info; + gp_port_get_pin; + gp_port_get_settings; + gp_port_get_timeout; + gp_port_info_list_append; + gp_port_info_list_count; + gp_port_info_list_free; + gp_port_info_list_get_info; + gp_port_info_list_load; + gp_port_info_list_lookup_name; + gp_port_info_list_lookup_path; + gp_port_info_list_new; + gp_port_library_version; + gp_port_new; + gp_port_open; + gp_port_read; + gp_port_result_as_string; + gp_port_send_break; + gp_port_set_error; + gp_port_set_info; + gp_port_set_pin; + gp_port_set_settings; + gp_port_set_timeout; + gp_port_settings_get; + gp_port_settings_set; + gp_port_timeout_get; + gp_port_timeout_set; + gp_port_usb_clear_halt; + gp_port_usb_find_device; + gp_port_usb_find_device_by_class; + gp_port_usb_msg_interface_read; + gp_port_usb_msg_interface_write; + gp_port_usb_msg_read; + gp_port_usb_msg_write; + gp_port_usb_msg_class_write; + gp_port_usb_msg_class_read; + gp_port_write; + gp_system_mkdir; + gp_system_rmdir; + gp_system_opendir; + gp_system_readdir; + gp_system_filename; + gp_system_closedir; + gp_system_is_file; + gp_system_is_dir; + gpi_gphoto_port_type_map; + gpi_enum_to_string; + gpi_string_to_enum; + gpi_string_to_flag; + gpi_string_or_to_flags; + gpi_string_list_to_flags; + gpi_flags_to_string_list; + local: + *; +}; + +LIBGPHOTO2_5_0 { + # The asm(".symver ...") constructs will put stuff into this node, + # it needs to stay. + # Currently used by: + # gp_port_set_info, gp_port_get_info, + # gp_port_info_list_append, gp_port_info_list_get_info + + # Add new exported functions here too! +} LIBGPHOTO2_0_0; + +# here comes the next version... |