All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernard Pidoux F6BVP <f6bvp@free.fr>
To: Bernard Pidoux <bpidoux@free.fr>
Cc: David Miller <davem@davemloft.net>,
	ralf@linux-mips.org, linux-hams@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] ax25.h unsigned long type for ax25 timers
Date: Fri, 20 Jun 2008 15:17:39 +0200	[thread overview]
Message-ID: <485BADF3.10704@free.fr> (raw)
In-Reply-To: <485ADFDF.1070509@free.fr>

There have been in the past already some modifications of 
ax25_info_struct and the old one was renamed deprecated.

/* this will go away. Please do not export to user land */
struct ax25_info_struct_deprecated {
         unsigned int    n2, n2count;
         unsigned int    t1, t1timer;
         unsigned int    t2, t2timer;
         unsigned int    t3, t3timer;
         unsigned int    idle, idletimer;
         unsigned int    state;
         unsigned int    rcv_q, snd_q;
};

Three new items were included :

...
         unsigned int    vs, vr, va, vs_max;
         unsigned int    paclen;
         unsigned int    window;
};

At the same time  case SIOCAX25GETINFOOLD:
was added in ax25_ioctl()
and would trigger a warning message.


  /* old structure? */
                 if (cmd == SIOCAX25GETINFOOLD) {
                         static int warned = 0;
                         if (!warned) {
                                 printk(KERN_INFO "%s uses old 
SIOCAX25GETINFO\n",
                                         current->comm);
                                 warned=1;
                         }

                         if (copy_to_user(argp, &ax25_info, 
sizeof(struct ax25_info_struct_deprecated))) {
                                 res = -EFAULT;
                                 break;
                         }
                 } else {
                         if (copy_to_user(argp, &ax25_info, 
sizeof(struct ax25_info_struct))) {
                                 res = -EINVAL;
                                 break;
                         }
                 }
                 res = 0;
                 break;

Here is my question :

Can't we remove the probably quite old ax25_info_struct_deprecated 
structure, and rename the present ax25_info_struct, 
ax25_info_struct_deprecated, then create the new ax25_info_struct with 
resized timers unsigned long ?

The second solution is to declare a new structure

* new ax25 info struct */
struct ax25_info_long_timers_struct {
         unsigned int    n2, n2count;
         unsigned long   t1, t1timer;
         unsigned long   t2, t2timer;
         unsigned long   t3, t3timer;
         unsigned long   idle, idletimer;
         unsigned int    state;
         unsigned int    rcv_q, snd_q;
         unsigned int    vs, vr, va, vs_max;
         unsigned int    paclen;
         unsigned int    window;
};

adding another case SIOCAX25GETNEWINFO
that would be defined
#define SIOCAX25GETNEWINFO         (SIOCPROTOPRIVATE+14)

and trigger warning message by calls to SIOCAX25GETINFOOLD and
SIOCAX25GETINFO.

It that the right way to do it ?


Bernard, f6bvp



Bernard Pidoux wrote:
> David,
> 
> Your explanation is perfectly clear and I understand the problem now.
> Thank you very much for taking the time to explain me that.
> 
> Bernard Pidoux
> 
> 
> 
> 
> David Miller wrote:
>> From: Bernard Pidoux <bpidoux@free.fr>
>> Date: Thu, 19 Jun 2008 18:28:46 +0200
>>
>>> Unfortunately I don't quite understand exactly why a structure in 
>>> user space cannot be changed.
>>
>> Because there are userland binaries already compiled out there using
>> the current structure layout.  If we change the kernel, those binaries
>> stop using a datastructure that matches what the kernel is using.
>> Such binaries will break.
>>
>> In generic, because of this, you can never change the layout of a
>> data structure exported to userland as a kernel interface.
>>
>>
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-hams" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2008-06-20 13:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 13:04 [PATCH] ax25.h unsigned long type for ax25 timers Bernard Pidoux
2008-06-18  5:30 ` David Miller
2008-06-19 16:28   ` Bernard Pidoux
2008-06-19 21:46     ` David Miller
2008-06-19 22:38       ` Bernard Pidoux
2008-06-20 13:17         ` Bernard Pidoux F6BVP [this message]
2008-06-28  2:33           ` David Miller
2008-06-19 19:38   ` Al
2008-06-19 20:35     ` Al

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=485BADF3.10704@free.fr \
    --to=f6bvp@free.fr \
    --cc=bpidoux@free.fr \
    --cc=davem@davemloft.net \
    --cc=linux-hams@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.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.