Print this page
basic fsh prototype (no comments yet)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/vnode.c
          +++ new/usr/src/uts/common/fs/vnode.c
↓ open down ↓ 57 lines elided ↑ open up ↑
  58   58  #include <sys/systm.h>
  59   59  #include <sys/kmem.h>
  60   60  #include <sys/debug.h>
  61   61  #include <c2/audit.h>
  62   62  #include <sys/acl.h>
  63   63  #include <sys/nbmlock.h>
  64   64  #include <sys/fcntl.h>
  65   65  #include <fs/fs_subr.h>
  66   66  #include <sys/taskq.h>
  67   67  #include <fs/fs_reparse.h>
       68 +#include <sys/fsh_impl.h>
  68   69  
  69   70  /* Determine if this vnode is a file that is read-only */
  70   71  #define ISROFILE(vp)    \
  71   72          ((vp)->v_type != VCHR && (vp)->v_type != VBLK && \
  72   73              (vp)->v_type != VFIFO && vn_is_readonly(vp))
  73   74  
  74   75  /* Tunable via /etc/system; used only by admin/install */
  75   76  int nfs_global_client_only;
  76   77  
  77   78  /*
↓ open down ↓ 3057 lines elided ↑ open up ↑
3135 3136           */
3136 3137          if ((*vpp)->v_type == VREG) {
3137 3138                  if (mode & FREAD)
3138 3139                          atomic_add_32(&((*vpp)->v_rdcnt), 1);
3139 3140                  if (mode & FWRITE)
3140 3141                          atomic_add_32(&((*vpp)->v_wrcnt), 1);
3141 3142          }
3142 3143  
3143 3144          VOPXID_MAP_CR(vp, cr);
3144 3145  
3145      -        ret = (*(*(vpp))->v_op->vop_open)(vpp, mode, cr, ct);
     3146 +        /*
     3147 +         * Control is passed to fsh. In the end, underlying vop_vopen()
     3148 +         * is called.
     3149 +         */
     3150 +        ret = fsh_open(vpp, mode, cr, ct);
3146 3151  
3147 3152          if (ret) {
3148 3153                  /*
3149 3154                   * Use the saved vp just in case the vnode ptr got trashed
3150 3155                   * by the error.
3151 3156                   */
3152 3157                  VOPSTATS_UPDATE(vp, open);
3153 3158                  if ((vp->v_type == VREG) && (mode & FREAD))
3154 3159                          atomic_add_32(&(vp->v_rdcnt), -1);
3155 3160                  if ((vp->v_type == VREG) && (mode & FWRITE))
↓ open down ↓ 30 lines elided ↑ open up ↑
3186 3191          int flag,
3187 3192          int count,
3188 3193          offset_t offset,
3189 3194          cred_t *cr,
3190 3195          caller_context_t *ct)
3191 3196  {
3192 3197          int err;
3193 3198  
3194 3199          VOPXID_MAP_CR(vp, cr);
3195 3200  
3196      -        err = (*(vp)->v_op->vop_close)(vp, flag, count, offset, cr, ct);
     3201 +        err = fsh_close(vp, flag, count, offset, cr, ct);
3197 3202          VOPSTATS_UPDATE(vp, close);
3198 3203          /*
3199 3204           * Check passed in count to handle possible dups. Vnode counts are only
3200 3205           * kept on regular files
3201 3206           */
3202 3207          if ((vp->v_type == VREG) && (count == 1))  {
3203 3208                  if (flag & FREAD) {
3204 3209                          ASSERT(vp->v_rdcnt > 0);
3205 3210                          atomic_add_32(&(vp->v_rdcnt), -1);
3206 3211                  }
↓ open down ↓ 11 lines elided ↑ open up ↑
3218 3223          uio_t *uiop,
3219 3224          int ioflag,
3220 3225          cred_t *cr,
3221 3226          caller_context_t *ct)
3222 3227  {
3223 3228          int     err;
3224 3229          ssize_t resid_start = uiop->uio_resid;
3225 3230  
3226 3231          VOPXID_MAP_CR(vp, cr);
3227 3232  
3228      -        err = (*(vp)->v_op->vop_read)(vp, uiop, ioflag, cr, ct);
     3233 +        err = fsh_read(vp, uiop, ioflag, cr, ct);
3229 3234          VOPSTATS_UPDATE_IO(vp, read,
3230 3235              read_bytes, (resid_start - uiop->uio_resid));
3231 3236          return (err);
3232 3237  }
3233 3238  
3234 3239  int
3235 3240  fop_write(
3236 3241          vnode_t *vp,
3237 3242          uio_t *uiop,
3238 3243          int ioflag,
3239 3244          cred_t *cr,
3240 3245          caller_context_t *ct)
3241 3246  {
3242 3247          int     err;
3243 3248          ssize_t resid_start = uiop->uio_resid;
3244 3249  
3245 3250          VOPXID_MAP_CR(vp, cr);
3246 3251  
3247      -        err = (*(vp)->v_op->vop_write)(vp, uiop, ioflag, cr, ct);
     3252 +        err = fsh_write(vp, uiop, ioflag, cr, ct);
3248 3253          VOPSTATS_UPDATE_IO(vp, write,
3249 3254              write_bytes, (resid_start - uiop->uio_resid));
3250 3255          return (err);
3251 3256  }
3252 3257  
3253 3258  int
3254 3259  fop_ioctl(
3255 3260          vnode_t *vp,
3256 3261          int cmd,
3257 3262          intptr_t arg,
↓ open down ↓ 1279 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX