New API call isoburn_is_compatible()

This commit is contained in:
Thomas Schmitt 2008-01-29 18:44:54 +00:00
parent 7bb454bb64
commit 0523d4ee49
8 changed files with 122 additions and 24 deletions

View File

@ -7,21 +7,30 @@ AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([subdir-objects])
dnl The API version codes are now defined in libisoburn/libisoburn.h
dnl #define isoburn_header_version_*
dnl configure.ac only rules the libtool revision numbering about
dnl LT_CURREN, LT_AGE, LT_REVISION where SONAME becomes LT_CURRENT - LT_AGE
dnl
dnl These three are only copies to provide libtool with unused LT_RELEASE
ISOBURN_MAJOR_VERSION=0
ISOBURN_MINOR_VERSION=0
ISOBURN_MICRO_VERSION=1
ISOBURN_VERSION=$ISOBURN_MAJOR_VERSION.$ISOBURN_MINOR_VERSION.$ISOBURN_MICRO_VERSION
dnl ISOBURN_VERSION=$ISOBURN_MAJOR_VERSION.$ISOBURN_MINOR_VERSION.$ISOBURN_MICRO_VERSION
AC_SUBST(ISOBURN_MAJOR_VERSION)
AC_SUBST(ISOBURN_MINOR_VERSION)
AC_SUBST(ISOBURN_MICRO_VERSION)
AC_SUBST(ISOBURN_VERSION)
dnl AC_SUBST(ISOBURN_VERSION)
dnl Libtool versioning
dnl Generate libisoburn.so.1.0.0
dnl SONAME will become LT_CURRENT - LT_AGE
dnl
LT_RELEASE=$ISOBURN_MAJOR_VERSION.$ISOBURN_MINOR_VERSION
LT_CURRENT=0
LT_CURRENT=1
LT_AGE=0
LT_REVISION=1
LT_REVISION=0
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
AC_SUBST(LT_RELEASE)

View File

@ -59,6 +59,8 @@ int isoburn_initialize(char msg[1024], int flag)
iso_lib_version(&major, &minor, &micro);
sprintf(msg+strlen(msg), "libisofs-%d.%d.%d , ", major, minor, micro);
/* >>> check for suitability of library */
if(!burn_initialize()) {
sprintf(msg+strlen(msg), "Cannot initialize libburn\n");
return(0);
@ -66,6 +68,8 @@ int isoburn_initialize(char msg[1024], int flag)
burn_version(&major, &minor, &micro);
sprintf(msg+strlen(msg), "libburn-%d.%d.%d , ", major, minor, micro);
/* >>> check for suitability of library */
isoburn_destroy_all(&isoburn_list_start, 0); /* isoburn_list_start= NULL */
isoburn_version(&major, &minor, &micro);

View File

@ -37,8 +37,10 @@
#include "isoburn.h"
/* No more: version numbers out of configure.ac
major.minor.micro now comes from libisoburn.h
#include "../version.h"
*/
/* -------------------------- isoburn ----------------------- */
@ -408,9 +410,17 @@ int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc,
void isoburn_version(int *major, int *minor, int *micro)
{
*major= isoburn_header_version_major;
*minor= isoburn_header_version_minor;
*micro= isoburn_header_version_micro;
/* No more: values from version.h generated from version.h.in and
macro values defined in configure.ac
*major = ISOBURN_MAJOR_VERSION;
*minor = ISOBURN_MINOR_VERSION;
*micro = ISOBURN_MICRO_VERSION;
*/
}

View File

@ -116,24 +116,65 @@ eventual multi-session emulation.
int isoburn_initialize(char msg[1024], int flag);
/** Obtain the three release version numbers of the library.
/** Check whether all features of header file libisoburn.h from the given
major.minor.micro revision triple can be delivered by the library version
which is performing this call.
An application of libisoburn can easily memorize the version of the
libisofs.h header in its own code. Immediately after isoburn_initialize()
it should simply do this check:
if (! isoburn_is_compatible(isoburn_header_version_major,
isoburn_header_version_minor,
isoburn_header_version_micro, 0))
...refuse to start the program with this dynamic library version...
@param major obtained at build time
@param minor obtained at build time
@param micro obtained at build time
@param flag Bitfield for control purposes. Unused yet. Submit 0.
@return 1= library can work for caller
0= library is not usable in some aspects. Caller must restrict
itself to an earlier API version or must not use this libray
at all.
*/
int isoburn_is_compatible(int major, int minor, int micro, int flag);
/** These three release version numbers tell the revision of this header file
and of the API it describes. They are memorized by applications at build
time.
*/
#define isoburn_header_version_major 0
#define isoburn_header_version_minor 0
#define isoburn_header_version_micro 1
/** Note:
Above version numbers are also recorded in configure.ac because libtool
wants them as parameters at build time.
For the library compatibility check ISOBURN_*_VERSION in configure.ac
are not decisive. Only the three numbers above do matter.
*/
/** Obtain the three release version numbers of the library. These are the
numbers encountered by the application when linking with lisbisoburn,
i.e. possibly not before run time.
Better do not base the fundamental compatibility decision of an application
on these numbers. For a reliable check use isoburn_is_compatible().
@param major The maturity version (0 for now, as we are still learning)
@param minor The development goal version.
@param micro The development step version. This has an additional meaning:
Pare numbers indicate a version with frozen API. I.e. you can
rely on the same set of features to be present in all
published releases with that major.minor.micro combination.
Odd numbers indicate that API upgrades are in progress.
I.e. new features might be already present or they might
be still missing. You need to check before compiling an
application which relies on freshly introduced features.
be still missing.
So micro revisions {1,3,5,7,9} should never be used for
dynamic linking unless the proper library match can be
guaranteed by external circumstances.
*/
void isoburn_version(int *major, int *minor, int *micro);
/* >>> isoburn_is_compatible() */
/** Aquire a target drive by its filesystem path resp. libburn persistent
address.
Wrapper for: burn_drive_scan_and_grab()
@ -411,7 +452,7 @@ int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o,
int *replace_uid, int *replace_gid,
uid_t *uid, gid_t *gid);
/** Set this to NULL to use the default charset.
/** Set this to NULL to use the default output charset.
>>> What if not NULL or not want default ?
*/
int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o,

View File

@ -1,3 +1,6 @@
/* <<< this file is on its way out
#define ISOBURN_MAJOR_VERSION @ISOBURN_MAJOR_VERSION@
#define ISOBURN_MINOR_VERSION @ISOBURN_MINOR_VERSION@
#define ISOBURN_MICRO_VERSION @ISOBURN_MICRO_VERSION@
*/

View File

@ -9,24 +9,30 @@ AM_INIT_AUTOMAKE([subdir-objects])
BURN_MAJOR_VERSION=0
BURN_MINOR_VERSION=4
BURN_MICRO_VERSION=1
BURN_MICRO_VERSION=3
AC_SUBST(BURN_MAJOR_VERSION)
AC_SUBST(BURN_MINOR_VERSION)
AC_SUBST(BURN_MICRO_VERSION)
LIBISOFS_MAJOR_VERSION=0
LIBISOFS_MINOR_VERSION=5
LIBISOFS_MICRO_VERSION=0
LIBISOFS_MINOR_VERSION=6
LIBISOFS_MICRO_VERSION=1
AC_SUBST(LIBISOFS_MAJOR_VERSION)
AC_SUBST(LIBISOFS_MINOR_VERSION)
AC_SUBST(LIBISOFS_MICRO_VERSION)
ISOBURN_MAJOR_VERSION=0
ISOBURN_MINOR_VERSION=0
ISOBURN_MICRO_VERSION=1
AC_SUBST(ISOBURN_MAJOR_VERSION)
AC_SUBST(ISOBURN_MINOR_VERSION)
AC_SUBST(ISOBURN_MICRO_VERSION)
dnl The API version codes are now defined in libisoburn/libisoburn.h
dnl #define isoburn_header_version_*
dnl configure.ac only rules the libtool revision numbering about
dnl LT_CURREN, LT_AGE, LT_REVISION where SONAME becomes LT_CURRENT - LT_AGE
dnl
dnl These three are only copies to provide libtool with unused LT_RELEASE
dnl ISOBURN_MAJOR_VERSION=0
dnl ISOBURN_MINOR_VERSION=0
dnl ISOBURN_MICRO_VERSION=1
dnl AC_SUBST(ISOBURN_MAJOR_VERSION)
dnl AC_SUBST(ISOBURN_MINOR_VERSION)
dnl AC_SUBST(ISOBURN_MICRO_VERSION)
AC_PREFIX_DEFAULT([/usr/local])
@ -61,6 +67,18 @@ AC_CHECK_MEMBER([struct tm.tm_gmtoff],
,
[#include <time.h>])
dnl Check if non standard timegm() function is available
AC_CHECK_DECL([timegm],
[AC_DEFINE(HAVE_TIMEGM, 1, [Define this if timegm function is available])],
,
[#include <time.h>])
dnl Check if non standard eaccess() function is available
AC_CHECK_DECL([eaccess],
[AC_DEFINE(HAVE_EACCESS, 1, [Define this if eaccess function is available])],
,
[#include <unistd.h>])
THREAD_LIBS=-lpthread
AC_SUBST(THREAD_LIBS)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.01.29.125956"
#define Xorriso_timestamP "2008.01.29.184356"

View File

@ -76,7 +76,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
{
int ret;
int ret, major, minor, micro;
char *handler_prefix= NULL;
char *queue_sev, *print_sev, reason[1024];
@ -101,6 +101,19 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
free(handler_prefix);
return(0);
}
ret= isoburn_is_compatible(isoburn_header_version_major,
isoburn_header_version_minor,
isoburn_header_version_micro, 0);
if(ret<=0) {
isoburn_version(&major, &minor, &micro);
sprintf(xorriso->info_text,
"libisoburn version too old: %d.%d.%d . Need at least: %d.%d.%d .\n",
major, minor, micro,
isoburn_header_version_major, isoburn_header_version_minor,
isoburn_header_version_micro);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
return(-1);
}
if(reason[0]) {
sprintf(xorriso->info_text, "%s", reason);