Print this page
6198 Let's EOL cachefs

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c
          +++ new/usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /* LINTLIBRARY */
  23   23  /* PROTOLIB1 */
  24   24  
  25   25  /*
  26   26   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  27   27   * Use is subject to license terms.
       28 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  28   29   */
  29   30  
  30   31  /*
  31   32   * nfsstat: Network File System statistics
  32   33   *
  33   34   */
  34   35  
  35   36  #include <stdio.h>
  36   37  #include <stdlib.h>
  37   38  #include <unistd.h>
↓ open down ↓ 1070 lines elided ↑ open up ↑
1108 1109                          (void) strcpy(mrp->my_dir, m.mnt_mountp);
1109 1110                  }
1110 1111                  if ((mrp->my_path = strdup(m.mnt_special)) == NULL) {
1111 1112                          fprintf(stderr, "nfsstat: not enough memory\n");
1112 1113                          exit(1);
1113 1114                  }
1114 1115                  mrp->next = list;
1115 1116                  list = mrp;
1116 1117          }
1117 1118  
1118      -        /*
1119      -         * If something got ignored, go to the beginning of the mnttab
1120      -         * and look for the cachefs entries since they are the one
1121      -         * causing this. The mount point saved for the ignored entries
1122      -         * is matched against the special to get the actual mount point.
1123      -         * We are interested in the acutal mount point so that the output
1124      -         * look nice too.
1125      -         */
1126      -        if (ignored) {
1127      -                rewind(mt);
1128      -                resetmnttab(mt);
1129      -                while (getextmntent(mt, &m, sizeof (struct extmnttab)) == 0) {
     1119 +        (void) fclose(mt);
1130 1120  
1131      -                        /* ignore non "cachefs" */
1132      -                        if (strcmp(m.mnt_fstype, MNTTYPE_CACHEFS) != 0)
1133      -                                continue;
1134      -
1135      -                        for (mrp = list; mrp; mrp = mrp->next) {
1136      -                                if (mrp->ig_path == 0)
1137      -                                        continue;
1138      -                                if (strcmp(mrp->ig_path, m.mnt_special) == 0) {
1139      -                                        mrp->ig_path = 0;
1140      -                                        (void) strcpy(mrp->my_dir,
1141      -                                            m.mnt_mountp);
1142      -                                }
1143      -                        }
1144      -                }
     1121 +        if (ignored) {
1145 1122                  /*
1146 1123                   * Now ignored entries which do not have
1147 1124                   * the my_dir initialized are really ignored; This never
1148 1125                   * happens unless the mnttab is corrupted.
1149 1126                   */
1150 1127                  for (pmrp = 0, mrp = list; mrp; mrp = mrp->next) {
1151 1128                          if (mrp->ig_path == 0)
1152 1129                                  pmrp = mrp;
1153 1130                          else if (pmrp)
1154 1131                                  pmrp->next = mrp->next;
1155 1132                          else
1156 1133                                  list = mrp->next;
1157 1134                  }
1158 1135          }
1159 1136  
1160      -        (void) fclose(mt);
1161      -
1162      -
1163 1137          for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
1164 1138                  int i;
1165 1139  
1166 1140                  if (ksp->ks_type != KSTAT_TYPE_RAW)
1167 1141                          continue;
1168 1142                  if (strcmp(ksp->ks_module, "nfs") != 0)
1169 1143                          continue;
1170 1144                  if (strcmp(ksp->ks_name, "mntinfo") != 0)
1171 1145                          continue;
1172 1146  
↓ open down ↓ 285 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX