All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: linux-sctp@vger.kernel.org
Subject: Re: [Lksctp-developers] [RFC PATCH] [SCTP]: Support the new specification
Date: Fri, 11 Apr 2008 19:56:11 +0000	[thread overview]
Message-ID: <47FFC25B.1090008@hp.com> (raw)
In-Reply-To: <47F2AD4E.8000203@hp.com>

Ivan Skytte Jørgensen wrote:
> On Friday 11 April 2008 15:20:44 Vlad Yasevich wrote:
>> Here is an update to the connectx() implementation the way
>> Ivan proposed.
> 
> The patch looks fine.
> 
>> The hard part to figure out is how to not break the library
>> ABI.  Right now there is really no way to do that without making
>> it a compile time feature for the library.  That is not really
>> an acceptable solution though.  So any ifdefs tricks will not
>> really solve the issue.
> 
> 
> For the user-level library I assume something like this will work:
> 
> ---connect.c---
> int connectx(void) {
> 	return 13; /*old implementation*/
> }
> 
> int connectx_draft14(void) {
> 	return 14; /*new implementation*/
> }
> ---sctp.h---
> #ifndef SCTP_DRAFT13_CONNECTX
> extern int connectx(void) asm ("connectx_draft14");
> #else
> extern int connectx(void);
> #endif

The problem is that the number of parameters to connectx() differs.

This also means that any application attempting to rebuild with with
the new library, but using an old API, will have to change.
I don't know if we can get away this.

Also, who defines SCTP_DRAFT13_CONNECTX or SCTP_DRAFT14_CONNECTX, depending
on how ifdef is written?

It's a non-starter to do that for applications.

If we put that in netinet/sctp.h, then simply by recompiling against the newer
header, you have to change your program to comply to the new symbol without ability
to use the older one.

> ---example program---
> #include <stdio.h>
> int main(void) {
> 	printf("%d\n",connectx());
> 	return 0;
> }
> ---end
> 
> I think the solution above fulfills:
> - old programs continue to use the old function, even if a new library is 
> present.
> 	-	new programs will use the new API.
> 	-	new programs can use the old API if they are in a hurry to recompile and 
> don't have the time to change their source files.
> 	-	new programs will fail to run (hard) if only the old API is available
> 	-	a program can use both APIs (eg. though shared libraries etc)
> 	-	and last: new programs don't have to do anything extra to to use the new 
> API.
> 
> There are other ways to do it, eg. with symbol versioning, with macro 
> definitions, inline functions, etc. I can see that glibc uses internal symbol 
> versioning. I don't know if there is any downside to use the asm("...."). 
> Both gcc and icc supports it.
> 

I guess I have to figure out symbol versioning since I think anything else
falls short.

Of course we can just swallow the whole incompatibility thing and break the API/ABI
stating that you must change your apps.

-vlad

  parent reply	other threads:[~2008-04-11 19:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 21:46 [Lksctp-developers] [RFC PATCH] [SCTP]: Support the new specification Vlad Yasevich
2008-04-01 22:42 ` [Lksctp-developers] [RFC PATCH] [SCTP]: Support the new specification of sctp Ivan Skytte Jørgensen
2008-04-02 15:50 ` [Lksctp-developers] [RFC PATCH] [SCTP]: Support the new specification Vlad Yasevich
2008-04-11 19:56 ` Vlad Yasevich [this message]
2008-04-12 11:11 ` [Lksctp-developers] [RFC PATCH] [SCTP]: Support the new specification of sctp_connectx() Ivan Skytte Jørgensen
2008-04-14  1:13 ` [Lksctp-developers] [RFC PATCH] [SCTP]: Support the new specification Vlad Yasevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47FFC25B.1090008@hp.com \
    --to=vladislav.yasevich@hp.com \
    --cc=linux-sctp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.