mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] fs/mount: add autodetection type support
Date: Mon, 13 Aug 2012 20:49:57 +0200	[thread overview]
Message-ID: <20120813184957.GR1451@pengutronix.de> (raw)
In-Reply-To: <1344795043-13815-1-git-send-email-plagnioj@jcrosoft.com>

On Sun, Aug 12, 2012 at 08:10:40PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> if NULL is pass as type mount will try to autodetect the filesystem type
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  fs/Kconfig   |    5 +++++
>  fs/fs.c      |   28 ++++++++++++++++++++++++++++
>  include/fs.h |    5 +++++
>  3 files changed, 38 insertions(+)
> 
> diff --git a/fs/Kconfig b/fs/Kconfig
> index b75820f..4c66543 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -1,6 +1,11 @@
>  
>  menu "Filesystem support            "
>  
> +config FS
> +	bool
> +	default y
> +	select FILETYPE
> +
>  config FS_AUTOMOUNT
>  	bool
>  
> diff --git a/fs/fs.c b/fs/fs.c
> index 0b376a5..e80d907 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -954,6 +954,28 @@ int register_fs_driver(struct fs_driver_d *fsdrv)
>  }
>  EXPORT_SYMBOL(register_fs_driver);
>  
> +static const char * detect_fs(const char *filename)

static const char *detect_fs(const char *filename)

please

> +{
> +	enum filetype type = file_name_detect_type(filename);
> +	struct driver_d *drv;
> +	struct fs_driver_d *fdrv;
> +
> +	if (type == filetype_unknown)
> +		return NULL;
> +
> +	for_each_driver(drv) {
> +		if (drv->bus != &fs_bus)
> +			continue;
> +
> +		fdrv = drv_to_fs_driver(drv);
> +
> +		if(type == fdrv->type)

if (

> +			return drv->name;
> +	}
> +
> +	return NULL;
> +}
> +
>  /*
>   * Mount a device to a directory.
>   * We do this by registering a new device on which the filesystem
> @@ -985,6 +1007,12 @@ int mount(const char *device, const char *fsname, const char *_path)
>  		}
>  	}
>  
> +	if (!fsname)
> +		fsname = detect_fs(device);
> +
> +	if (!fsname)
> +		return -ENOENT;

Should be -ENODEV I think. At least that's what Linux mount returns in
this case.

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-08-13 18:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-12 18:05 [PATCH 0/4 v2] fs/mount: add autodetection support Jean-Christophe PLAGNIOL-VILLARD
2012-08-12 18:10 ` [PATCH 1/4] fs/mount: add autodetection type support Jean-Christophe PLAGNIOL-VILLARD
2012-08-12 18:10   ` [PATCH 2/4] filetype: add fat filesystem support Jean-Christophe PLAGNIOL-VILLARD
2012-08-12 18:10   ` [PATCH 3/4] fs/fat: add filetype Jean-Christophe PLAGNIOL-VILLARD
2012-08-12 18:10   ` [PATCH 4/4] command/mount: add autodetection support Jean-Christophe PLAGNIOL-VILLARD
2012-08-13 18:49   ` Sascha Hauer [this message]
2012-08-15  7:25     ` [PATCH 1/4] fs/mount: add autodetection type support Jean-Christophe PLAGNIOL-VILLARD
2012-09-04  8:02 ` [PATCH 0/4 v2] fs/mount: add autodetection support Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2012-08-12 11:46 [PATCH 0/4] " Jean-Christophe PLAGNIOL-VILLARD
2012-08-12 11:49 ` [PATCH 1/4] fs/mount: add autodetection type support Jean-Christophe PLAGNIOL-VILLARD
2012-08-12 12:46   ` Sascha Hauer
2012-08-13  7:08   ` Uwe Kleine-König
2012-08-13  7:30     ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-13  8:16       ` Uwe Kleine-König
2012-08-13 10:56         ` Jean-Christophe PLAGNIOL-VILLARD

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=20120813184957.GR1451@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.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