Print this page
6198 Let's EOL cachefs

@@ -21,10 +21,11 @@
 /*
  *      autod_parse.c
  *
  *      Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  *      Use is subject to license terms.
+ *      Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  */
 
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>

@@ -559,12 +560,10 @@
                 node = node->leveldir;
         }
         return (rc);
 }
 
-#define BACKFSTYPE "backfstype" /* used in cachefs options */
-#define BACKFSTYPE_EQ "backfstype="
 #define FSTYPE "fstype"
 #define FSTYPE_EQ "fstype="
 #define NO_OPTS ""
 
 /*

@@ -606,37 +605,10 @@
         if ((me->map_mntopts = strdup(entryopts)) == NULL)
                 return (ENOMEM);
         strcpy(mounter, fstype);
 
         /*
-         * The following ugly chunk of code crept in as a result of
-         * cachefs.  If it's a cachefs mount of an nfs filesystem, then
-         * it's important to parse the nfs special field.  Otherwise,
-         * just hand the special field to the fs-specific mount
-         */
-        if (strcmp(fstype, MNTTYPE_CACHEFS) ==  0) {
-                struct mnttab m;
-                char *p;
-
-                m.mnt_mntopts = entryopts;
-                if ((p = hasmntopt(&m, BACKFSTYPE)) != NULL) {
-                        int len = strlen(MNTTYPE_NFS);
-
-                        p += strlen(BACKFSTYPE_EQ);
-
-                        if (strncmp(p, MNTTYPE_NFS, len) ==  0 &&
-                            (p[len] == '\0' || p[len] == ',')) {
-                                /*
-                                 * Cached nfs mount
-                                 */
-                                (void) strcpy(fstype, MNTTYPE_NFS);
-                                (void) strcpy(mounter, MNTTYPE_CACHEFS);
-                        }
-                }
-        }
-
-        /*
          * child options are exactly fstype = somefs, we need to do some
          * more option pushing work.
          */
         if (fstype_opt == TRUE &&
             (strcmp(me->map_mntopts, NO_OPTS) == 0)) {

@@ -662,13 +634,13 @@
  * Check the option string for an "fstype"
  * option.  If found, return the fstype
  * and the option string with the fstype
  * option removed, e.g.
  *
- *  input:  "fstype=cachefs,ro,nosuid"
+ *  input:  "fstype=nfs,ro,nosuid"
  *  opts:   "ro,nosuid"
- *  fstype: "cachefs"
+ *  fstype: "nfs"
  *
  * Also indicates if the fstype option was present
  * by setting a flag, if the pointer to the flag
  * is not NULL.
  */

@@ -708,11 +680,10 @@
  */
 static int
 fstype_opts(struct mapent *me, char *opts, char *defaultopts,
                                 char *mapopts)
 {
-        char pushopts[AUTOFS_MAXOPTSLEN];
         char pushentryopts[AUTOFS_MAXOPTSLEN];
         char pushfstype[MAX_FSLEN];
 
         if (defaultopts && *defaultopts == '-')
                 defaultopts++;

@@ -724,19 +695,14 @@
          */
         if (strcmp(defaultopts, opts) == 0) {
                 if (*mapopts == '-')
                         mapopts++;
                 get_opts(mapopts, pushentryopts, pushfstype, NULL);
-                strcpy(pushopts, mapopts);
         } else {
                 get_opts(defaultopts, pushentryopts, pushfstype, NULL);
-                strcpy(pushopts, defaultopts);
         }
 
-        if (strcmp(pushfstype, MNTTYPE_CACHEFS) == 0)
-                me->map_mntopts = strdup(pushopts);
-        else
                 me->map_mntopts = strdup(pushentryopts);
 
         if (!me->map_mntopts) {
                 syslog(LOG_ERR, "fstype_opts: No memory");
                 return (ENOMEM);

@@ -1987,39 +1953,14 @@
                         *texp = ex;
                 }
         }
         exlist = texlist;
 
-        /*
-         * The following ugly chunk of code crept in as
-         * a result of cachefs.  If it's a cachefs mount
-         * of an nfs filesystem, then have it handled as
-         * an nfs mount but have cachefs do the mount.
-         */
         (void) strcpy(fstype, MNTTYPE_NFS);
         get_opts(mapopts, entryopts, fstype, NULL);
         (void) strcpy(mounter, fstype);
-        if (strcmp(fstype, MNTTYPE_CACHEFS) == 0) {
-                struct mnttab m;
-                char *p;
 
-                m.mnt_mntopts = entryopts;
-                if ((p = hasmntopt(&m, "backfstype")) != NULL) {
-                        int len = strlen(MNTTYPE_NFS);
-
-                        p += 11;
-                        if (strncmp(p, MNTTYPE_NFS, len) == 0 &&
-                            (p[len] == '\0' || p[len] == ',')) {
-                                /*
-                                 * Cached nfs mount
-                                 */
-                                (void) strcpy(fstype, MNTTYPE_NFS);
-                                (void) strcpy(mounter, MNTTYPE_CACHEFS);
-                        }
-                }
-        }
-
         /* Now create a mapent from the export list */
         ms = NULL;
         me = NULL;
 
         for (ex = exlist; ex; ex = ex->ex_next) {