[BACK]Return to msdosfs_vfsops.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / fs / msdosfs

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

Diff for /src/sys/fs/msdosfs/msdosfs_vfsops.c between version 1.50.2.4 and 1.51

version 1.50.2.4, 2007/12/09 19:38:08 version 1.51, 2007/09/24 00:42:13
Line 119  struct vfsops msdosfs_vfsops = {
Line 119  struct vfsops msdosfs_vfsops = {
         msdosfs_start,          msdosfs_start,
         msdosfs_unmount,          msdosfs_unmount,
         msdosfs_root,          msdosfs_root,
         (void *)eopnotsupp,             /* vfs_quotactl */          msdosfs_quotactl,
         msdosfs_statvfs,          msdosfs_statvfs,
         msdosfs_sync,          msdosfs_sync,
         msdosfs_vget,          msdosfs_vget,
Line 211  msdosfs_mountroot()
Line 211  msdosfs_mountroot()
         if ((error = msdosfs_mountfs(rootvp, mp, l, &args)) != 0) {          if ((error = msdosfs_mountfs(rootvp, mp, l, &args)) != 0) {
                 mp->mnt_op->vfs_refcount--;                  mp->mnt_op->vfs_refcount--;
                 vfs_unbusy(mp);                  vfs_unbusy(mp);
                 vfs_destroy(mp);                  free(mp, M_MOUNT);
                 return (error);                  return (error);
         }          }
   
         if ((error = update_mp(mp, &args)) != 0) {          if ((error = update_mp(mp, &args)) != 0) {
                 (void)msdosfs_unmount(mp, 0);                  (void)msdosfs_unmount(mp, 0, l);
                 vfs_unbusy(mp);                  vfs_unbusy(mp);
                 vfs_destroy(mp);                  free(mp, M_MOUNT);
                 vrele(rootvp);                  vrele(rootvp);
                 return (error);                  return (error);
         }          }
   
         mutex_enter(&mountlist_lock);          simple_lock(&mountlist_slock);
         CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);          CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
         mutex_exit(&mountlist_lock);          simple_unlock(&mountlist_slock);
         (void)msdosfs_statvfs(mp, &mp->mnt_stat);          (void)msdosfs_statvfs(mp, &mp->mnt_stat, l);
         vfs_unbusy(mp);          vfs_unbusy(mp);
         return (0);          return (0);
 }  }
Line 237  msdosfs_mountroot()
Line 237  msdosfs_mountroot()
  * special file to treat as a filesystem.   * special file to treat as a filesystem.
  */   */
 int  int
 msdosfs_mount(mp, path, data, data_len)  msdosfs_mount(mp, path, data, data_len, l)
         struct mount *mp;          struct mount *mp;
         const char *path;          const char *path;
         void *data;          void *data;
         size_t *data_len;          size_t *data_len;
           struct lwp *l;
 {  {
         struct lwp *l = curlwp;  
         struct nameidata nd;          struct nameidata nd;
         struct vnode *devvp;      /* vnode for blk device to mount */          struct vnode *devvp;      /* vnode for blk device to mount */
         struct msdosfs_args *args = data; /* holds data from mount request */          struct msdosfs_args *args = data; /* holds data from mount request */
Line 316  msdosfs_mount(mp, path, data, data_len)
Line 316  msdosfs_mount(mp, path, data, data_len)
                                 devvp = pmp->pm_devvp;                                  devvp = pmp->pm_devvp;
                                 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);                                  vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
                                 error = VOP_ACCESS(devvp, VREAD | VWRITE,                                  error = VOP_ACCESS(devvp, VREAD | VWRITE,
                                                    l->l_cred);                                                     l->l_cred, l);
                                 VOP_UNLOCK(devvp, 0);                                  VOP_UNLOCK(devvp, 0);
                                 DPRINTF(("VOP_ACCESS %d\n", error));                                  DPRINTF(("VOP_ACCESS %d\n", error));
                                 if (error)                                  if (error)
Line 333  msdosfs_mount(mp, path, data, data_len)
Line 333  msdosfs_mount(mp, path, data, data_len)
          * Not an update, or updating the name: look up the name           * Not an update, or updating the name: look up the name
          * and verify that it refers to a sensible block device.           * and verify that it refers to a sensible block device.
          */           */
         NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec);          NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
         if ((error = namei(&nd)) != 0) {          if ((error = namei(&nd)) != 0) {
                 DPRINTF(("namei %d\n", error));                  DPRINTF(("namei %d\n", error));
                 return (error);                  return (error);
Line 359  msdosfs_mount(mp, path, data, data_len)
Line 359  msdosfs_mount(mp, path, data, data_len)
                 if ((mp->mnt_flag & MNT_RDONLY) == 0)                  if ((mp->mnt_flag & MNT_RDONLY) == 0)
                         accessmode |= VWRITE;                          accessmode |= VWRITE;
                 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);                  vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
                 error = VOP_ACCESS(devvp, accessmode, l->l_cred);                  error = VOP_ACCESS(devvp, accessmode, l->l_cred, l);
                 VOP_UNLOCK(devvp, 0);                  VOP_UNLOCK(devvp, 0);
                 if (error) {                  if (error) {
                         DPRINTF(("VOP_ACCESS2 %d\n", error));                          DPRINTF(("VOP_ACCESS2 %d\n", error));
Line 390  msdosfs_mount(mp, path, data, data_len)
Line 390  msdosfs_mount(mp, path, data, data_len)
                         xflags = FREAD;                          xflags = FREAD;
                 else                  else
                         xflags = FREAD|FWRITE;                          xflags = FREAD|FWRITE;
                 error = VOP_OPEN(devvp, xflags, FSCRED);                  error = VOP_OPEN(devvp, xflags, FSCRED, l);
                 if (error) {                  if (error) {
                         DPRINTF(("VOP_OPEN %d\n", error));                          DPRINTF(("VOP_OPEN %d\n", error));
                         goto fail;                          goto fail;
Line 399  msdosfs_mount(mp, path, data, data_len)
Line 399  msdosfs_mount(mp, path, data, data_len)
                 if (error) {                  if (error) {
                         DPRINTF(("msdosfs_mountfs %d\n", error));                          DPRINTF(("msdosfs_mountfs %d\n", error));
                         vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);                          vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
                         (void) VOP_CLOSE(devvp, xflags, NOCRED);                          (void) VOP_CLOSE(devvp, xflags, NOCRED, l);
                         VOP_UNLOCK(devvp, 0);                          VOP_UNLOCK(devvp, 0);
                         goto fail;                          goto fail;
                 }                  }
Line 415  msdosfs_mount(mp, path, data, data_len)
Line 415  msdosfs_mount(mp, path, data, data_len)
                 }                  }
         }          }
         if ((error = update_mp(mp, args)) != 0) {          if ((error = update_mp(mp, args)) != 0) {
                 msdosfs_unmount(mp, MNT_FORCE);                  msdosfs_unmount(mp, MNT_FORCE, l);
                 DPRINTF(("update_mp %d\n", error));                  DPRINTF(("update_mp %d\n", error));
                 return error;                  return error;
         }          }
Line 470  msdosfs_mountfs(devvp, mp, l, argp)
Line 470  msdosfs_mountfs(devvp, mp, l, argp)
          * that the size of a disk block will always be 512 bytes.           * that the size of a disk block will always be 512 bytes.
          * Let's root them out...           * Let's root them out...
          */           */
         error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED);          error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED, l);
         if (error == 0) {          if (error == 0) {
                 secsize = dpart.disklab->d_secsize;                  secsize = dpart.disklab->d_secsize;
                 dtype = dpart.disklab->d_type;                  dtype = dpart.disklab->d_type;
Line 478  msdosfs_mountfs(devvp, mp, l, argp)
Line 478  msdosfs_mountfs(devvp, mp, l, argp)
                 psize = dpart.part->p_size;                  psize = dpart.part->p_size;
         } else {          } else {
                 struct dkwedge_info dkw;                  struct dkwedge_info dkw;
                 error = VOP_IOCTL(devvp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED);                  error = VOP_IOCTL(devvp, DIOCGWEDGEINFO, &dkw, FREAD,
                       NOCRED, l);
                 secsize = 512;  /* XXX */                  secsize = 512;  /* XXX */
                 dtype = DTYPE_FLOPPY; /* XXX */                  dtype = DTYPE_FLOPPY; /* XXX */
                 fstype = FS_MSDOS;                  fstype = FS_MSDOS;
Line 513  msdosfs_mountfs(devvp, mp, l, argp)
Line 514  msdosfs_mountfs(devvp, mp, l, argp)
          */           */
         if ((error = bread(devvp, 0, secsize, NOCRED, &bp)) != 0)          if ((error = bread(devvp, 0, secsize, NOCRED, &bp)) != 0)
                 goto error_exit;                  goto error_exit;
           bp->b_flags |= B_AGE;
         bsp = (union bootsector *)bp->b_data;          bsp = (union bootsector *)bp->b_data;
         b33 = (struct byte_bpb33 *)bsp->bs33.bsBPB;          b33 = (struct byte_bpb33 *)bsp->bs33.bsBPB;
         b50 = (struct byte_bpb50 *)bsp->bs50.bsBPB;          b50 = (struct byte_bpb50 *)bsp->bs50.bsBPB;
Line 719  msdosfs_mountfs(devvp, mp, l, argp)
Line 721  msdosfs_mountfs(devvp, mp, l, argp)
         /*          /*
          * Release the bootsector buffer.           * Release the bootsector buffer.
          */           */
         brelse(bp, BC_AGE);          brelse(bp);
         bp = NULL;          bp = NULL;
   
         /*          /*
Line 744  msdosfs_mountfs(devvp, mp, l, argp)
Line 746  msdosfs_mountfs(devvp, mp, l, argp)
                         pmp->pm_nxtfree = getulong(fp->fsinxtfree);                          pmp->pm_nxtfree = getulong(fp->fsinxtfree);
                 else                  else
                         pmp->pm_fsinfo = 0;                          pmp->pm_fsinfo = 0;
                 brelse(bp, 0);                  brelse(bp);
                 bp = NULL;                  bp = NULL;
         }          }
   
Line 820  msdosfs_mountfs(devvp, mp, l, argp)
Line 822  msdosfs_mountfs(devvp, mp, l, argp)
   
 error_exit:;  error_exit:;
         if (bp)          if (bp)
                 brelse(bp, BC_AGE);                  brelse(bp);
         if (pmp) {          if (pmp) {
                 if (pmp->pm_inusemap)                  if (pmp->pm_inusemap)
                         free(pmp->pm_inusemap, M_MSDOSFSFAT);                          free(pmp->pm_inusemap, M_MSDOSFSFAT);
Line 831  error_exit:;
Line 833  error_exit:;
 }  }
   
 int  int
 msdosfs_start(struct mount *mp, int flags)  msdosfs_start(struct mount *mp, int flags,
       struct lwp *l)
 {  {
   
         return (0);          return (0);
Line 841  msdosfs_start(struct mount *mp, int flag
Line 844  msdosfs_start(struct mount *mp, int flag
  * Unmount the filesystem described by mp.   * Unmount the filesystem described by mp.
  */   */
 int  int
 msdosfs_unmount(mp, mntflags)  msdosfs_unmount(mp, mntflags, l)
         struct mount *mp;          struct mount *mp;
         int mntflags;          int mntflags;
           struct lwp *l;
 {  {
         struct msdosfsmount *pmp;          struct msdosfsmount *pmp;
         int error, flags;          int error, flags;
Line 864  msdosfs_unmount(mp, mntflags)
Line 868  msdosfs_unmount(mp, mntflags)
   
                 printf("msdosfs_umount(): just before calling VOP_CLOSE()\n");                  printf("msdosfs_umount(): just before calling VOP_CLOSE()\n");
                 printf("flag %08x, usecount %d, writecount %ld, holdcnt %ld\n",                  printf("flag %08x, usecount %d, writecount %ld, holdcnt %ld\n",
                     vp->v_vflag | vp->v_iflag | vp->v_uflag, vp->v_usecount,                      vp->v_flag, vp->v_usecount, vp->v_writecount, vp->v_holdcnt);
                     vp->v_writecount, vp->v_holdcnt);  
                 printf("mount %p, op %p\n",                  printf("mount %p, op %p\n",
                     vp->v_mount, vp->v_op);                      vp->v_mount, vp->v_op);
                 printf("freef %p, freeb %p, mount %p\n",                  printf("freef %p, freeb %p, mount %p\n",
Line 883  msdosfs_unmount(mp, mntflags)
Line 886  msdosfs_unmount(mp, mntflags)
 #endif  #endif
         vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY);          vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY);
         error = VOP_CLOSE(pmp->pm_devvp,          error = VOP_CLOSE(pmp->pm_devvp,
             pmp->pm_flags & MSDOSFSMNT_RONLY ? FREAD : FREAD|FWRITE, NOCRED);              pmp->pm_flags & MSDOSFSMNT_RONLY ? FREAD : FREAD|FWRITE, NOCRED, l);
         vput(pmp->pm_devvp);          vput(pmp->pm_devvp);
         free(pmp->pm_inusemap, M_MSDOSFSFAT);          free(pmp->pm_inusemap, M_MSDOSFSFAT);
         free(pmp, M_MSDOSFSMNT);          free(pmp, M_MSDOSFSMNT);
Line 911  msdosfs_root(mp, vpp)
Line 914  msdosfs_root(mp, vpp)
 }  }
   
 int  int
 msdosfs_statvfs(struct mount *mp, struct statvfs *sbp)  msdosfs_quotactl(struct mount *mp, int cmds,
       uid_t uid, void *arg, struct lwp *l)
   {
   
           return (EOPNOTSUPP);
   }
   
   int
   msdosfs_statvfs(struct mount *mp, struct statvfs *sbp, struct lwp *l)
 {  {
         struct msdosfsmount *pmp;          struct msdosfsmount *pmp;
   
Line 932  msdosfs_statvfs(struct mount *mp, struct
Line 943  msdosfs_statvfs(struct mount *mp, struct
 }  }
   
 int  int
 msdosfs_sync(mp, waitfor, cred)  msdosfs_sync(mp, waitfor, cred, l)
         struct mount *mp;          struct mount *mp;
         int waitfor;          int waitfor;
         kauth_cred_t cred;          kauth_cred_t cred;
           struct lwp *l;
 {  {
         struct vnode *vp, *nvp;          struct vnode *vp, *nvp;
         struct denode *dep;          struct denode *dep;
Line 985  loop:
Line 997  loop:
                         continue;                          continue;
                 }                  }
                 if ((error = VOP_FSYNC(vp, cred,                  if ((error = VOP_FSYNC(vp, cred,
                     waitfor == MNT_WAIT ? FSYNC_WAIT : 0, 0, 0)) != 0)                      waitfor == MNT_WAIT ? FSYNC_WAIT : 0, 0, 0, l)) != 0)
                         allerror = error;                          allerror = error;
                 vput(vp);                  vput(vp);
                 simple_lock(&mntvnode_slock);                  simple_lock(&mntvnode_slock);
Line 995  loop:
Line 1007  loop:
          * Force stale file system control information to be flushed.           * Force stale file system control information to be flushed.
          */           */
         if ((error = VOP_FSYNC(pmp->pm_devvp, cred,          if ((error = VOP_FSYNC(pmp->pm_devvp, cred,
             waitfor == MNT_WAIT ? FSYNC_WAIT : 0, 0, 0)) != 0)              waitfor == MNT_WAIT ? FSYNC_WAIT : 0, 0, 0, l)) != 0)
                 allerror = error;                  allerror = error;
 #ifdef QUOTA  #ifdef QUOTA
         /* qsync(mp); */          /* qsync(mp); */

Legend:
Removed from v.1.50.2.4  
changed lines
  Added in v.1.51

CVSweb <webmaster@jp.NetBSD.org>