diff -u --recursive amd-upl102/amd/cdfs_ops.c amd-upl102.b/amd/cdfs_ops.c --- amd-upl102/amd/cdfs_ops.c Sun Nov 6 04:28:08 1994 +++ amd-upl102.b/amd/cdfs_ops.c Mon Sep 25 11:42:10 1995 @@ -170,7 +170,7 @@ 0, /* cdfs_mounted */ 0, /* cdfs_umounted */ find_afs_srvr, - FS_MKMNT|FS_NOTIMEOUT|FS_UBACKGROUND|FS_AMQINFO + FS_MKMNT|FS_UBACKGROUND|FS_AMQINFO }; #endif /* HAS_CDFS */ diff -u --recursive amd-upl102/amd/nfs_start.c amd-upl102.b/amd/nfs_start.c --- amd-upl102/amd/nfs_start.c Sun Nov 6 04:28:13 1994 +++ amd-upl102.b/amd/nfs_start.c Mon Sep 25 11:42:10 1995 @@ -98,7 +98,7 @@ static char *max_mem = 0; int next_fd = dup(0); -#ifdef __hpux +#if defined (__hpux) || defined (linux) extern void *sbrk P((int)); #else extern caddr_t sbrk P((int)); diff -u --recursive amd-upl102/amd/pcfs_ops.c amd-upl102.b/amd/pcfs_ops.c --- amd-upl102/amd/pcfs_ops.c Sun Nov 6 04:28:15 1994 +++ amd-upl102.b/amd/pcfs_ops.c Mon Sep 25 11:47:12 1995 @@ -148,7 +148,11 @@ * Ops structure */ am_ops pcfs_ops = { +#ifdef MTAB_TYPE_PCFS + MTAB_TYPE_PCFS, +#else "pcfs", +#endif /* MTAB_TYPE_PCFS */ pcfs_match, 0, /* pcfs_init */ auto_fmount, @@ -161,7 +165,7 @@ 0, /* pcfs_mounted */ 0, /* pcfs_umounted */ find_afs_srvr, - FS_MKMNT|FS_NOTIMEOUT|FS_UBACKGROUND|FS_AMQINFO + FS_MKMNT|FS_UBACKGROUND|FS_AMQINFO }; #endif /* HAS_PCFS */ diff -u --recursive amd-upl102/config/Makefile.linux amd-upl102.b/config/Makefile.linux --- amd-upl102/config/Makefile.linux Sun Nov 6 04:28:36 1994 +++ amd-upl102.b/config/Makefile.linux Mon Sep 25 11:42:11 1995 @@ -47,7 +47,7 @@ CC=gcc SYSCC=${CC} CCOPTS= -s -O6 -I/usr/include/bsd -DHAS_REGEXP -DDEBUG -DHAS_STRDUP \ - -DMOUNT_TYPE_UFS=\"minix\" -DLinux_DEBUG + -DMOUNT_TYPE_UFS=\"ext2\" -DLinux_DEBUG -m486 RPCLIB = YACC=bison -y LEX=flex diff -u --recursive amd-upl102/config/mount_linux.c amd-upl102.b/config/mount_linux.c --- amd-upl102/config/mount_linux.c Sun Nov 6 04:28:41 1994 +++ amd-upl102.b/config/mount_linux.c Mon Sep 25 11:42:11 1995 @@ -65,51 +65,110 @@ { NULL, 0, 0 } }; -static inline void -parse_opt (const char *opt, int *mask, char *extra_opts) -{ - const struct opt_map *om; - - for (om = opt_map; om->opt != NULL; ++om) - if (STREQ (opt, om->opt)) - { - if (om->inv) - *mask &= ~om->mask; - else - *mask |= om->mask; - return; - } - strcat (extra_opts, ","); - strcat (extra_opts, opt); -} +/* + * New parser for linux-specific mounts + * Should now handle fs-type specific mount-options correctly + * Currently implemented: msdos, iso9660 + * + * -- Hannes Reinecke 092095 + */ -/* Take -o options list and compute 4th and 5th args to mount(2). flags - gets the standard options and extra_opts anything we don't recognize. */ -static void -parse_opts (char *opts, int *flags, char **extra_opts, int *noauto) +struct fs_opts { const char *opt; + int type; +}; + +const struct fs_opts iso_opts[] = { + { "map", 0 }, + { "norock", 0 }, + { "cruft", 0 }, + { "unhide", 0 }, + { "conv", 1 }, + { "block", 1 }, + { "mode", 1 }, + { "gid", 1 }, + { "uid", 1 }, + { NULL, 0 } +}; + +const struct fs_opts dos_opts[] = { + { "check", 1 }, + { "conv", 1 }, + { "uid", 1 }, + { "gid", 1 }, + { "umask", 1 }, + { "debug", 0 }, + { "fat", 1 }, + { "quiet", 0 }, + { "blocksize", 1 }, + { NULL, 0 } +}; + +char * parse( type, optstr, flags, xopts, noauto ) + char *type; + char *optstr; + int *flags; + char **xopts; + int *noauto; { - char *opt; - int readonly = 0, readwrite = 0; + const struct opt_map *std_opts; + const struct fs_opts *dev_opts; + char *opt, *topts; + + *noauto = 0; + if (optstr != NULL) + { + *xopts = (char *)malloc (strlen (optstr) + 2); + topts = (char *)malloc (strlen(optstr) + 2); + *topts = '\0'; + **xopts = '\0'; - *noauto = 0; - if (opts != NULL) + for(opt = strtok(optstr,","); opt; opt = strtok(NULL,",")) { - *extra_opts = xmalloc (strlen (opts) + 2); - **extra_opts = '\0'; - - for (opt = strtok (opts, ","); - opt != NULL; - opt = strtok (NULL, ",")) - if (!((readwrite = (STREQ (opt, "rw"))) || - (readonly = (STREQ (opt, "ro"))) || - (*noauto = (STREQ (opt, "noauto"))) || - (strncmp(opt,"type",4)==0))) - parse_opt (opt, flags, *extra_opts); +/* + * First, parse standard options + */ + std_opts = opt_map; + while(std_opts->opt && + strncmp(std_opts->opt,opt,strlen(std_opts->opt))) + ++std_opts; + if(!(*noauto = STREQ(opt,"noauto")) || std_opts->opt) + { + strcat(topts,opt); + strcat(topts,","); + if (std_opts->inv) + *flags &= ~std_opts->mask; + else + *flags |= std_opts->mask; + } +/* + * Next, select which fs-type is to be used + * and parse the fs-specific options + */ + if(strcmp(type,MOUNT_TYPE_PCFS)) dev_opts = dos_opts; + else if(strcmp(type,MOUNT_TYPE_CDFS)) dev_opts = iso_opts; + else + { + plog(XLOG_FATAL,"linux mount: unknown fs-type: %s\n",type); + return NULL; + } + while(dev_opts->opt && + strncmp(dev_opts->opt,opt,strlen(dev_opts->opt))) + ++dev_opts; + if(dev_opts->opt) + { + strcat(*xopts,opt); + strcat(*xopts,","); + } } - if (readonly) - *flags |= MS_RDONLY; - if (readwrite) - *flags &= ~MS_RDONLY; +/* + * All other options are discarded + */ + if(strlen(*xopts)) *(*xopts + strlen(*xopts)-1) = '\0'; + if(strlen(topts)) topts[strlen(topts)-1] = 0; + return(topts); + } + else + return NULL; } int linux_mount(type, mnt, flags, mnt_data) @@ -127,8 +186,12 @@ if (mnt->mnt_opts && STREQ (mnt->mnt_opts, "defaults")) mnt->mnt_opts = NULL; - if (type == NULL) + if (type == NULL) { type = (index (mnt->mnt_fsname, ':') != NULL) ? "nfs" : MOUNT_TYPE_UFS ; +#ifdef Linux_DEBUG + plog(XLOG_INFO, "linux mount: guessing type %s\n",type); +#endif + } if (STREQ(type,"nfs")) { /* Fake some values for linux */ @@ -165,9 +228,12 @@ type=MOUNT_TYPE_UFS : (*type=(char)NULL), type=sub_type; - if (!hasmntopt(mnt,"type")) mnt->mnt_type=MOUNT_TYPE_UFS; + if (!hasmntopt(mnt,"type")) + { + mnt->mnt_type=type; + } /* We only parse opts if non nfs drive */ - parse_opts (tmp_opts=strdup (mnt->mnt_opts), &flags, &extra_opts, &noauto); + tmp_opts = parse (type, mnt->mnt_opts, &flags, &extra_opts, &noauto); #ifdef Linux_DEBUG plog(XLOG_INFO, "linux mount: type %s\n",type); @@ -177,7 +243,7 @@ #ifdef Linux_DEBUG plog(XLOG_INFO, "linux mount: fsname %s\n",mnt->mnt_fsname); plog(XLOG_INFO, "linux mount: type (mntent) %s\n",mnt->mnt_type); - plog(XLOG_INFO, "linux mount: opts %s\n",mnt->mnt_opts); + plog(XLOG_INFO, "linux mount: opts %s\n",tmp_opts); plog(XLOG_INFO, "linux mount: dir %s\n",mnt->mnt_dir); #endif @@ -191,7 +257,6 @@ */ if (errorcode) if (mnt_data->fd != -1) close (mnt_data->fd); - /* Free all allocated space and return errorcode. */ fail: if (extra_opts != NULL) free (extra_opts); Only in amd-upl102.b/config: mount_linux.c.orig diff -u --recursive amd-upl102/config/os-linux.h amd-upl102.b/config/os-linux.h --- amd-upl102/config/os-linux.h Sun Nov 6 04:28:47 1994 +++ amd-upl102.b/config/os-linux.h Mon Sep 25 11:46:53 1995 @@ -54,7 +54,8 @@ /* This is to say that Linux uses names (i.e. char *) * in it's types parameter to mount() */ -#define M_NEWTYPE +#define M_NEWTYPE 0 +#define NFS_4 #define FNDELAY O_NDELAY #define NFS_FHSIZE 32 @@ -126,6 +127,14 @@ #undef MTAB_TYPE_UFS #define MTAB_TYPE_UFS "vfs" +#define HAS_CDFS +#define MOUNT_TYPE_CDFS MNTTYPE_ISO9660 /* defined in */ +#define MTAB_TYPE_CDFS MNTTYPE_ISO9660 + +#define HAS_PCFS +#define MOUNT_TYPE_PCFS MNTTYPE_MSDOS /* defined in */ +#define MTAB_TYPE_PCFS MNTTYPE_MSDOS + /* * Name of mount & unmount system calls * @@ -258,6 +267,14 @@ #define M_REMOUNT 32 /* alter flags of a mounted FS */ struct ufs_args { + char *fspec; /* Block device */ +}; + +struct pc_args { + char *fspec; /* Block device */ +}; + +struct cdfs_args { char *fspec; /* Block device */ };