[BACK]Return to chfs_vnode.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / ufs / chfs

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/ufs/chfs/chfs_vnode.c between version 1.7.2.3 and 1.8

version 1.7.2.3, 2017/12/03 11:39:21 version 1.8, 2012/10/19 12:44:39
Line 34 
Line 34 
   
 #include "chfs.h"  #include "chfs.h"
 #include "chfs_inode.h"  #include "chfs_inode.h"
   #include <sys/malloc.h>
 #include <sys/kauth.h>  #include <sys/kauth.h>
 #include <sys/namei.h>  #include <sys/namei.h>
 #include <sys/uio.h>  #include <sys/uio.h>
Line 42 
Line 43 
 #include <miscfs/genfs/genfs.h>  #include <miscfs/genfs/genfs.h>
   
 /* chfs_vnode_lookup - lookup for a vnode */  /* chfs_vnode_lookup - lookup for a vnode */
 static bool  
 chfs_vnode_lookup_selector(void *ctx, struct vnode *vp)  
 {  
         ino_t *ino = ctx;  
   
         KASSERT(mutex_owned(vp->v_interlock));  
   
         return (VTOI(vp) != NULL && VTOI(vp)->ino == *ino);  
 }  
 struct vnode *  struct vnode *
 chfs_vnode_lookup(struct chfs_mount *chmp, ino_t vno)  chfs_vnode_lookup(struct chfs_mount *chmp, ino_t vno)
 {  {
         struct vnode_iterator *marker;  
         struct vnode *vp;          struct vnode *vp;
           struct chfs_inode *ip;
   
         vfs_vnode_iterator_init(chmp->chm_fsmp, &marker);          TAILQ_FOREACH(vp, &chmp->chm_fsmp->mnt_vnodelist, v_mntvnodes) {
         vp = vfs_vnode_iterator_next(marker, chfs_vnode_lookup_selector, &vno);                  ip = VTOI(vp);
         vfs_vnode_iterator_destroy(marker);                  if (ip && ip->ino == vno)
                           return vp;
         return vp;          }
           return NULL;
 }  }
   
 /* chfs_readvnode - reads a vnode from the flash and setups its inode */  /* chfs_readvnode - reads a vnode from the flash and setups its inode */
Line 101  chfs_readvnode(struct mount *mp, ino_t i
Line 94  chfs_readvnode(struct mount *mp, ino_t i
                 buf = kmem_alloc(len, KM_SLEEP);                  buf = kmem_alloc(len, KM_SLEEP);
                 err = chfs_read_leb(chmp, chvc->v->nref_lnr, buf,                  err = chfs_read_leb(chmp, chvc->v->nref_lnr, buf,
                     CHFS_GET_OFS(chvc->v->nref_offset), len, &retlen);                      CHFS_GET_OFS(chvc->v->nref_offset), len, &retlen);
                 if (err) {                  if (err)
                         kmem_free(buf, len);  
                         return err;                          return err;
                 }  
                 if (retlen != len) {                  if (retlen != len) {
                         chfs_err("Error reading vnode: read: %zu insted of: %zu\n",                          chfs_err("Error reading vnode: read: %zu insted of: %zu\n",
                             len, retlen);                              len, retlen);
                         kmem_free(buf, len);  
                         return EIO;                          return EIO;
                 }                  }
                 chfvn = (struct chfs_flash_vnode*)buf;                  chfvn = (struct chfs_flash_vnode*)buf;
Line 246  chfs_makeinode(int mode, struct vnode *d
Line 236  chfs_makeinode(int mode, struct vnode *d
         ip->target = NULL;          ip->target = NULL;
   
         ip->mode = mode;          ip->mode = mode;
         vp->v_type = type;              /* Rest init'd in chfs_loadvnode(). */          vp->v_type = type;              /* Rest init'd in getnewvnode(). */
         ip->ch_type = VTTOCHT(vp->v_type);          ip->ch_type = VTTOCHT(vp->v_type);
   
         /* authorize setting SGID if needed */          /* authorize setting SGID if needed */
Line 267  chfs_makeinode(int mode, struct vnode *d
Line 257  chfs_makeinode(int mode, struct vnode *d
         if (error) {          if (error) {
                 mutex_exit(&chmp->chm_lock_mountfields);                  mutex_exit(&chmp->chm_lock_mountfields);
                 vput(vp);                  vput(vp);
                   vput(dvp);
                 return error;                  return error;
         }          }
   
Line 278  chfs_makeinode(int mode, struct vnode *d
Line 269  chfs_makeinode(int mode, struct vnode *d
         if (error) {          if (error) {
                 mutex_exit(&chmp->chm_lock_mountfields);                  mutex_exit(&chmp->chm_lock_mountfields);
                 vput(vp);                  vput(vp);
                   vput(dvp);
                 return error;                  return error;
         }          }
           vput(dvp);
   
         /* setup directory entry */          /* setup directory entry */
         nfd = chfs_alloc_dirent(cnp->cn_namelen + 1);          nfd = chfs_alloc_dirent(cnp->cn_namelen + 1);
Line 308  chfs_makeinode(int mode, struct vnode *d
Line 301  chfs_makeinode(int mode, struct vnode *d
   
         mutex_exit(&chmp->chm_lock_mountfields);          mutex_exit(&chmp->chm_lock_mountfields);
   
         VOP_UNLOCK(vp);  
         *vpp = vp;          *vpp = vp;
         return (0);          return (0);
 }  }

Legend:
Removed from v.1.7.2.3  
changed lines
  Added in v.1.8

CVSweb <webmaster@jp.NetBSD.org>