[PATCH 2/4] fs: devfs: Allow mount path in cdev_open

Sascha Hauer s.hauer at pengutronix.de
Tue Oct 13 01:25:39 PDT 2015


On Tue, Oct 13, 2015 at 09:51:52AM +0200, Sascha Hauer wrote:
> When opening a cdev also allow a path beginning with /dev/ as some
> users of cdev_open already open coded this behaviour.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  fs/devfs-core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/devfs-core.c b/fs/devfs-core.c
> index 62571fb..26f56d9 100644
> --- a/fs/devfs-core.c
> +++ b/fs/devfs-core.c
> @@ -121,9 +121,13 @@ int cdev_do_open(struct cdev *cdev, unsigned long flags)
>  
>  struct cdev *cdev_open(const char *name, unsigned long flags)
>  {
> -	struct cdev *cdev = cdev_by_name(name);
> +	struct cdev *cdev;
>  	int ret;
>  
> +	if (strncmp(name, "/dev/", 5))
> +		name += 5;

And with the missing '!' before strncmp this works as expected.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list