Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	Trond Myklebust <trond.myklebust@hammerspace.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 4/5] alpha: simplify osf_mount
Date: Sun, 11 Oct 2020 07:22:55 -0700	[thread overview]
Message-ID: <20201011142255.GA203430@roeck-us.net> (raw)
In-Reply-To: <20200917082236.2518236-5-hch@lst.de>

On Thu, Sep 17, 2020 at 10:22:35AM +0200, Christoph Hellwig wrote:
> Merge the mount_args structures and mount helpers to simplify the code a
> bit.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/alpha/kernel/osf_sys.c | 111 +++++++++---------------------------
>  1 file changed, 28 insertions(+), 83 deletions(-)
> 
> diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
> index d5367a1c6300c1..5fd155b13503b5 100644
> --- a/arch/alpha/kernel/osf_sys.c
> +++ b/arch/alpha/kernel/osf_sys.c
> @@ -421,109 +421,54 @@ SYSCALL_DEFINE3(osf_fstatfs64, unsigned long, fd,
>   *
>   * Although to be frank, neither are the native Linux/i386 ones..
>   */
> -struct ufs_args {
> +struct osf_mount_args {
>  	char __user *devname;
>  	int flags;
>  	uid_t exroot;
> +	/* this has lots more here for cdfs at least, but we don't bother */
>  };
>  
> -struct cdfs_args {
> -	char __user *devname;
> -	int flags;
> -	uid_t exroot;
> -
> -	/* This has lots more here, which Linux handles with the option block
> -	   but I'm too lazy to do the translation into ASCII.  */
> -};
> -
> -struct procfs_args {
> -	char __user *devname;
> -	int flags;
> -	uid_t exroot;
> -};
> -
> -/*
> - * We can't actually handle ufs yet, so we translate UFS mounts to
> - * ext2fs mounts. I wouldn't mind a UFS filesystem, but the UFS
> - * layout is so braindead it's a major headache doing it.
> - *
> - * Just how long ago was it written? OTOH our UFS driver may be still
> - * unhappy with OSF UFS. [CHECKME]
> - */
> -static int
> -osf_ufs_mount(const char __user *dirname,
> -	      struct ufs_args __user *args, int flags)
> +SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
> +		int, flag, void __user *, data)
>  {
> -	int retval;
> -	struct cdfs_args tmp;
> +	struct osf_mount_args tmp;
>  	struct filename *devname;
> -
> -	retval = -EFAULT;
> -	if (copy_from_user(&tmp, args, sizeof(tmp)))
> -		goto out;
> -	devname = getname(tmp.devname);
> -	retval = PTR_ERR(devname);
> -	if (IS_ERR(devname))
> -		goto out;
> -	retval = do_mount(devname->name, dirname, "ext2", flags, NULL);
> -	putname(devname);
> - out:
> -	return retval;
> -}
> -
> -static int
> -osf_cdfs_mount(const char __user *dirname,
> -	       struct cdfs_args __user *args, int flags)
> -{
> +	const char *fstype;
>  	int retval;
> -	struct cdfs_args tmp;
> -	struct filename *devname;
> -
> -	retval = -EFAULT;
> -	if (copy_from_user(&tmp, args, sizeof(tmp)))
> -		goto out;
> -	devname = getname(tmp.devname);
> -	retval = PTR_ERR(devname);
> -	if (IS_ERR(devname))
> -		goto out;
> -	retval = do_mount(devname->name, dirname, "iso9660", flags, NULL);
> -	putname(devname);
> - out:
> -	return retval;
> -}
> -
> -static int
> -osf_procfs_mount(const char __user *dirname,
> -		 struct procfs_args __user *args, int flags)
> -{
> -	struct procfs_args tmp;
>  
>  	if (copy_from_user(&tmp, args, sizeof(tmp)))
>  		return -EFAULT;
>  
arch/alpha/kernel/osf_sys.c:440:27: error: 'args' undeclared (first use in this function)

> -	return do_mount("", dirname, "proc", flags, NULL);
> -}
> -
> -SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
> -		int, flag, void __user *, data)
> -{
> -	int retval;
> -
>  	switch (typenr) {
> -	case 1:
> -		retval = osf_ufs_mount(path, data, flag);
> +	case 1: /* ufs */
> +		/*
> +		 * We can't actually handle ufs yet, so we translate UFS mounts
> +		 * to ext2 mounts. I wouldn't mind a UFS filesystem, but the UFS
> +		 * layout is so braindead it's a major headache doing it.
> +		 *
> +		 * Just how long ago was it written? OTOH our UFS driver may be
> +		 * still unhappy with OSF UFS. [CHECKME]
> +		 */
> +		fstype = "ext2";
> +		devname = getname(tmp.devname);
>  		break;
> -	case 6:
> -		retval = osf_cdfs_mount(path, data, flag);
> +	case 6: /* cdfs */
> +		fstype = "iso9660";
> +		devname = getname(tmp.devname);
>  		break;
> -	case 9:
> -		retval = osf_procfs_mount(path, data, flag);
> +	case 9: /* procfs */
> +		fstype = "proc";
> +		devname = getname_kernel("");
>  		break;
>  	default:
> -		retval = -EINVAL;
>  		printk("osf_mount(%ld, %x)\n", typenr, flag);
> +		return -EINVAL;
>  	}
>  
> +	if (IS_ERR(devname))
> +		return PTR_ERR(devname);
> +	retval = do_mount(devname.name, dirname, fstype, flags, NULL);

arch/alpha/kernel/osf_sys.c:471:34: error:
	'dirname' undeclared (first use in this function); did you mean 'devname'?

> +	putname(devname);
>  	return retval;
>  }
>  

  reply	other threads:[~2020-10-11 14:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  8:22 remove compat_sys_mount Christoph Hellwig
2020-09-17  8:22 ` [PATCH 1/5] nfs: simplify nfs4_parse_monolithic Christoph Hellwig
2020-09-17  8:22 ` [PATCH 2/5] fs,nfs: lift compat nfs4 mount data handling into the nfs code Christoph Hellwig
2020-09-17 17:16   ` Al Viro
2020-09-17 17:18     ` Christoph Hellwig
2020-09-21  6:48       ` Christoph Hellwig
2020-09-21 16:05         ` Anna Schumaker
2020-09-21 18:11           ` Christoph Hellwig
2020-09-23  3:45             ` Al Viro
2020-09-17  8:22 ` [PATCH 3/5] fs: remove compat_sys_mount Christoph Hellwig
2020-09-17  8:22 ` [PATCH 4/5] alpha: simplify osf_mount Christoph Hellwig
2020-10-11 14:22   ` Guenter Roeck [this message]
2020-09-17  8:22 ` [PATCH 5/5] fs: remove do_mounts Christoph Hellwig
2020-10-11 14:17   ` Guenter Roeck
2020-10-11 18:01     ` Al Viro

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=20201011142255.GA203430@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=anna.schumaker@netapp.com \
    --cc=hch@lst.de \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mattst88@gmail.com \
    --cc=rth@twiddle.net \
    --cc=trond.myklebust@hammerspace.com \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH 4/5] alpha: simplify osf_mount' \
    /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

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).