From Tim Bird (Tim_R_Bird@Novell.COM) :
(altered slightly by DH - changed 'LINUX\FS' to 'PCEMU\FS')

LREDIR is a general purpose DOS redirection utility, specifically
implemented for use with the Linux DOS emulator DOSEMU.

In general, DOSEMU provides emulation of a DOS disk redirector via the
MFS (Mach File System) module of the emulator.  This support was originally
derived from the redirector for the DOS emulator for Mach.

DOS supports installable file systems by issueing callouts to a "redirector"
on any functions it receives for files or drives that are registered
with it as being non-local.  The installable file system support is intended
mainly for use by CD-ROM drivers and network clients, so that these file
systems may be presented to the DOS user as additional drives.  In DOSEMU, 
MFS uses this mechanism to present a section of the Linux file system to
the DOS which is running in the emulator.  This means that any subtree in
the Linux file system may be redirected and designated as a drive letter
under DOS for use in the emulator.

In order for DOS to use redirected drives, it must be configured for
additional drives.  This is done by putting a "LASTDRIVE=Z" statement in
the CONFIG.SYS that is used by the emulator upon loading DOS.  You can set
the LASTDRIVE to any letter of the alphabet.  The default is F if none is
specified, which means that DOS can only use letters A-F for drives.  The
example above configures all possible drive letters, A through Z, to be
available for use by DOS (and is what I recommend).  There is a slight
memory penalty for configuring this many drives (about 1K of the
conventional memory inside the emulator).

To use LREDIR, MFS must first have been enabled using EMUFS.SYS.  To do
this, load EMUFS.SYS in your CONFIG.SYS, with a line like:

    device=C:\EMUFS.SYS /usr/src
    
This will initialize the MFS redirector, and create one redirection 
automatically on the first available drive letter (usually D:).  Although
EMUFS.SYS can be loaded multiple times to get additional drives, I
recommend that you only load it once, and use LREDIR to redirect more
drives to other places in the Linux file system as needed.

LREDIR can be used to create new redirections, get a list of the current
redirections, or to delete a redirection.  To create a new redirection,
specify the drive letter to use, and the Linux file system path which
will become the root of that drive.  Since LREDIR is a general-purpose
redirection utility, it has a generic syntax which allows it to be used
with other redirectors besides MFS (like the NetWare Lite client, or
DOS VLM NetWare client).  The syntax is:
       
    LREDIR drive: server\volume\path
    
For use with the Linux file system, we use PCEMU as the server name,
FS as the volume name, and then specify a path from the root of the
Linux file system as the location to redirect the drive to.  For example:

    LREDIR F: PCEMU\FS\USR\SRC
    
would create a new redirection for drive F:, where the contents of
/usr/src would appear at the root of drive F:.  Note that this establishes
a root for drive F: which will be enforced by DOS.  ie, drive F: cannot
be used to access files in /usr or /usr/bin, because those Linux directories
are not in the subtree under /usr/src.

LREDIR allows you to redirect any drive available to DOS, including one
that is currently a physical drive.  This means that you can replace one of
your startup drives with a redirection.  When you delete the redirection,
the physical drive will become visible again.  This can be used so that
the boot diskimage disappears, and is replaced by the mounted MSDOS
file system in Linux, with the drive letter and root the same as before
Linux was installed.  For example on my system, I have a partition
with a DOS file system on it.  If I boot my machine with a DOS boot
diskette, this partition is my C: drive in DOS.  When I boot Linux, I mount
this partition, using the msdos file system type, at location /dos/cdrive.

For this to work right, you actually need two AUTOEXEC.BAT files, one on
the boot diskimage, and one in the directory that will become the root
of the redirected drive.

In the AUTOEXEC.BAT in the boot diskimage I put the line:

    LREDIR C: PCEMU\FS\DOS\CDRIVE
    
and when DOS runs in DOSEMU, it redirects drive C: to be replaced with
the drive C: I booted from.  Also, parsing of the AUTOEXEC.BAT file
will continue with the AUTOEXEC.BAT (if any) on the redirected drive.

People who use LREDIR in this way should be careful because COMMAND.COM
will continue parsing the AUTOEXEC.BAT from the redirected drive at the
same file offset where it left off in the AUTOEXEC.BAT on the original
C: drive.  For this reason, it is best to have the LREDIR command on the
first line of the original (diskimage) AUTOEXEC.BAT, and have the line
be identical in the AUTOEXEC.BAT on the redirected drive.  Is this clear
as mud?

