From: Greg KH <greg@kroah.com>
To: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>,
kernelnewbies@kernelnewbies.org
Subject: Re: ioctl number change / backwards compatibility doubt
Date: Wed, 16 Mar 2022 15:07:40 +0100 [thread overview]
Message-ID: <YjHvLFSV06w/ORgV@kroah.com> (raw)
In-Reply-To: <Yivj2tFWnFOmaSmx@mail.google.com>
On Sat, Mar 12, 2022 at 01:05:46PM +1300, Paulo Miguel Almeida wrote:
> On Mon, Jan 24, 2022 at 07:20:45AM +0100, Greg KH wrote:
> > On Mon, Jan 24, 2022 at 05:49:06PM +1300, Paulo Miguel Almeida wrote:
> > > On Sun, Jan 23, 2022 at 12:04:48PM +0100, Greg KH wrote:
> > >
> > > when you told me to look for the userspace tool that interfaced with the
> > > ioctl, my interpretation was that you were referring to something akin
> > > to what /usr/bin/uname utility is to the syscall uname. Please correct me
> > > if I'm wrong.
> > >
> > > re: what calls the ioctl created by the driver.
> > >
> > > I'm led to believe that users of this driver make ioctl sycall
> > > invocations directly from their application's source code like this:
> > >
> > > #include "pi433_if.h" /* userspace driver header */
> > > #include <sys/ioctl.h> /* ioctl */
> > >
> > > int file_desc = open("/dev/pi433.0", O_RDWR);
> > > struct pi433_tx_cfg tx_cfg = {
> > > .frequency = 433000000,
> > > .bit_rate = 4800,
> > > <omitted for brevity>...
> > > };
> > >
> > > int ret_val = ioctl(file_desc, PI433_IOC_WR_TX_CFG, tx_cfg);
> > > ....
> >
> > Yes, sorry for the confusion, this is what I am referring to. Where is
> > that userspace code as that is the code you will be needing to change if
> > you want to change this ioctl interface.
> >
> > thanks,
> >
> > greg k-h
>
> Hi Greg,
>
> The original author replied my email with that question. He sent me
> some the code used to interface with char device, however, the source
> code he provided me is already incompatible with the current version of
> the driver:
>
> #include "rfxx.h" (file header name has changed)
>
> int main(int argc, char *argv[])
> {
> ...
> struct rfxx_send_config sendConfig; (struct name has changed)
> ...
> fd = open("/dev/rf69_0.0", O_RDWR); *(char device name changed)*
> ...
> sendConfig.data_mode = packet; *(property doesn't exist)*
> ...
> (IOCTL call has a different name)
> ret = ioctl(fd, RFXX_IOC_WR_SEND_CONFIG, &sendConfig);
> if (ret == -1)
> ...
> }
>
> Assuming that I tweak these tools he provided me with and publish them,
> will I then be able to tweak the structures passed back and forth via
> ioctl? (do I need to change ioctl number in this case?)
>
> The reason why I'm asking this is because given the fact that other
> developers could have written similar code for interfacing with the
> driver (and that we will never know because code is proprietary), I
> won't be sure that I've changed all occurences at the same time, right?
>
> All in all, please correct if there are gaps in this train of thought.
>
> - If a change doesn't break *compiled* code (such as struct renaming)
> then it's 'okay' to make the change ? (this has happened in the this
> driver before)
For staging drivers, the user/kernel api usually needs to be changed, so
yes, as long as you can change the tools that are being used to talk to
this api, you should be fine.
thanks,
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
prev parent reply other threads:[~2022-03-16 14:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 7:01 ioctl number change / backwards compatibility doubt Paulo Miguel Almeida
2022-01-17 12:58 ` Greg KH
2022-01-23 7:55 ` Paulo Miguel Almeida
2022-01-23 11:04 ` Greg KH
2022-01-24 4:49 ` Paulo Miguel Almeida
2022-01-24 6:20 ` Greg KH
2022-03-12 0:05 ` Paulo Miguel Almeida
2022-03-14 12:30 ` Rogério Valentim Feitoza da Silva
2022-03-16 14:07 ` Greg KH [this message]
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=YjHvLFSV06w/ORgV@kroah.com \
--to=greg@kroah.com \
--cc=kernelnewbies@kernelnewbies.org \
--cc=paulo.miguel.almeida.rodenas@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).