niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
[RFC] mount can figure out fstype automatically
Post new topic   Reply to topic Page 1 of 2 [30 Posts] View previous topic :: View next topic
Goto page:  1, 2 Next
Author Message
Craig Rodrigues
*nix forums beginner


Joined: 13 Dec 2002
Posts: 27

PostPosted: Sat Jul 08, 2006 3:28 pm    Post subject: [RFC] mount can figure out fstype automatically Reply with quote

Hi,

One of the pet peeves I have with FreeBSD is that
if I have a device with a local filesystem that I want to mount,
I need to explicitly know what type of filesystem is on the
device in order to mount it from the command-line.

For example,

mount -t cd9660
mount -t udf
mount -t ext2fs
mount -t msdosfs

Where this is particularly annoying is if I have multiple
USB thumb drives with different filesystems on them.

What I usually end up doing is something like:
file - < /dev/ad0s4

to figure out the filesystem type, and then mount -t [whatever] to mount it.

What I would like to do is:

mount /dev/ad0s4 /mnt

and if I do not specify a filesystem type with -t, the mount
program should "magically" figure out how to mount the disk.
This is closer to how the mount program behaves on Linux for example.

I've come up with a patch that does this, by interpreting
an fstype of "" as:
- starting with "ufs", iterate over all the local filesystem types
that we know about, and try to mount the device

Comments?



Index: sys/kern/vfs_mount.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/vfs_mount.c,v
retrieving revision 1.228
diff -u -u -r1.228 vfs_mount.c
--- sys/kern/vfs_mount.c 27 Jun 2006 14:46:31 -0000 1.228
+++ sys/kern/vfs_mount.c 8 Jul 2006 14:01:52 -0000
@@ -567,6 +567,34 @@
}

static int
+vfs_domount_try(struct thread *td, char *fspath, int fsflags,
+ void *fsdata)
+{
+ struct vfsconf *vfsp;
+ int error;
+ printf("Mounting: %s first\n", "ufs");
+ error = vfs_domount(td, "ufs", fspath, fsflags, fsdata);
+ if (error == 0) {
+ printf("successfully mounted: %s\n", "ufs");
+ }
+ if (error != 0) {
+ TAILQ_FOREACH(vfsp, &vfsconf, vfc_list) {
+ if ((strcmp("ufs", vfsp->vfc_name) != 0) &&
+ !(vfsp->vfc_flags & VFCF_NETWORK) &&
+ !(vfsp->vfc_flags & VFCF_SYNTHETIC)) {
+ printf("Mounting: %s\n", vfsp->vfc_name);
+ error = vfs_domount(td, vfsp->vfc_name, fspath, fsflags, fsdata);
+ if (error == 0) {
+ printf("successfully mounted: %s\n", vfsp->vfc_name);
+ break;
+ }
+ }
+ }
+ }
+ return error;
+}
+
+static int
vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
{
struct vfsoptlist *optlist;
@@ -596,7 +624,7 @@
*/
fstypelen = 0;
error = vfs_getopt(optlist, "fstype", (void **)&fstype, &fstypelen);
- if (error || fstype[fstypelen - 1] != '\0') {
+ if (error || (fstypelen > 0 && fstype[fstypelen - 1] != '\0')) {
error = EINVAL;
if (errmsg != NULL)
strncpy(errmsg, "Invalid fstype", errmsg_len);
@@ -606,6 +634,7 @@
error = vfs_getopt(optlist, "fspath", (void **)&fspath, &fspathlen);
if (error || fspath[fspathlen - 1] != '\0') {
error = EINVAL;
+ printf("%s:%d EINVAL\n", __FILE__, __LINE__);
if (errmsg != NULL)
strncpy(errmsg, "Invalid fspath", errmsg_len);
goto bail;
@@ -686,7 +715,14 @@
}

mtx_lock(&Giant);
- error = vfs_domount(td, fstype, fspath, fsflags, optlist);
+ if (fstypelen > 1) {
+ /* fstype was specified, go directly to vfs_domount() */
+ error = vfs_domount(td, fstype, fspath, fsflags, optlist);
+ }
+ else {
+ /* we do not know the fstype, try to probe for it */
+ error = vfs_domount_try(td, fspath, fsflags, optlist);
+ }
mtx_unlock(&Giant);
bail:
/* copyout the errmsg */
Index: sbin/mount/mount.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mount.c,v
retrieving revision 1.87
diff -u -u -r1.87 mount.c
--- sbin/mount/mount.c 10 Jun 2006 01:44:57 -0000 1.87
+++ sbin/mount/mount.c 8 Jul 2006 14:14:47 -0000
@@ -200,7 +200,7 @@

all = init_flags = 0;
vfslist = NULL;
- vfstype = "ufs";
+ vfstype = "";
while ((ch = getopt(argc, argv, "adF:fo:prwt:uv")) != -1)
switch (ch) {
case 'a':
Index: sbin/mount/mount_fs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mount_fs.c,v
retrieving revision 1.2
diff -u -u -r1.2 mount_fs.c
--- sbin/mount/mount_fs.c 13 Nov 2005 01:27:57 -0000 1.2
+++ sbin/mount/mount_fs.c 8 Jul 2006 14:14:47 -0000
@@ -50,6 +50,7 @@

#include <sys/param.h>
#include <sys/mount.h>
+#include <sys/uio.h>

#include <err.h>
#include <getopt.h>
@@ -82,8 +83,9 @@
int iovlen;
int mntflags = 0;
int ch;
- char *dev, *dir, mntpath[MAXPATHLEN];
+ char *dev, *dir, mntpath[MAXPATHLEN], frompath[MAXPATHLEN];
char fstype[32];
+ //char errmsg[1024] = { 0 };
char *p, *val;
int ret;

@@ -121,15 +123,35 @@
dir = argv[1];

(void)checkpath(dir, mntpath);
+ if (realpath(dev, frompath) != NULL) {
+ dev = frompath;
+ }
(void)rmslashes(dev, dev);

build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1);
build_iovec(&iov, &iovlen, "from", dev, (size_t)-1);
-
+ //build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
+ printf("fstype: %s, fspath: %s, from: %s\n", fstype, mntpath, dev);
+retry:
ret = nmount(iov, iovlen, mntflags);
- if (ret < 0)
- err(1, "%s", dev);
+ if (ret < 0 && iov[1].iov_len == 0) {
+ /*
+ * If an fstype was not specified, and nmount() failed,
+ * try again with an fstype of "ufs". This is for backwards
+ * compatibility with older kernels which do not support
+ * do_mount_try() with an fstype of "".
+ */
+ iov[1].iov_base = strdup("ufs");
+ iov[1].iov_len = 4;
+ printf("Trying again....\n");
+ goto retry;
+ }
+
+ if (ret < 0) {
+ //err(1, "%s %s", dev, errmsg);
+ //err(1, "%s", dev);
+ }

return (ret);
}


--
Craig Rodrigues
rodrigc@crodrigues.org
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Dag-Erling Smørgrav
*nix forums Guru Wannabe


Joined: 16 Mar 2003
Posts: 186

PostPosted: Sat Jul 08, 2006 3:37 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Craig Rodrigues <rodrigc@crodrigues.org> writes:
Quote:
I've come up with a patch that does this, by interpreting
an fstype of "" as:
- starting with "ufs", iterate over all the local filesystem types
that we know about, and try to mount the device

What about cases where there may be several matching file systems?
For instance, a clean ext3 file system is also a valid ext2 file
system (and vice versa).

DES
--
Dag-Erling Smørgrav - des@des.no
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Back to top
Sam Leffler
*nix forums addict


Joined: 20 Jun 2002
Posts: 75

PostPosted: Sat Jul 08, 2006 4:05 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Craig Rodrigues wrote:
Quote:
Hi,

One of the pet peeves I have with FreeBSD is that
if I have a device with a local filesystem that I want to mount,
I need to explicitly know what type of filesystem is on the
device in order to mount it from the command-line.

For example,

mount -t cd9660
mount -t udf
mount -t ext2fs
mount -t msdosfs

Where this is particularly annoying is if I have multiple
USB thumb drives with different filesystems on them.

What I usually end up doing is something like:
file - < /dev/ad0s4

to figure out the filesystem type, and then mount -t [whatever] to mount it.

What I would like to do is:

mount /dev/ad0s4 /mnt

and if I do not specify a filesystem type with -t, the mount
program should "magically" figure out how to mount the disk.
This is closer to how the mount program behaves on Linux for example.

I've come up with a patch that does this, by interpreting
an fstype of "" as:
- starting with "ufs", iterate over all the local filesystem types
that we know about, and try to mount the device

Comments?

<...patch deleted...>

Linux has -t auto; haven't looked at how it works.

It appears you just try a series of fs types; can't you read the device
to infer the filesystem?

Sam
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Craig Rodrigues
*nix forums beginner


Joined: 13 Dec 2002
Posts: 27

PostPosted: Sat Jul 08, 2006 4:09 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

On Sat, Jul 08, 2006 at 05:37:26PM +0200, Dag-Erling Smrgrav wrote:
Quote:
What about cases where there may be several matching file systems?
For instance, a clean ext3 file system is also a valid ext2 file
system (and vice versa).

Currently, FreeBSD can only mount ext2 with mount -t ext2fs.

A better example would probably be udf and cd9660 filesystems.

Right now the logic is to iterate over the list of known local
filesystems (always starting with "ufs"), skipping over "synthetic"
and "network" filesystems,
i.e. similar to the list produced by lsvfs:

Filesystem Refs Flags
-------------------------------- ----- ---------------
ufs 8
reiserfs 0 read-only
nfs4 0 network
ext2fs 0
ntfs 0
cd9660 0 read-only
procfs 1 synthetic
msdosfs 0
xfs 0
devfs 1 synthetic
nfs 0 network



The first matching filesystem wins....not perfect, but
maybe good enough for a lot of cases.

mount -t always works if you want to specify the fstype.

--
Craig Rodrigues
rodrigc@crodrigues.org
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Craig Rodrigues
*nix forums beginner


Joined: 13 Dec 2002
Posts: 27

PostPosted: Sat Jul 08, 2006 4:17 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

On Sat, Jul 08, 2006 at 09:05:51AM -0700, Sam Leffler wrote:
Quote:
Linux has -t auto; haven't looked at how it works.

I didn't want to implement -t auto, in
case that would confuse things in case someone gets around
to implementing autofs for FreeBSD, so I just used -t "".

Quote:
It appears you just try a series of fs types; can't you read the device
to infer the filesystem?

I was thinking of doing something like that. You can basically
get the same info by doing something like:

file - < /dev/ad0s1e
/dev/stdin: Unix Fast File system (little-endian)

file - < /dev/ad0s4
/dev/stdin: SGI XFS filesystem


I leaned away from this approach in mount(Cool because:
- I didn't want to tie mount(Cool to file(1)
- I didn't want to build up a table of known superblocks
inside mount(Cool because every time a new filesystem is
added to FreeBSD, mount(Cool would need to be updated

If there was a way, maybe at the GEOM or filesystem level to
"taste" what type of filesystem existed on a device, and/or
have a filesystem advertise what type of superblock it has,
then that would be a nice way to do it, but I couldn't figure
out a way to easily do it.


--
Craig Rodrigues
rodrigc@crodrigues.org
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Back to top
Scott Long
*nix forums Guru Wannabe


Joined: 16 Jun 2002
Posts: 167

PostPosted: Sat Jul 08, 2006 4:37 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Craig Rodrigues wrote:

Quote:
On Sat, Jul 08, 2006 at 05:37:26PM +0200, Dag-Erling Smrgrav wrote:

What about cases where there may be several matching file systems?
For instance, a clean ext3 file system is also a valid ext2 file
system (and vice versa).


Currently, FreeBSD can only mount ext2 with mount -t ext2fs.

A better example would probably be udf and cd9660 filesystems.

Right now the logic is to iterate over the list of known local
filesystems (always starting with "ufs"), skipping over "synthetic"
and "network" filesystems,
i.e. similar to the list produced by lsvfs:

Filesystem Refs Flags
-------------------------------- ----- ---------------
ufs 8
reiserfs 0 read-only
nfs4 0 network
ext2fs 0
ntfs 0
cd9660 0 read-only
procfs 1 synthetic
msdosfs 0
xfs 0
devfs 1 synthetic
nfs 0 network



The first matching filesystem wins....not perfect, but
maybe good enough for a lot of cases.

mount -t always works if you want to specify the fstype.


Where is udf in the list? Btw, it's not that udf and cd9660 are
compatible, they aren't by any means. It's that the can co-exist on
the same media, and often times a UDF filesystem has cd9660 structures
available for compatibility. If you added udf to your list above with a
higher priority than cd9660, everything should 'just work', and you'd
still be able to override it manually.

Scott

_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Back to top
Ivan Voras
*nix forums addict


Joined: 16 Apr 2005
Posts: 69

PostPosted: Sat Jul 08, 2006 5:37 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Craig Rodrigues wrote:

Quote:
- I didn't want to build up a table of known superblocks
inside mount(Cool because every time a new filesystem is
added to FreeBSD, mount(Cool would need to be updated

There's a similar (in the basic idea, not in details) request on
freebsd-geom list - how to detect what GEOM class is set up in an
arbitrary provider. That is similar to this thread because both are
discussing information that is available on-disk and usable by core
system utilities (mount and installer) - so maybe a new library is in
order, which will enable users to detect what is on a particular
device/parition/provider/etc from on the device.

In case of GEOM classes, metadata is written on the last sector, and
first few fields ("signature fields") are in common format for all
classes, so it's easy to get what class "owns" the device without going
into the details of its metadata.

Something like:
struct devcontentinfo* get_provider_info(char *device_name);

where returned value will be an array of found "contents", with a "type"
member (enum) describing what it is (GEOM class / file system / swap), a
"name" member which holds the ASCII name of the found thing ("UFS",
"GEOM_MIRROR"), and an additional "extended_name" which would contain
details ("UFSv2", "GEOM_MIRRORv4"). For these examples instead of
"extended_name" maybe a version field will be enough ("v4" for
GEOM_MIRROR stands for fourth metadata layout version).

_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Back to top
Sam Leffler
*nix forums addict


Joined: 20 Jun 2002
Posts: 75

PostPosted: Sat Jul 08, 2006 5:38 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Craig Rodrigues wrote:
Quote:
On Sat, Jul 08, 2006 at 09:05:51AM -0700, Sam Leffler wrote:
Linux has -t auto; haven't looked at how it works.

I didn't want to implement -t auto, in
case that would confuse things in case someone gets around
to implementing autofs for FreeBSD, so I just used -t "".

Oh, I stupidly assumed "auto" meant something similar to what you were
doing :)

Quote:

It appears you just try a series of fs types; can't you read the device
to infer the filesystem?

I was thinking of doing something like that. You can basically
get the same info by doing something like:

file - < /dev/ad0s1e
/dev/stdin: Unix Fast File system (little-endian)

file - < /dev/ad0s4
/dev/stdin: SGI XFS filesystem


I leaned away from this approach in mount(Cool because:
- I didn't want to tie mount(Cool to file(1)
- I didn't want to build up a table of known superblocks
inside mount(Cool because every time a new filesystem is
added to FreeBSD, mount(Cool would need to be updated

If there was a way, maybe at the GEOM or filesystem level to
"taste" what type of filesystem existed on a device, and/or
have a filesystem advertise what type of superblock it has,
then that would be a nice way to do it, but I couldn't figure
out a way to easily do it.

I wouldn't expect a program like mount to fork+exec file; I'd expect it
to either read directly or use a kernel facility. Sounds like something
is missing to do this right.

Sam
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Christoph Hellwig
*nix forums beginner


Joined: 08 May 2002
Posts: 40

PostPosted: Sat Jul 08, 2006 5:46 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

On Sat, Jul 08, 2006 at 09:05:51AM -0700, Sam Leffler wrote:
Quote:
Linux has -t auto; haven't looked at how it works.

It's implemented in mount(Cool. It has a table of magic numbers and offsets
and tries all of them in a well defined order. If everything fails it
tries a few heuristics whether the filesystems might be a FAT filesystem
as thos don't have magic numbers.

_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Scott Long
*nix forums Guru Wannabe


Joined: 16 Jun 2002
Posts: 167

PostPosted: Sat Jul 08, 2006 6:57 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Craig Rodrigues wrote:

Quote:
On Sat, Jul 08, 2006 at 09:05:51AM -0700, Sam Leffler wrote:

Linux has -t auto; haven't looked at how it works.


I didn't want to implement -t auto, in
case that would confuse things in case someone gets around
to implementing autofs for FreeBSD, so I just used -t "".


It appears you just try a series of fs types; can't you read the device
to infer the filesystem?


I was thinking of doing something like that. You can basically
get the same info by doing something like:

file - < /dev/ad0s1e
/dev/stdin: Unix Fast File system (little-endian)

file - < /dev/ad0s4
/dev/stdin: SGI XFS filesystem


I leaned away from this approach in mount(Cool because:
- I didn't want to tie mount(Cool to file(1)
- I didn't want to build up a table of known superblocks
inside mount(Cool because every time a new filesystem is
added to FreeBSD, mount(Cool would need to be updated

If there was a way, maybe at the GEOM or filesystem level to
"taste" what type of filesystem existed on a device, and/or
have a filesystem advertise what type of superblock it has,
then that would be a nice way to do it, but I couldn't figure
out a way to easily do it.



Well, by running through a list of possible filesystems and trying
each one, you are effectively 'tasting' them. In a brute force way,
but still the exact same idea. But really, it's not like filesystems
are sprouting up every day, so I don't see the need to spend a lot of
time making this elegant and highly extensible.

Scott

_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Back to top
Pawel Jakub Dawidek
*nix forums addict


Joined: 24 Jun 2003
Posts: 92

PostPosted: Sat Jul 08, 2006 9:53 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

On Sat, Jul 08, 2006 at 12:57:21PM -0600, Scott Long wrote:
Quote:
Craig Rodrigues wrote:

On Sat, Jul 08, 2006 at 09:05:51AM -0700, Sam Leffler wrote:
Linux has -t auto; haven't looked at how it works.
I didn't want to implement -t auto, in
case that would confuse things in case someone gets around
to implementing autofs for FreeBSD, so I just used -t "".
It appears you just try a series of fs types; can't you read the device
to infer the filesystem?
I was thinking of doing something like that. You can basically
get the same info by doing something like:
file - < /dev/ad0s1e
/dev/stdin: Unix Fast File system (little-endian)
file - < /dev/ad0s4
/dev/stdin: SGI XFS filesystem
I leaned away from this approach in mount(Cool because:
- I didn't want to tie mount(Cool to file(1)
- I didn't want to build up a table of known superblocks
inside mount(Cool because every time a new filesystem is
added to FreeBSD, mount(Cool would need to be updated
If there was a way, maybe at the GEOM or filesystem level to
"taste" what type of filesystem existed on a device, and/or
have a filesystem advertise what type of superblock it has,
then that would be a nice way to do it, but I couldn't figure
out a way to easily do it.

Well, by running through a list of possible filesystems and trying
each one, you are effectively 'tasting' them. In a brute force way,
but still the exact same idea. [...]

One thing I don't like about this idea, is that simple mount(Cool command
will load all file system kernel modules if we give for example device
with no file system on it.
Currently I think there is no way to tell from userland mount(Cool that
because of our call, the kernel has loaded file system module.
We could load it from mount(Cool instead of waiting for the kernel to do
it and then unload if we don't such such file system on the given
device...

Quote:
[...] But really, it's not like filesystems
are sprouting up every day, so I don't see the need to spend a lot of
time making this elegant and highly extensible.

What Craig was trying to do over the last few weeks/months was to remove
file systems specific code out of mount(Cool, so this will be a step
backwards, I think...

--
Pawel Jakub Dawidek http://www.wheel.pl
pjd@FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
Back to top
John Nielsen
*nix forums beginner


Joined: 13 Feb 2006
Posts: 2

PostPosted: Sat Jul 08, 2006 10:32 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Quoting Dag-Erling Smørgrav <des@des.no>:
Quote:
Craig Rodrigues <rodrigc@crodrigues.org> writes:
I've come up with a patch that does this, by interpreting
an fstype of "" as:
- starting with "ufs", iterate over all the local filesystem types
that we know about, and try to mount the device

What about cases where there may be several matching file systems?
For instance, a clean ext3 file system is also a valid ext2 file
system (and vice versa).

I've also seen cases where a partition is formatted FAT32, then
newfs'ed [ufs] under FreeBSD, but still mount-able as FAT32. (Windows
will in fact automount such partitions even if the partition type is
165. grr..)

JN

_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
John Baldwin
*nix forums Guru Wannabe


Joined: 27 Mar 2002
Posts: 278

PostPosted: Mon Jul 10, 2006 1:52 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

On Saturday 08 July 2006 17:53, Pawel Jakub Dawidek wrote:
Quote:
One thing I don't like about this idea, is that simple mount(Cool command
will load all file system kernel modules if we give for example device
with no file system on it.

No it won't. The patch instructs the kernel to try all of the currently
loaded filesystems. It doesn't try to load any filesystem modules.

--
John Baldwin
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Scott Long
*nix forums Guru Wannabe


Joined: 16 Jun 2002
Posts: 167

PostPosted: Mon Jul 10, 2006 7:06 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

Christoph Hellwig wrote:
Quote:
On Sat, Jul 08, 2006 at 09:05:51AM -0700, Sam Leffler wrote:

Linux has -t auto; haven't looked at how it works.


It's implemented in mount(Cool. It has a table of magic numbers and offsets
and tries all of them in a well defined order. If everything fails it
tries a few heuristics whether the filesystems might be a FAT filesystem
as thos don't have magic numbers.


So in your opinion and experience, what are the pros and cons of
maintaining a table of magic numbers?

Scott
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Craig Rodrigues
*nix forums beginner


Joined: 13 Dec 2002
Posts: 27

PostPosted: Mon Jul 10, 2006 7:30 pm    Post subject: Re: [RFC] mount can figure out fstype automatically Reply with quote

On Mon, Jul 10, 2006 at 01:06:02PM -0600, Scott Long wrote:
Quote:
So in your opinion and experience, what are the pros and cons of
maintaining a table of magic numbers?

One con: every time you add a new filesystem, you need to update
mount(Cool. Not a big deal, but it is something.
For Linux, the mount program usually is part of the util-linux
package which is separate from the kernel. util-linux and kernel
are maintained by separate groups in Linux....it is the responsibility
of the Linux distribution to bundle together versions of util-linux
and kernel that work together.

For FreeBSD, the direction I have been going is to try
to make mount(Cool as simple and generic as possible, and
push all the stuff for doing filesystem specific things into
the kernel, i.e. into vfs_mount.c for generic stuff, and
into each specific filesystem for fs-specific stuff.

--
Craig Rodrigues
rodrigc@crodrigues.org
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 2 [30 Posts] Goto page:  1, 2 Next
View previous topic :: View next topic
The time now is Sat Nov 22, 2008 3:07 am | All times are GMT
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts apt-cdrom on iso mount Nick Wright Debian 6 Thu Jul 20, 2006 10:10 am
No new posts Digital Camera Flash Memory won't Mount Mike McCarty Debian 10 Tue Jul 18, 2006 1:40 am
No new posts creating a nfs mount with write options tanushar@gmail.com AIX 3 Fri Jul 14, 2006 9:11 am
No new posts difficulties with nfs mount Dr. R. E. Hawkins FreeBSD 6 Tue Jul 11, 2006 5:31 pm
No new posts mount command need help mounting samba share Mike AIX 3 Mon Jul 10, 2006 10:32 pm

Loans | Duwayne Burnside | Latest Hollywood Gossip | Remortgages | Bad Credit Debt Consolidation
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2583s ][ Queries: 16 (0.0832s) ][ GZIP on - Debug on ]