Here is an autofs patch for my NEC CD Changer.
There are some limited docs in the patch.

-- 
(o_   | Toby Jaffey : www.nott.ac.uk/~psystrj/
//\   | It's all fun and games,'till someone loses an eye! Then it's a       
V_/_  | *SPORT*                                                              
diff -urN autofs-3.1.3/COPYRIGHT /usr/src/autofs-3.1.3/COPYRIGHT
--- autofs-3.1.3/COPYRIGHT      Tue Nov  3 21:21:14 1998
+++ /usr/src/autofs-3.1.3/COPYRIGHT     Fri Jan 21 17:28:44 2000
@@ -1,4 +1,4 @@
-For all software in this distribution:
+For all software in this distribution except modules/mount_changer.c:
 
        Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
 
@@ -12,4 +12,7 @@
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
+
+mount_changer.c is Copyright 2000 Toby Jaffey <[EMAIL PROTECTED]> and is
+released under the GNU GPL.
 
diff -urN autofs-3.1.3/Changelog /usr/src/autofs-3.1.3/Changelog
--- autofs-3.1.3/Changelog      Thu Jan  1 01:00:00 1970
+++ /usr/src/autofs-3.1.3/Changelog     Fri Jan 21 17:40:28 2000
@@ -0,0 +1,20 @@
+Fri Jan 21 17:31:43 GMT 2000
+Toby Jaffey <[EMAIL PROTECTED]>
+Added modules/mount_changer.c
+
+I have an NEC CD-ROM DRIVE:251, 4X CD-ROM changer w/4 slots, 128kB Cache.
+The drive can only mount one CD at a time. To change the CD in use you must unmount, 
+swap slots (lots of ioctl() calls) and remount. Using autofs, this module allows the 
+illusion that all CDs are mounted at any given time. Only when data is requested does 
+the drive need to swap. Clearly, this is awful for simultaneous reads across many 
+disks, but I use it to create mp3 playlists spanning multiple CDs.
+
+The code is mostly clean, but rather than adding a new "mediatype" to the config 
+file, I set my drive up as fstype=changer. The assumption is made that all of the 
+disks are of type iso9660. This is a bad thing, but it works for me.
+
+My /etc/auto.master says:
+/mnt/changer    /etc/auto.misc
+
+My /etc/auto.misc says:
+1          -fstype=changer              :/dev/hdb
+2          -fstype=changer              :/dev/hdb
+3          -fstype=changer              :/dev/hdb
+4          -fstype=changer              :/dev/hdb
+
+
+
diff -urN autofs-3.1.3/configure /usr/src/autofs-3.1.3/configure
--- autofs-3.1.3/configure      Tue Nov  3 21:21:15 1998
+++ /usr/src/autofs-3.1.3/configure     Fri Jan 21 17:40:52 2000
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
+# Generated automatically using autoconf version 2.13 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -54,6 +54,7 @@
 # Initialize some other variables.
 subdirs=
 MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
 # Maximum number of lines to put in a shell here document.
 ac_max_here_lines=12
 
@@ -337,7 +338,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
+    echo "configure generated by autoconf version 2.13"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -500,9 +501,11 @@
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext 
+$LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
+ac_exeext=
+ac_objext=o
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
   # Stardent Vistra SVR4 grep lacks -e, says [EMAIL PROTECTED]
   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -540,7 +543,7 @@
 
 
 echo $ac_n "checking for binaries in""... $ac_c" 1>&6
-echo "configure:544: checking for binaries in" >&5
+echo "configure:547: checking for binaries in" >&5
 echo "$ac_t""$searchpath" 1>&6
 
 #
@@ -551,7 +554,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:555: checking for $ac_word" >&5
+echo "configure:558: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MOUNT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -559,9 +562,13 @@
   /*)
   ac_cv_path_MOUNT="$MOUNT" # Let the user override the test with a path.
   ;;
+  ?:/*)                         
+  ac_cv_path_MOUNT="$MOUNT" # Let the user override the test with a dos path.
+  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $searchpath$ac_dummy; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$searchpath"
+  for ac_dir in $ac_dummy; do 
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_path_MOUNT="$ac_dir/$ac_word"
@@ -602,7 +609,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:606: checking for $ac_word" >&5
+echo "configure:613: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UMOUNT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -610,9 +617,13 @@
   /*)
   ac_cv_path_UMOUNT="$UMOUNT" # Let the user override the test with a path.
   ;;
+  ?:/*)                         
+  ac_cv_path_UMOUNT="$UMOUNT" # Let the user override the test with a dos path.
+  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $searchpath$ac_dummy; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$searchpath"
+  for ac_dir in $ac_dummy; do 
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_path_UMOUNT="$ac_dir/$ac_word"
@@ -653,7 +664,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:657: checking for $ac_word" >&5
+echo "configure:668: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_E2FSCK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -661,9 +672,13 @@
   /*)
   ac_cv_path_E2FSCK="$E2FSCK" # Let the user override the test with a path.
   ;;
+  ?:/*)                         
+  ac_cv_path_E2FSCK="$E2FSCK" # Let the user override the test with a dos path.
+  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $searchpath$ac_dummy; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$searchpath"
+  for ac_dir in $ac_dummy; do 
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_path_E2FSCK="$ac_dir/$ac_word"
@@ -703,7 +718,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:707: checking for $ac_word" >&5
+echo "configure:722: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SMBMOUNT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -711,9 +726,13 @@
   /*)
   ac_cv_path_SMBMOUNT="$SMBMOUNT" # Let the user override the test with a path.
   ;;
+  ?:/*)                         
+  ac_cv_path_SMBMOUNT="$SMBMOUNT" # Let the user override the test with a dos path.
+  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $searchpath$ac_dummy; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$searchpath"
+  for ac_dir in $ac_dummy; do 
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_path_SMBMOUNT="$ac_dir/$ac_word"
@@ -756,7 +775,7 @@
 #
 if test -n "$MOUNT" ; then
   echo $ac_n "checking if mount accepts the -s option""... $ac_c" 1>&6
-echo "configure:760: checking if mount accepts the -s option" >&5
+echo "configure:779: checking if mount accepts the -s option" >&5
   if "$MOUNT" -s > /dev/null 2>&1 ; then
     cat >> confdefs.h <<\EOF
 #define HAVE_SLOPPY_MOUNT 1
@@ -772,7 +791,7 @@
 # glibc/libc 6 new libraries
 #
 echo $ac_n "checking for yp_match in -lnsl""... $ac_c" 1>&6
-echo "configure:776: checking for yp_match in -lnsl" >&5
+echo "configure:795: checking for yp_match in -lnsl" >&5
 ac_lib_var=`echo nsl'_'yp_match | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -780,7 +799,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 784 "configure"
+#line 803 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -791,7 +810,7 @@
 yp_match()
 ; return 0; }
 EOF
-if { (eval echo configure:795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s 
conftest; then
+if { (eval echo configure:814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s 
+conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -814,7 +833,7 @@
 
 
 echo $ac_n "checking for res_query in -lresolv""... $ac_c" 1>&6
-echo "configure:818: checking for res_query in -lresolv" >&5
+echo "configure:837: checking for res_query in -lresolv" >&5
 ac_lib_var=`echo resolv'_'res_query | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -822,7 +841,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 826 "configure"
+#line 845 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -833,7 +852,7 @@
 res_query()
 ; return 0; }
 EOF
-if { (eval echo configure:837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s 
conftest; then
+if { (eval echo configure:856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s 
+conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -878,7 +897,7 @@
 
 HAVE_HESIOD=0
 echo $ac_n "checking for hes_resolve in -lhesiod""... $ac_c" 1>&6
-echo "configure:882: checking for hes_resolve in -lhesiod" >&5
+echo "configure:901: checking for hes_resolve in -lhesiod" >&5
 ac_lib_var=`echo hesiod'_'hes_resolve | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -886,7 +905,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lhesiod $LIBRESOLV $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 890 "configure"
+#line 909 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -897,7 +916,7 @@
 hes_resolve()
 ; return 0; }
 EOF
-if { (eval echo configure:901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s 
conftest; then
+if { (eval echo configure:920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s 
+conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -925,7 +944,7 @@
 # NIS+ support?
 HAVE_NISPLUS=0
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:929: checking how to run the C preprocessor" >&5
+echo "configure:948: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -940,14 +959,14 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 944 "configure"
+#line 963 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
@@ -957,14 +976,31 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 961 "configure"
+#line 980 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:986: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 997 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1003: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
@@ -977,6 +1013,8 @@
 rm -f conftest*
 fi
 rm -f conftest*
+fi
+rm -f conftest*
   ac_cv_prog_CPP="$CPP"
 fi
   CPP="$ac_cv_prog_CPP"
@@ -987,18 +1025,18 @@
 
 ac_safe=`echo "rpcsvc/nis.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for rpcsvc/nis.h""... $ac_c" 1>&6
-echo "configure:991: checking for rpcsvc/nis.h" >&5
+echo "configure:1029: checking for rpcsvc/nis.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 996 "configure"
+#line 1034 "configure"
 #include "confdefs.h"
 #include <rpcsvc/nis.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1001: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1039: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -1068,7 +1106,7 @@
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create 
--no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -1087,9 +1125,11 @@
  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
 $ac_vpsub
 $extrasub
+s%@SHELL@%$SHELL%g
 s%@CFLAGS@%$CFLAGS%g
 s%@CPPFLAGS@%$CPPFLAGS%g
 s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
 s%@DEFS@%$DEFS%g
 s%@LDFLAGS@%$LDFLAGS%g
 s%@LIBS@%$LIBS%g
diff -urN autofs-3.1.3/daemon/mount.c /usr/src/autofs-3.1.3/daemon/mount.c
--- autofs-3.1.3/daemon/mount.c Tue Nov  3 21:21:14 1998
+++ /usr/src/autofs-3.1.3/daemon/mount.c        Thu Dec 16 01:02:15 1999
@@ -25,7 +25,7 @@
 
 /* These filesystems are known not to work with the "generic" module */
 static char *not_generic[] = { "nfs", "smbfs", "ncpfs", "userfs", "afs",
-                              "autofs", NULL };
+                              "autofs", "changer", NULL };
 
 int do_mount(const char *root, const char *name, int name_len,
             const char *what, const char *fstype, const char *options)
diff -urN autofs-3.1.3/modules/Makefile /usr/src/autofs-3.1.3/modules/Makefile
--- autofs-3.1.3/modules/Makefile       Tue Nov  3 21:21:14 1998
+++ /usr/src/autofs-3.1.3/modules/Makefile      Fri Jan 21 17:26:14 2000
@@ -7,11 +7,11 @@
 include ../Makefile.rules
 
 SRCS :=        lookup_yp.c  lookup_file.c  lookup_program.c  \
-       parse_sun.c  \
+       parse_sun.c  mount_changer.c\
        mount_generic.c  mount_nfs.c  mount_afs.c  mount_autofs.c
 
 MODS :=        lookup_yp.so lookup_file.so lookup_program.so \
-       parse_sun.so \
+       parse_sun.so mount_changer.so\
        mount_generic.so mount_nfs.so mount_afs.so mount_autofs.so
 
 ifeq ($(EXT2FS), 1)
diff -urN autofs-3.1.3/modules/mount_changer.c 
/usr/src/autofs-3.1.3/modules/mount_changer.c
--- autofs-3.1.3/modules/mount_changer.c        Thu Jan  1 01:00:00 1970
+++ /usr/src/autofs-3.1.3/modules/mount_changer.c       Thu Dec 16 03:16:43 1999
@@ -0,0 +1,149 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *  mount_changer.c - module for Linux automountd to mount filesystems
+ *                    from cd changers
+ *
+ *   Copyright 1999 Toby Jaffey - All Rights Reserved
+ *   CD swapping code from linux kernel in Documentation/cdrom/ide-cd
+ * Based on code originally from Gerhard Zuber <[EMAIL PROTECTED]>.
+ * Changer status information, and rewrite for the new Uniform CDROM driver
+ * interface by Erik Andersen <[EMAIL PROTECTED]>.
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
+ *   USA; either version 2 of the License, or (at your option) any later
+ *   version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <stdio.h>
+#include <malloc.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <linux/cdrom.h>
+
+#define MODULE_MOUNT
+#include "automount.h"
+
+#define MODPREFIX "mount(changer): "
+int mount_version = AUTOFS_MOUNT_VERSION; /* Required by protocol */
+
+int swapCD(const char *device, const char *slotName);
+
+int mount_init(void **context)
+{
+return 0;
+}
+
+int mount_mount(const char *root, const char *name, int name_len,
+               const char *what, const char *fstype, const char *options,
+               void *context)
+{
+  char *fullpath;
+  int err;
+
+  fstype = "iso9660";
+
+  fullpath = alloca(strlen(root)+name_len+2);
+  if ( !fullpath ) {
+    syslog(LOG_ERR, MODPREFIX "alloca: %m");
+    return 1;
+  }
+  sprintf(fullpath, "%s/%s", root, name);
+
+  syslog(LOG_DEBUG, MODPREFIX "calling umount %s", what);
+  err = spawnl(LOG_DEBUG, "/bin/umount", "/bin/umount", what, NULL);
+  if ( err ) {
+    syslog(LOG_DEBUG, MODPREFIX "umount of %s failed (all may be unmounted)", what);
+  }
+
+  syslog(LOG_DEBUG, MODPREFIX "calling mkdir %s", fullpath);
+  if ( mkdir(fullpath, 0555) && errno != EEXIST ) {
+    syslog(LOG_NOTICE, MODPREFIX "mkdir %s failed: %m", name);
+    return 1;
+  }
+
+  syslog(LOG_NOTICE, MODPREFIX "Swapping CD to slot %s", name);
+  err = swapCD(what, name);
+  if ( err ) {
+    syslog(LOG_NOTICE, MODPREFIX "failed to swap CD to slot %s", name);
+    return 1;
+  }
+  if ( options ) {
+    syslog(LOG_DEBUG, MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
+          fstype, options, what, fullpath);
+    err = spawnl(LOG_DEBUG, PATH_MOUNT, PATH_MOUNT, "-t", fstype, what, SLOPPYOPT 
+"-o", options, what, fullpath, NULL);
+  } else {
+    syslog(LOG_DEBUG, MODPREFIX "calling mount -t %s %s %s",
+          fstype, what, fullpath);
+      err = spawnl(LOG_DEBUG, PATH_MOUNT, PATH_MOUNT, "-t", fstype, what, fullpath, 
+NULL);
+  }
+  if ( err ) {
+    rmdir(fullpath);
+    syslog(LOG_NOTICE, MODPREFIX "failed to mount %s (type %s) on %s",
+          what, fstype, fullpath);
+    return 1;
+  } else {
+    syslog(LOG_DEBUG, MODPREFIX "mounted %s type %s on %s",
+          what, fstype, fullpath);
+    return 0;
+  }
+}
+
+int mount_done(void *context)
+{
+  return 0;
+}
+
+int swapCD(const char *device, const char *slotName)
+{
+int fd;           /* file descriptor for CD-ROM device */
+int status;       /* return status for system calls */
+int slot=-1;
+int total_slots_available;
+
+slot = atoi (slotName) - 1;
+
+/* open device */ 
+fd = open(device, O_RDONLY | O_NONBLOCK);
+if (fd < 0)
+       {
+       syslog(LOG_NOTICE, MODPREFIX "Opening device %s failed : %s", device, 
+strerror(errno));
+       return 1;
+       }
+
+/* Check CD player status */ 
+total_slots_available = ioctl (fd, CDROM_CHANGER_NSLOTS);
+if (total_slots_available <= 1 )
+       {
+       syslog(LOG_NOTICE, MODPREFIX, "Device %s is not an ATAPI compliant CD 
+changer.\n", device);
+       return 1;
+       }
+
+/* load */ 
+slot=ioctl (fd, CDROM_SELECT_DISC, slot);
+if (slot<0)
+       {
+       syslog(LOG_NOTICE, MODPREFIX, "CDROM_SELECT_DISC failed");
+       return 1;
+       }
+
+/* close device */
+status = close (fd);
+if (status != 0)
+       {
+       syslog(LOG_NOTICE, MODPREFIX, "close failed for `%s': %s\n", device, 
+strerror(errno));
+       return 1;
+       }
+return 0;
+}
+
diff -urN autofs-3.1.3/modules/parse_sun.c /usr/src/autofs-3.1.3/modules/parse_sun.c
--- autofs-3.1.3/modules/parse_sun.c    Tue Nov  3 21:21:14 1998
+++ /usr/src/autofs-3.1.3/modules/parse_sun.c   Thu Dec 16 03:13:14 1999
@@ -491,8 +491,10 @@
                                mount_nfs->context);
   } else {
     /* Generic mount routine */
+  //  if ( !strcmp(fstype, "changer") ) // FIXME, dirty hack to allow an fstype to 
+the changer
+    //  options+=8;
     rv = do_mount(root, name, name_len, ent, fstype, options);
-  }
+    }
 
   if (options) free(options);
   return rv;

Reply via email to