[lkml]   [2001]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[Patch,RFC] Symlinks on VFAT using .lnk shortcut files

Hello, on URL

there's a patch that provides support for symlinks of VFAT partition,
using Windows .lnk shortcut files, in a similar fashion Cygwin does.
I saw other patches that added support for symlinks in one way or
another but I thought it might be good to try to be compatible with
the Cygwin notion of symlinks.

I'm including the description on the approach and would appreciate any
comment or suggestion you might have.

Symlink support for VFAT filesystem for Linux 2.4

Jan Pazdziora,

October 31, 2001.

In Windows, there are so called shortcuts that provide ways of
referencing other files. We will use these to support symlinks on VFAT
partitions under Linux. This patch adds the support to fat/vfat
filesystem source.

Shortcuts are normal files with extension .lnk. That means that from
now on, no regular file on VFAT with symlinks support will be allowed
to have this extension.

The .lnk files not only point to other files but can also hold
information about ways of starting the referenced file, with which
program and parameters. Something like .pif was. The format is
rather complex, and is described by Jesse Hager at

There are three plus one fields of interest here:

1) Relative path -- if it is present we will use it to mean relative
symlink, and when writing relative symlink, we will fill this
2) Network location, in a form \\hostname\path. We won't try to
resolve it, except one special case, \\localhost\path, which will
mean /path, absolute symlink.
3) Local location, in a form C:\path. We won't try to resolve this and
we will never write this kind of link, because we don't know what
the driver letters are.
4) Description field -- Cygwin seems to use it to store the absolute
symlinks, we will write it to contain the symlink path (relative or

This patch makes symlink resolving the default. You can mount the
filesystem with an option -o nosymlinks, that will switch the symlink
support off and you will see the base .lnk files.

This patch was tested on Linux kernel 2.4.13 and on Windows ME.

Questions, requests for comment:

If we had the information about drive letter available, we would be
able to resolve the C:\Windows links correctly as well. Note that
inside one drive (shortcut from D: to some other location on D:), the
relative path seems to always be present, so it only starts to be
needed and interesting with links that go accross the Windows drive
boundary. Perhaps some /etc/windrives.conf file? Or a /proc support?
Suggestions welcome.

Cygwin doesn't seem to support the network and local symlinks under
Windows well. It is unhappy with the Network/local part. I believe
that it is a problem of Cygwin (do they do their own symlink
resolution?) and I might be able to get a patch to make Cygwin work
properly as well.

The patch adds minor tweaks into some common code, and also some
bigger functions for symlink creating and resolving. These could be
moved into separate file, from vfat/namei.c and fat/file.c. But due to
a way the fat/vfat/msdos filesystem sypport is structured, the support
(at least partial) will probably always need to be in the common fat

Comments welcome.

Honza Pazdziora | |
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, DBD::XBase.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:12    [W:0.184 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site