All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Paul Fulghum <paulkf@microgate.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] synclink_gt add compat_ioctl
Date: Sun, 6 May 2007 02:27:28 +0200	[thread overview]
Message-ID: <200705060227.29450.arnd@arndb.de> (raw)
In-Reply-To: <463C8D42.7020707@microgate.com>

On Saturday 05 May 2007, Paul Fulghum wrote:

> That declaration will need to be duplicated in each driver that
> uses it (4 drivers in my case). In that sense (a structure declaration
> used by multiple code modules) it does seem like an interface definition.
> 
> If that is what is needed, I will do it.

Now that you mention the duplication, this sounds wrong as well. The easiest
solution is probably to just put the definition of your data structure
inside of #ifdef CONFIG_COMPAT in the header file.

Or you could go really fancy and write a new file that does the synclink
compat_ioctl handling in a generic way end in the end just calls the
fops->{unlocked_,}ioctl() function.

Which reminds me that I have been meaning to do a patch that creates
a new generic_compat_ioctl() [1] function for some time, and convert
drivers to this if their handlers are all compatible.

	Arnd <><

[1]
/*
 * Can be used as the ->compat_ioctl method in the file_operations
 * for any driver that does not need any conversion in its ioctl
 * handler
 */
long generic_file_compat_ioctl(struct file *file, unsigned int cmd,
				unsigned long arg)
{
	int ret;
	arg = (unsigned long)compat_ptr(arg);

	if (file->f_ops->unlocked_ioctl)
		ret = file->f_ops->unlocked_ioctl(file, cmd, arg);
	else {
		lock_kernel();
		ret = file->f_ops->ioctl(file, cmd, arg);
		unlock_kernel();
	} else
		ret = -ENOIOCTLCMD;

	return ret;
}

  reply	other threads:[~2007-05-06  0:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 18:01 [PATCH] synclink_gt add compat_ioctl Paul Fulghum
2007-05-04  0:53 ` Andrew Morton
2007-05-04 21:08   ` Paul Fulghum
2007-05-05 10:58     ` Arnd Bergmann
2007-05-05 13:57       ` Paul Fulghum
2007-05-06  0:27         ` Arnd Bergmann [this message]
2007-05-08 21:14           ` Paul Fulghum
2007-05-08 22:07             ` Arnd Bergmann
2007-05-08 23:19               ` Paul Fulghum
2007-05-05  0:48 ` Andrew Morton
2007-05-04 19:08   ` Paul Fulghum
  -- strict thread matches above, loose matches on Subject: below --
2007-05-09 16:19 Paul Fulghum
2007-05-02 20:21 Paul Fulghum
2007-05-02 22:09 ` Arnd Bergmann
2007-05-02 23:39   ` Paul Fulghum
2007-05-02 22:47     ` Arnd Bergmann
2007-05-03  0:05       ` Paul Fulghum

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=200705060227.29450.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulkf@microgate.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 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.