Subject: LKM-adosfs.shar
To: None <amiga-dev@sun-lamp.cs.berkeley.edu>
From: Niklas Hallqvist <niklas@appli.se>
List: amiga-dev
Date: 04/06/1994 21:31:43
OK here it is!

Note that you need to be able to compile your own kernel for now.
This will go away, once sun-lamp sources has allocated a MOUNT_ADOSFS
value in sys/mount.h (and some malloc tags in sys/malloc.h).
You also need the original adosfs.tar.gz distr from ftp.eunet.ch.

Enjoy,

Niklas

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	README.LKM
#	Makefile
#	adosfsmod.c
#
echo x - README.LKM
sed 's/^X//' >README.LKM << 'END-of-README.LKM'
XThese instructions presumes you can compile your own kernel as
Xthe core source don't yet have MOUNT_ADOSFS in sys/mount.h,
Xmeaning binary kernel distributions are not ready for the
XLKM ADOSFS.  Hopefully this changes soon, and then new
Xinstallation instructions will be available.
X
XIn order to make your ADOSFS a loadable kernel module, you have
Xto do this:
X
XI	Install kernel-resident ADOSFS, available in a separate
X	package, the way the README in that package states.
X	Don't recompile the kernel yet!
X
XII	Remove the options ADOSFS (and ADOSFSDEBUG, if you had it)
X	from your config file.  Make sure options LKM is in there.
X
XIII	do a config, make depend (important!) and a make of the
X	kernel.  You may as well boot it now.
X
XIV	Enter the adosfs directory, and copy the following files
X	there:
X
X	Makefile
X	adosfsmod.c
X
XV	make
X
XVI	try it out by typing: "make load"
X	Note: the kernel code contains lots of debug statements,
X	don't bother, unless something seems wrong.
X
XVII	Check it's loaded via "modstat"
X
XVIII	Try mounting an ADOS partition as per the original instructions
X	from the kernel-resident distribution.
X
XIX	Try unloading, by unmounting all ADOSFS partitions and do
X	"make unload"
X
END-of-README.LKM
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
XCFLAGS=	-O2 -I.. -I../sys -DKERNEL -DADOSFS -DADOSFSDEBUG
XOBJS=	adosfs_anode.o adosfs_blocks.o adosfs_util.o \
X	adosfs_vfsops.o adosfs_vnops.o adosfsmod.o
X
Xadosfs.o: $(OBJS)
X	$(LD) -r -o $@ $(OBJS)
X
Xload:
X	modload -o adosfs -eadosfsmod adosfs.o
X
Xunload:
X	modunload -n adosfs
END-of-Makefile
echo x - adosfsmod.c
sed 's/^X//' >adosfsmod.c << 'END-of-adosfsmod.c'
X/*
X * adosfsmod.c
X *
X * 01 Apr 94    Niklas Hallqvist
X *
X * adapted from: kerfsmod.c by
X *
X * 05 Jun 93	Terry Lambert		Original
X *
X * Copyright (c) 1993 Terrence R. Lambert.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *      This product includes software developed by Terrence R. Lambert.
X * 4. The name Terrence R. Lambert may not be used to endorse or promote
X *    products derived from this software without specific prior written
X *    permission.
X *
X * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
X * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X *	$Id: adosfsmod.c,v 1.1 1994/04/04 17:25:39 root Exp $
X */
X#if 0
X#include <stdlib.h>
X#include "sys/param.h"
X#include "sys/ioctl.h"
X#endif
X#include "sys/systm.h"
X#include "sys/conf.h"
X#include "sys/mount.h"
X#include "sys/exec.h"
X#include "sys/lkm.h"
X#if 0
X#include <a.out.h>
X#include "sys/file.h"
X#include "sys/errno.h"
X#endif
X
X/*
X * This is the vfsops table from /sys/miscfs/adosfs/adosfs_vfsops.c
X */
Xextern struct vfsops adosfs_vfsops;
X
X/*
X * Currently, the mount system call is broken in the way it operates
X * and the vfssw[] table does not have a character string identifier
X * for the file system type; therefore, to remount a file system after
X * it has been mounted in the first place, the offset into the table
X * must be the same; this will be corrected in future patches, but
X * not right now.  At the same time the fstab format will need to
X * change to allow definition without mount of file systems.
X *
X * The flags field is a parameter to the init; this could be used to
X * change the file system operation: for instance, in ISOFS, this
X * could be used to enable/disable Rockridge extensions.
X */
XMOD_VFS("adosfs",MOUNT_ADOSFS,0,&adosfs_vfsops)
X
X/*
X * This function is called each time the module is loaded.   Technically,
X * we could have made this "nosys" in the "DISPATCH" in "adosfsmod()",
X * but it's a convenient place to kick a copyright out to the console.
X */
Xstatic int
Xadosfsmod_load( lkmtp, cmd)
Xstruct lkm_table	*lkmtp;
Xint			cmd;
X{
X	if( cmd == LKM_E_LOAD) {	/* print copyright on console*/
X		printf( "\nLoaded AmigaDOS file system\n");
X		printf( "Copyright (c) 1994 Niklas Hallqvist\n");
X		printf( "All rights reserved.\n");
X		printf( "\nLoader stub and module loader is\n");
X		printf( "Copyright (c) 1993\n");
X		printf( "Terrence R. Lambert\n");
X		printf( "All rights reserved\n");
X	}
X
X	return( 0);
X}
X
X
X/*
X * External entry point; should generally match name of .o file.  The
X * arguments are always the same for all loaded modules.  The "load",
X * "unload", and "stat" functions in "DISPATCH" will be called under
X * their respective circumstances unless their value is "nosys".  If
X * called, they are called with the same arguments (cmd is included to
X * allow the use of a single function, ver is included for version
X * matching between modules and the kernel loader for the modules).
X *
X * Since we expect to link in the kernel and add external symbols to
X * the kernel symbol name space in a future version, generally all
X * functions used in the implementation of a particular module should
X * be static unless they are expected to be seen in other modules or
X * to resolve unresolved symbols alread existing in the kernel (the
X * second case is not likely to ever occur).
X *
X * The entry point should return 0 unless it is refusing load (in which
X * case it should return an errno from errno.h).
X */
Xadosfsmod( lkmtp, cmd, ver)
Xstruct lkm_table	*lkmtp;	
Xint			cmd;
Xint			ver;
X{
X	DISPATCH(lkmtp,cmd,ver,adosfsmod_load,nosys,nosys)
X}
X
X
X/*
X * EOF -- This file has not been truncated.
X */
END-of-adosfsmod.c
exit


------------------------------------------------------------------------------