From 2851280824fc21dcbba0a87379459bdf1d1c6ad1 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 12 Jun 2002 02:02:05 +0000 Subject: [PATCH] Add symbol versioning. Versions need to be checked with 0.7.18 release. --- lib/Makefile | 4 ++-- lib/buffer.c | 8 ++++++++ lib/cmd.c | 2 ++ lib/comedi.c | 17 ++++++++++++----- lib/data.c | 6 +++++- lib/dio.c | 4 ++++ lib/error.c | 4 ++++ lib/get.c | 14 ++++++++++++++ lib/libinternal.h | 7 +++++++ lib/range.c | 8 ++++++++ lib/sv.c | 4 +++- lib/timed.c | 1 + lib/timer.c | 1 + lib/version_script | 23 ++++++++++++++++------- 14 files changed, 87 insertions(+), 16 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 34e5065..ef07fb7 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -9,9 +9,9 @@ OBJS=comedi.o timer.o sv.o range.o ioctl.o filler.o timed.o error.o \ SONAME=libcomedi$(SONAME_SUFFIX).so.0 -libcomedi.a: $(OBJS) +libcomedi.a: $(OBJS) version_script #$(CC) -shared -Wl,-soname,libcomedi.so,-T,version_script -o libcomedi.so.${VERSION_CODE} $(OBJS) -lm - $(CC) -shared -Wl,-soname,$(SONAME) -o libcomedi.so.${version} $(OBJS) -lm + $(CC) -shared -Wl,-soname,$(SONAME) -Wl,--version-script,version_script -o libcomedi.so.${version} $(OBJS) -lm $(AR) rs libcomedi.a $(OBJS) ln -sf libcomedi.so.${version} libcomedi.so ln -sf libcomedi.so.${version} libcomedi.so.0 diff --git a/lib/buffer.c b/lib/buffer.c index 9970a41..394fb6c 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -25,6 +25,7 @@ #include +EXPORT_SYMBOL(comedi_set_buffer_size,0.7.18); int comedi_set_buffer_size(comedi_t *it, unsigned int subdev, unsigned int size) { int ret; @@ -40,6 +41,7 @@ int comedi_set_buffer_size(comedi_t *it, unsigned int subdev, unsigned int size) return bc.size; } +EXPORT_SYMBOL(comedi_set_max_buffer_size,0.7.18); int comedi_set_max_buffer_size(comedi_t *it, unsigned int subdev, unsigned int max_size) { int ret; @@ -55,21 +57,25 @@ int comedi_set_max_buffer_size(comedi_t *it, unsigned int subdev, unsigned int m return bc.maximum_size; } +EXPORT_SYMBOL(comedi_get_max_buffer_size,0.7.18); int comedi_get_max_buffer_size(comedi_t *it, unsigned int subdevice) { return comedi_set_max_buffer_size(it, subdevice, 0); } +EXPORT_SYMBOL(comedi_get_buffer_size,0.7.18); int comedi_get_buffer_size(comedi_t *it, unsigned int subdev) { return comedi_set_buffer_size(it, subdev, 0); } +EXPORT_SYMBOL(comedi_get_buffer_contents,0.7.18); int comedi_get_buffer_contents(comedi_t *it, unsigned int subdev) { return comedi_mark_buffer_read(it, subdev, 0); } +EXPORT_SYMBOL(comedi_mark_buffer_read,0.7.18); int comedi_mark_buffer_read(comedi_t *it, unsigned int subdev, unsigned int bytes) { int ret; @@ -83,6 +89,7 @@ int comedi_mark_buffer_read(comedi_t *it, unsigned int subdev, unsigned int byte return bi.buf_int_count - bi.buf_user_count; } +EXPORT_SYMBOL(comedi_get_buffer_offset,0.7.18); int comedi_get_buffer_offset(comedi_t *it, unsigned int subdev) { int ret; @@ -94,6 +101,7 @@ int comedi_get_buffer_offset(comedi_t *it, unsigned int subdev) return bi.buf_user_ptr; } +EXPORT_SYMBOL(comedi_get_front_count,0.7.18); int comedi_get_front_count(comedi_t *it, unsigned int subdev) { int ret; diff --git a/lib/cmd.c b/lib/cmd.c index 832d83f..21caf0f 100644 --- a/lib/cmd.c +++ b/lib/cmd.c @@ -37,6 +37,7 @@ #include +EXPORT_SYMBOL(comedi_get_cmd_src_mask,0.7.18); int comedi_get_cmd_src_mask(comedi_t *it,unsigned int subd,comedi_cmd *cmd) { subdevice *s; @@ -156,6 +157,7 @@ static int __generic_timed(comedi_t *it,unsigned int s, return -1; } +EXPORT_SYMBOL(comedi_get_cmd_generic_timed,0.7.18); int comedi_get_cmd_generic_timed(comedi_t *it,unsigned int subd,comedi_cmd *cmd, unsigned int ns) { diff --git a/lib/comedi.c b/lib/comedi.c index 8e20fe5..974c9bf 100644 --- a/lib/comedi.c +++ b/lib/comedi.c @@ -49,6 +49,7 @@ INTERNAL void initialize(void) } } +EXPORT_SYMBOL(comedi_open,0.7.18); comedi_t *comedi_open(const char *fn) { comedi_t *it; @@ -82,11 +83,7 @@ cleanup: return NULL; } -#if 0 -/* this is an example of how we do versioned symbols */ -__asm__(".symver comedi_open_0,comedi_open@"); -#endif - +EXPORT_SYMBOL(comedi_open,0.7.18); int comedi_close(comedi_t *it) { subdevice *s; @@ -122,16 +119,19 @@ int comedi_close(comedi_t *it) return 0; } +EXPORT_SYMBOL(comedi_cancel,0.7.18); int comedi_cancel(comedi_t *it,unsigned int subdevice) { return comedi_ioctl(it->fd,COMEDI_CANCEL,subdevice); } +EXPORT_SYMBOL(comedi_poll,0.7.18); int comedi_poll(comedi_t *it,unsigned int subdevice) { return comedi_ioctl(it->fd,COMEDI_POLL,subdevice); } +EXPORT_SYMBOL(comedi_fileno,0.7.18); int comedi_fileno(comedi_t *it) { if(!it) @@ -140,6 +140,7 @@ int comedi_fileno(comedi_t *it) return it->fd; } +EXPORT_SYMBOL(comedi_trigger,0.7.18); int comedi_trigger(comedi_t *it,comedi_trig *t) { if(!it || !t) @@ -148,6 +149,7 @@ int comedi_trigger(comedi_t *it,comedi_trig *t) return comedi_ioctl(it->fd, COMEDI_TRIG, (unsigned long)t); } +EXPORT_SYMBOL(comedi_command,0.7.18); int comedi_command(comedi_t *it,comedi_cmd *t) { int ret; @@ -161,6 +163,7 @@ int comedi_command(comedi_t *it,comedi_cmd *t) return ret; } +EXPORT_SYMBOL(comedi_command_test,0.7.18); int comedi_command_test(comedi_t *it,comedi_cmd *t) { int ret; @@ -174,6 +177,7 @@ int comedi_command_test(comedi_t *it,comedi_cmd *t) return ret; } +EXPORT_SYMBOL(comedi_do_insnlist,0.7.18); int comedi_do_insnlist(comedi_t *it,comedi_insnlist *il) { int ret; @@ -182,6 +186,7 @@ int comedi_do_insnlist(comedi_t *it,comedi_insnlist *il) return ret; } +EXPORT_SYMBOL(comedi_do_insn,0.7.18); int comedi_do_insn(comedi_t *it,comedi_insn *insn) { if(it->has_insn_ioctl){ @@ -200,11 +205,13 @@ int comedi_do_insn(comedi_t *it,comedi_insn *insn) } } +EXPORT_SYMBOL(comedi_lock,0.7.18); int comedi_lock(comedi_t *it,unsigned int subdevice) { return comedi_ioctl(it->fd, COMEDI_LOCK, subdevice); } +EXPORT_SYMBOL(comedi_unlock,0.7.18); int comedi_unlock(comedi_t *it,unsigned int subdevice) { return comedi_ioctl(it->fd, COMEDI_UNLOCK, subdevice); diff --git a/lib/data.c b/lib/data.c index d6d84dc..3133f28 100644 --- a/lib/data.c +++ b/lib/data.c @@ -36,7 +36,7 @@ #include - +EXPORT_SYMBOL(comedi_data_write,0.7.18); int comedi_data_write(comedi_t *it,unsigned int subdev,unsigned int chan,unsigned int range, unsigned int aref,lsampl_t data) { @@ -143,6 +143,7 @@ static inline int comedi_internal_data_read_n(comedi_t *it, } } +EXPORT_SYMBOL(comedi_data_read_n,0.7.19); int comedi_data_read_n(comedi_t *it, unsigned int subdev, unsigned int chan, unsigned int range, unsigned int aref, lsampl_t *data, unsigned int n) @@ -168,6 +169,7 @@ int comedi_data_read_n(comedi_t *it, unsigned int subdev, return 0; } +EXPORT_SYMBOL(comedi_data_read,0.7.18); int comedi_data_read(comedi_t *it, unsigned int subdev, unsigned int chan, unsigned int range, unsigned int aref, lsampl_t *data) { @@ -175,6 +177,7 @@ int comedi_data_read(comedi_t *it, unsigned int subdev, unsigned int chan, CR_PACK(chan, range, aref), data, 1); } +EXPORT_SYMBOL(comedi_data_read_hint,0.7.19); int comedi_data_read_hint(comedi_t *it, unsigned int subdev, unsigned int chan, unsigned int range, unsigned int aref) { @@ -183,6 +186,7 @@ int comedi_data_read_hint(comedi_t *it, unsigned int subdev, CR_PACK(chan, range, aref), &dummy_data, 0); } +EXPORT_SYMBOL(comedi_data_read_delayed,0.7.19); int comedi_data_read_delayed( comedi_t *it, unsigned int subdev, unsigned int chan, unsigned int range, unsigned int aref, lsampl_t *data, unsigned int nano_sec) diff --git a/lib/dio.c b/lib/dio.c index 86b5fa8..37ddc89 100644 --- a/lib/dio.c +++ b/lib/dio.c @@ -35,6 +35,7 @@ #include +EXPORT_SYMBOL(comedi_dio_config,0.7.18); int comedi_dio_config(comedi_t *it,unsigned int subdev,unsigned int chan,unsigned int io) { subdevice *s; @@ -79,6 +80,7 @@ int comedi_dio_config(comedi_t *it,unsigned int subdev,unsigned int chan,unsigne } } +EXPORT_SYMBOL(comedi_dio_read,0.7.18); int comedi_dio_read(comedi_t *it,unsigned int subdev,unsigned int chan, unsigned int *val) { @@ -129,6 +131,7 @@ int comedi_dio_read(comedi_t *it,unsigned int subdev,unsigned int chan, } } +EXPORT_SYMBOL(comedi_dio_write,0.7.18); int comedi_dio_write(comedi_t *it,unsigned int subdev,unsigned int chan, unsigned int val) { @@ -174,6 +177,7 @@ int comedi_dio_write(comedi_t *it,unsigned int subdev,unsigned int chan, } } +EXPORT_SYMBOL(comedi_dio_bitfield,0.7.18); int comedi_dio_bitfield(comedi_t *it,unsigned int subdev,unsigned int mask,unsigned int *bits) { int ret; diff --git a/lib/error.c b/lib/error.c index 4093f31..a6abcb7 100644 --- a/lib/error.c +++ b/lib/error.c @@ -43,6 +43,7 @@ char *__comedilib_error_strings[]={ int __comedi_loglevel=1; int __comedi_errno=0; +EXPORT_SYMBOL(comedi_loglevel,0.7.18); int comedi_loglevel(int loglevel) { int old_loglevel=__comedi_loglevel; @@ -52,11 +53,13 @@ int comedi_loglevel(int loglevel) return old_loglevel; } +EXPORT_SYMBOL(comedi_errno,0.7.18); int comedi_errno(void) { return __comedi_errno; } +EXPORT_SYMBOL(comedi_strerr,0.7.18); char *comedi_strerror(int errnum) { if(errnum=COMEDI_NOERROR+n_errors) @@ -65,6 +68,7 @@ char *comedi_strerror(int errnum) return _(__comedilib_error_strings[errnum-COMEDI_NOERROR]); } +EXPORT_SYMBOL(comedi_perror,0.7.18); void comedi_perror(const char *s) { if(__comedi_loglevel>=3){ diff --git a/lib/get.c b/lib/get.c index 0063a70..082ed36 100644 --- a/lib/get.c +++ b/lib/get.c @@ -36,6 +36,7 @@ #include +EXPORT_SYMBOL(comedi_get_n_subdevices,0.7.18); int comedi_get_n_subdevices(comedi_t *it) { if(!valid_dev(it)) @@ -44,6 +45,7 @@ int comedi_get_n_subdevices(comedi_t *it) return it->n_subdevices; } +EXPORT_SYMBOL(comedi_get_version_code,0.7.18); int comedi_get_version_code(comedi_t *it) { if(!valid_dev(it)) @@ -52,6 +54,7 @@ int comedi_get_version_code(comedi_t *it) return it->devinfo.version_code; } +EXPORT_SYMBOL(comedi_get_driver_name,0.7.18); char *comedi_get_driver_name(comedi_t *it) { if(!valid_dev(it)) @@ -60,6 +63,7 @@ char *comedi_get_driver_name(comedi_t *it) return it->devinfo.driver_name; } +EXPORT_SYMBOL(comedi_get_board_name,0.7.18); char *comedi_get_board_name(comedi_t *it) { if(!valid_dev(it)) @@ -68,6 +72,7 @@ char *comedi_get_board_name(comedi_t *it) return it->devinfo.board_name; } +EXPORT_SYMBOL(comedi_get_subdevice_flags,0.7.18); int comedi_get_subdevice_flags(comedi_t *it,unsigned int subd) { if(!valid_dev(it)) @@ -76,6 +81,7 @@ int comedi_get_subdevice_flags(comedi_t *it,unsigned int subd) return it->subdevices[subd].subd_flags; } +EXPORT_SYMBOL(comedi_get_subdevice_type,0.7.18); int comedi_get_subdevice_type(comedi_t *it,unsigned int subd) { if(!valid_dev(it)) @@ -84,6 +90,7 @@ int comedi_get_subdevice_type(comedi_t *it,unsigned int subd) return it->subdevices[subd].type; } +EXPORT_SYMBOL(comedi_get_subdevice_type,0.7.18); int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int subd) { if(!valid_subd(it,subd)) @@ -96,6 +103,7 @@ int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int subd) return -1; } +EXPORT_SYMBOL(comedi_get_read_subdevice,0.7.18); int comedi_get_read_subdevice(comedi_t *dev) { if(!valid_dev(dev)) @@ -104,6 +112,7 @@ int comedi_get_read_subdevice(comedi_t *dev) return dev->devinfo.read_subdevice; } +EXPORT_SYMBOL(comedi_get_write_subdevice,0.7.18); int comedi_get_write_subdevice(comedi_t *dev) { if(!valid_dev(dev)) @@ -112,6 +121,7 @@ int comedi_get_write_subdevice(comedi_t *dev) return dev->devinfo.write_subdevice; } +EXPORT_SYMBOL(comedi_get_n_channels,0.7.18); int comedi_get_n_channels(comedi_t *it,unsigned int subd) { if(!valid_subd(it,subd)) @@ -123,6 +133,7 @@ int comedi_get_n_channels(comedi_t *it,unsigned int subd) /* */ +EXPORT_SYMBOL(comedi_get_maxdata,0.7.18); lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int subdevice,unsigned int chan) { if(!valid_chan(it,subdevice,chan)) @@ -134,6 +145,7 @@ lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int subdevice,unsigned int cha return it->subdevices[subdevice].maxdata; } +EXPORT_SYMBOL(comedi_maxdata_is_chan_specific,0.7.18); int comedi_maxdata_is_chan_specific(comedi_t *it,unsigned int subdevice) { if(it->subdevices[subdevice].maxdata_list) @@ -141,6 +153,7 @@ int comedi_maxdata_is_chan_specific(comedi_t *it,unsigned int subdevice) return 0; } +EXPORT_SYMBOL(comedi_get_rangetype,0.7.18); int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan) { if(!valid_chan(it,subdevice,chan)) @@ -153,6 +166,7 @@ int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan) } +EXPORT_SYMBOL(comedi_get_range,0.7.18); comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int range) { int range_type; diff --git a/lib/libinternal.h b/lib/libinternal.h index 18cd09f..9095ea8 100644 --- a/lib/libinternal.h +++ b/lib/libinternal.h @@ -59,6 +59,13 @@ #define COMEDILIB_MAGIC 0xc001dafe +/* handle versioning */ + +#define EXPORT_SYMBOL(a,b) __asm__(".symver " #a "," #a "@v" #b ) +#define EXPORT_ALIAS_VER(a,b,c) __asm__(".symver " #a "," #b "@v" #c ) +#define EXPORT_ALIAS_DEFAULT(a,b,c) __asm__(".symver " #a "," #b "@@v" #c ) + + extern int __comedi_init; extern int __comedi_loglevel; extern int __comedi_errno; diff --git a/lib/range.c b/lib/range.c index de2b92e..a526d82 100644 --- a/lib/range.c +++ b/lib/range.c @@ -51,6 +51,7 @@ static enum comedi_oor_behavior comedi_oor_is_nan = COMEDI_OOR_NAN; +EXPORT_SYMBOL(comedi_set_global_oor_behavior,0.7.18); enum comedi_oor_behavior comedi_set_global_oor_behavior( enum comedi_oor_behavior behavior) { @@ -62,6 +63,7 @@ enum comedi_oor_behavior comedi_set_global_oor_behavior( } +EXPORT_SYMBOL(comedi_to_phys,0.7.18); double comedi_to_phys(lsampl_t data,comedi_range *rng,lsampl_t maxdata) { double x; @@ -80,6 +82,7 @@ double comedi_to_phys(lsampl_t data,comedi_range *rng,lsampl_t maxdata) return x; } +EXPORT_SYMBOL(comedi_from_phys,0.7.18); lsampl_t comedi_from_phys(double data,comedi_range *rng,lsampl_t maxdata) { double s; @@ -94,6 +97,7 @@ lsampl_t comedi_from_phys(double data,comedi_range *rng,lsampl_t maxdata) return (lsampl_t)(floor(s+0.5)); } +EXPORT_SYMBOL(comedi_find_range,0.7.18); int comedi_find_range(comedi_t *it,unsigned int subd,unsigned int chan,unsigned int unit,double min,double max) { unsigned int range_type; @@ -119,6 +123,7 @@ int comedi_find_range(comedi_t *it,unsigned int subd,unsigned int chan,unsigned return best; } +EXPORT_SYMBOL(comedi_get_n_ranges,0.7.18); int comedi_get_n_ranges(comedi_t *it,unsigned int subd,unsigned int chan) { unsigned int range_type; @@ -129,11 +134,13 @@ int comedi_get_n_ranges(comedi_t *it,unsigned int subd,unsigned int chan) return RANGE_LENGTH(range_type); } +EXPORT_SYMBOL(comedi_range_is_chan_specific,0.7.18); int comedi_range_is_chan_specific(comedi_t *it,unsigned int subd) { return (it->subdevices[subd].subd_flags&SDF_RANGETYPE)?1:0; } +EXPORT_SYMBOL(comedi_sampl_to_phys,0.7.19); int comedi_sampl_to_phys(double *dest, int dst_stride, sampl_t *src, int src_stride, comedi_range *rng, lsampl_t maxdata, int n) { @@ -170,6 +177,7 @@ int comedi_sampl_to_phys(double *dest, int dst_stride, sampl_t *src, return oor; } +EXPORT_SYMBOL(comedi_sampl_from_phys,0.7.19); int comedi_sampl_from_phys(sampl_t *dest,int dst_stride,double *src, int src_stride, comedi_range *rng, lsampl_t maxdata, int n) { diff --git a/lib/sv.c b/lib/sv.c index 6bdb7c4..7d98e01 100644 --- a/lib/sv.c +++ b/lib/sv.c @@ -40,7 +40,7 @@ int sv_measure_l(comedi_sv_t *it,double *data); int sv_measure_s(comedi_sv_t *it,double *data); - +EXPORT_SYMBOL(comedi_sv_init,0.7.18); int comedi_sv_init(comedi_sv_t *it,comedi_t *dev,unsigned int subd,unsigned int chan) { if(!valid_chan(dev,subd,chan))return -1; @@ -56,6 +56,7 @@ int comedi_sv_init(comedi_sv_t *it,comedi_t *dev,unsigned int subd,unsigned int return comedi_sv_update(it); } +EXPORT_SYMBOL(comedi_sv_update,0.7.18); int comedi_sv_update(comedi_sv_t *it) { if(!it)return -1; @@ -69,6 +70,7 @@ int comedi_sv_update(comedi_sv_t *it) return 0; } +EXPORT_SYMBOL(comedi_sv_measure,0.7.18); int comedi_sv_measure(comedi_sv_t *it,double *data) { if(it->dev->subdevices[it->subdevice].subd_flags & SDF_LSAMPL){ diff --git a/lib/timed.c b/lib/timed.c index 6291fef..befd5b8 100644 --- a/lib/timed.c +++ b/lib/timed.c @@ -38,6 +38,7 @@ #define BUFSZ 100 +EXPORT_SYMBOL(comedi_timed_1chan,0.7.18); int comedi_timed_1chan(comedi_t *dev,unsigned int subd,unsigned int chan,unsigned int range, unsigned int aref,double freq,unsigned int n_samples,double *data) { diff --git a/lib/timer.c b/lib/timer.c index dc2817e..285cc98 100644 --- a/lib/timer.c +++ b/lib/timer.c @@ -142,6 +142,7 @@ static timerfunc timer_functions[]={ }; #define N_TIMERTYPES 6 +EXPORT_SYMBOL(comedi_get_timer,0.7.18); int comedi_get_timer(comedi_t *it,unsigned int subdev,double freq, unsigned int *trigvar,double *actual_freq) { diff --git a/lib/version_script b/lib/version_script index 9b2c0a7..2f3b360 100644 --- a/lib/version_script +++ b/lib/version_script @@ -1,11 +1,20 @@ -VERSION{ - -v0.7.0{ - global: - comedi_*; +v0.7.18 { local: - *; + _comedi_*; + get_rangeinfo; + get_subdevices; + initialize; + internal_error; + libc_error; + sv_measure_l; + sv_measure_s; + valid_chan; + valid_dev; + valid_subd; }; -} +v0.7.19 { + +} v0.7.18; + -- 2.26.2