[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110601172412.761ff799@schlenkerla.am.freescale.net>
Date: Wed, 1 Jun 2011 17:24:12 -0500
From: Scott Wood <scottwood@...escale.com>
To: Arnd Bergmann <arnd@...db.de>
CC: Timur Tabi <timur@...escale.com>, <kumar.gala@...escale.com>,
<linux-kernel@...r.kernel.org>, <akpm@...nel.org>,
<linux-console@...r.kernel.org>, <greg@...ah.com>,
<linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor
management driver
On Wed, 1 Jun 2011 23:40:14 +0200
Arnd Bergmann <arnd@...db.de> wrote:
> > +static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
> > +{
> > + struct fsl_hv_ioctl_prop param;
> > + char __user *upath, *upropname;
> > + void __user *upropval;
> > + char *path = NULL, *propname = NULL;
> > + void *propval = NULL;
> > + int ret = 0;
> > +
>
> I'm not convinced that an ioctl interface is the right way to work with
> device tree properties. A more natural way would be to export it as
> a file system, or maybe as a flattened device tree blob (the latter option
> would require changing the hypervisor interface, which might not be
> possible).
I wanted to have the hypervisor take an update dtb (we already have special
meta-properties for things like deletion as part of the hv config
mechanism). But others on the project wanted to keep it simple, and so
get/set property it was. :-/
It's unlikely to change at this point without a real need.
As for a filesystem interface, it's not a good match either. You can't
iterate over anything to read out the full tree from the hv. You can't
delete anything. You can't create empty nodes. The hv interface was meant
to enable some specific management actions, rather than to provide general
device tree access. This driver is a thin wrapper around the management
hcalls.
There would still be other ioctls needed for starting/stopping the
partition, etc.
> > +/**
> > + * fsl_hv_ioctl: ioctl main entry point
> > + */
> > +static long fsl_hv_ioctl(struct file *file, unsigned int cmd,
> > + unsigned long argaddr)
> > +{
> > + union fsl_hv_ioctl_param __user *arg =
> > + (union fsl_hv_ioctl_param __user *)argaddr;
> > + long ret;
> > +
>
> For an ioctl, please follow the normal pattern of defining a separate
> structure for each case, no union.
And have fsl_hypervisor.h provide the full set of proper ioctl numbers, with
the specific struct for each ioctl referenced, rather than having the client program do
"ioctl(f, _IOWR(0, cmd, union fsl_hv_ioctl_param), p)".
-Scott
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists