All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: symlink_prefix
@ 2001-06-03 10:53 Andries.Brouwer
  2001-06-03 11:25 ` symlink_prefix Alexander Viro
  0 siblings, 1 reply; 19+ messages in thread
From: Andries.Brouwer @ 2001-06-03 10:53 UTC (permalink / raw)
  To: Andries.Brouwer, viro; +Cc: linux-kernel

    From viro@math.psu.edu Sun Jun  3 02:49:08 2001

    On Sun, 3 Jun 2001 Andries.Brouwer@cwi.nl wrote:

    > This evening I needed to work on a filesystem of a non-Linux OS,
    > full of absolute symlinks. After mounting the fs on /mnt, each
    > symlink pointing to /foo/bar in that filesystem should be
    > regarded as pointing to /mnt/foo/bar.
    > 
    > Since doing ls -ld on every component of every pathname was
    > far too slow, I made a small kernel wart, where a mount option
    > -o symlink_prefix=/pathname would cause /pathname to be prepended
    > in front of every absolute symlink in the given filesystem
    > (when the symlink is followed). That works satisfactorily.

    Absolute symlinks... Dunno. _If_ we want that at all, we probably
    want it on per-mountpoint basis. However, that opens a door to
    _really_ ugly feature requests. E.g. "if symlink starts with
    /foo - replace it with /mnt/bar, but if it starts with /foo/baz -
    replace with /mnt/splat instead".

Suppose I have devices /dev/a, /dev/b, /dev/c that contain the
/, /usr and /usr/spool filesystems for FOO OS. Now
	mount /dev/a /mnt -o symlink_prefix=/mnt
	mount /dev/b /mnt/usr -o symlink_prefix=/mnt
	mount /dev/c /mnt/usr/spool -o symlink_prefix=/mnt
suffice.
I do not immediately see a realistic use for changing symlink
contents halfway.

    I can see how to implement per-mountpoint variant. However, I'm
    less than enthusiastic about the API side of that and about the
    ugliness it will lead to. It smells like a wrong approach. And
    no, I don't see a good one right now.

    As for the API... How would you pass that option? Yet another
    mount(2) argument?

What I did was: add a field  `char *mnt_symlink_prefix;'  to the
struct vfsmount, fill it in super.c:add_vfsmnt(), use it in
namei.c:vfs_follow_link(). Pick the value up by recognizing
in super.c:do_mount() the option "symlink_prefix=" before
giving the options to the separate filesystems.

[One could start a subdiscussion about that part. The mount(2)
system call needs to transport vfs information and per-fs information.
So far, the vfs information used flag bits only, but sooner or later
we'll want to have strings, and need a vfs_parse_mount_options().
Indeed, many filesystems today have uid= and gid= and umask= options
that might be removed from the individual filesystems and put into vfs.
After all, such options are also useful for (foreign) ext2 filesystems.]


Andries

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: symlink_prefix
@ 2001-06-04 12:28 Hank Leininger
  2001-06-05  2:31 ` symlink_prefix Ton Hospel
  0 siblings, 1 reply; 19+ messages in thread
From: Hank Leininger @ 2001-06-04 12:28 UTC (permalink / raw)
  To: linux-kernel

On 2001-06-03, Andries.Brouwer@cwi.nl wrote:

> Suppose I have devices /dev/a, /dev/b, /dev/c that contain the
> /, /usr and /usr/spool filesystems for FOO OS. Now
>         mount /dev/a /mnt -o symlink_prefix=/mnt
>         mount /dev/b /mnt/usr -o symlink_prefix=/mnt
>         mount /dev/c /mnt/usr/spool -o symlink_prefix=/mnt

Cool.

What happens when someone creates new absolute symlinks under /mnt ?
Will/should the magic /mnt/ header be stripped from any symlink created
under such a path-translated volume?  The answer is probably 'yes', but
either one violates POLA :(

--
Hank Leininger <hlein@progressive-comp.com> 
  

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: symlink_prefix
@ 2001-06-03 17:37 Andries.Brouwer
  0 siblings, 0 replies; 19+ messages in thread
From: Andries.Brouwer @ 2001-06-03 17:37 UTC (permalink / raw)
  To: Andries.Brouwer, viro; +Cc: linux-kernel

> We can kludge around anything. The question being, what for?
> It still leaves ncp with its ioctls ugliness.

I show how to simplify the kernel source without changing the
interface. That is good, and there are some free benefits.

You want to design a new interface. Maybe that is good as well,
but since it is the interface of essentially a unique program
I do not regard that as very urgent.

Andries

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: symlink_prefix
@ 2001-06-03 16:36 Andries.Brouwer
  2001-06-03 17:19 ` symlink_prefix Alexander Viro
  0 siblings, 1 reply; 19+ messages in thread
From: Andries.Brouwer @ 2001-06-03 16:36 UTC (permalink / raw)
  To: Andries.Brouwer, viro; +Cc: linux-kernel

> Current interface had grown an impressive collection of warts.
> Worse yet, you _can't_ put parsing into generic code.
> There are filesystems that have a binary object as 'data'.

Yes, that was a very unfortunate decision, back in the good old times
when nfs was implemented. And smb, ncp, coda followed nfs.

Nevertheless, there is no problem adding vfs_parse_mount_options().
For example, one can have a flag FS_HAS_BINARY_MOUNT_DATA in
the fs_flags field of the struct file_system_type that describes
the filesystem type, and refrain from trying to parse the mount data
when this bit is set.


Andries

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: symlink_prefix
@ 2001-06-03 15:10 Andries.Brouwer
  2001-06-03 15:27 ` symlink_prefix Alexander Viro
  0 siblings, 1 reply; 19+ messages in thread
From: Andries.Brouwer @ 2001-06-03 15:10 UTC (permalink / raw)
  To: Andries.Brouwer, viro; +Cc: linux-kernel

    From viro@math.psu.edu Sun Jun  3 13:25:31 2001

    > [One could start a subdiscussion about that part.
    > The mount(2) system call needs to transport vfs information
    > and per-fs information. So far, the vfs information used
    > flag bits only, but sooner or later we'll want to have
    > strings, and need a vfs_parse_mount_options().
    > Indeed, many filesystems today have uid= and gid= and
    > umask= options that might be removed from the individual
    > filesystems and put into vfs. After all, such options
    > are also useful for (foreign) ext2 filesystems.]

    _Please_, if we do anything of that kind - let's use a new syscall.
    Ideally, I'd say
        fs_fd = open("/fs/ext2", O_RDWR);
        /* error -> no such filesystem */
        write(fs_fd. "/dev/sda1", strlen("/dev/sda1"));
        /* error handling */
        write(fs_fd, "reserve=5", strlen(....));
        ...
        dir = open("/usr/local", O_DIRECTORY);
        /* error handling */
        new_mount(dir, MNT_SET, fs_fd);    /* closes dir and fs_fd */
        /* error handling */

    Comments?

I do not think this is an improvement. Anyway, it is orthogonal
to what I discussed.

[My version: keep interface constant, reorganize kernel source
to do certain things in one place instead of in several places.
Advantage: treatment becomes uniform and some options that make sense
for all filesystem types but are available today for some only
are generalized.
Your version: invent a new interface, be silent about what happens
inside the kernel.]

Andries

^ permalink raw reply	[flat|nested] 19+ messages in thread
* symlink_prefix
@ 2001-06-02 23:54 Andries.Brouwer
  2001-06-03  0:23 ` symlink_prefix Robert Love
  2001-06-03  0:49 ` symlink_prefix Alexander Viro
  0 siblings, 2 replies; 19+ messages in thread
From: Andries.Brouwer @ 2001-06-02 23:54 UTC (permalink / raw)
  To: linux-kernel, viro

This evening I needed to work on a filesystem of a non-Linux OS,
full of absolute symlinks. After mounting the fs on /mnt, each
symlink pointing to /foo/bar in that filesystem should be
regarded as pointing to /mnt/foo/bar.

Since doing ls -ld on every component of every pathname was
far too slow, I made a small kernel wart, where a mount option
-o symlink_prefix=/pathname would cause /pathname to be prepended
in front of every absolute symlink in the given filesystem
(when the symlink is followed). That works satisfactorily.

Remain the questions:
(i) is there already a mechanism that would achieve this?
(ii) if not, do we want something like this in the kernel?

There is already a vaguely similar (and much uglier) wart,
namely that of "altroot". It is really ugly - requires a path
set at kernel compile time. And the scope is different.
Instead of all processes and a single filesystem and symlinks only,
altroot affects a single process and all filesystems and all paths.

I do not immediately see a common generalization of these two.

Andries


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2001-06-07  3:32 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-03 10:53 symlink_prefix Andries.Brouwer
2001-06-03 11:25 ` symlink_prefix Alexander Viro
2001-06-04 11:53   ` symlink_prefix Remi Turk
2001-06-05 12:43   ` symlink_prefix Pavel Machek
2001-06-07  1:00   ` symlink_prefix Edgar Toernig
2001-06-07  1:19     ` symlink_prefix Alexander Viro
2001-06-07  3:43       ` symlink_prefix Edgar Toernig
  -- strict thread matches above, loose matches on Subject: below --
2001-06-04 12:28 symlink_prefix Hank Leininger
2001-06-05  2:31 ` symlink_prefix Ton Hospel
2001-06-03 17:37 symlink_prefix Andries.Brouwer
2001-06-03 16:36 symlink_prefix Andries.Brouwer
2001-06-03 17:19 ` symlink_prefix Alexander Viro
2001-06-04 22:05   ` symlink_prefix Albert D. Cahalan
2001-06-03 15:10 symlink_prefix Andries.Brouwer
2001-06-03 15:27 ` symlink_prefix Alexander Viro
2001-06-02 23:54 symlink_prefix Andries.Brouwer
2001-06-03  0:23 ` symlink_prefix Robert Love
2001-06-03  0:49 ` symlink_prefix Alexander Viro
2001-06-03  1:00   ` symlink_prefix Mitchell Blank Jr

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.