version 1.118.2.2, 2017/01/07 08:56:47 |
version 1.118.2.3, 2017/03/20 06:57:46 |
Line 69 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 69 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include <sys/device.h> |
#include <sys/device.h> |
#include <sys/disklabel.h> |
#include <sys/disklabel.h> |
#include <sys/disk.h> |
#include <sys/disk.h> |
#include <sys/fstrans.h> |
|
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
#include <sys/malloc.h> |
#include <sys/malloc.h> |
#include <sys/dirent.h> |
#include <sys/dirent.h> |
Line 136 struct vfsops msdosfs_vfsops = { |
|
Line 135 struct vfsops msdosfs_vfsops = { |
|
.vfs_mountroot = msdosfs_mountroot, |
.vfs_mountroot = msdosfs_mountroot, |
.vfs_snapshot = (void *)eopnotsupp, |
.vfs_snapshot = (void *)eopnotsupp, |
.vfs_extattrctl = vfs_stdextattrctl, |
.vfs_extattrctl = vfs_stdextattrctl, |
.vfs_suspendctl = msdosfs_suspendctl, |
.vfs_suspendctl = genfs_suspendctl, |
.vfs_renamelock_enter = genfs_renamelock_enter, |
.vfs_renamelock_enter = genfs_renamelock_enter, |
.vfs_renamelock_exit = genfs_renamelock_exit, |
.vfs_renamelock_exit = genfs_renamelock_exit, |
.vfs_fsync = (void *)eopnotsupp, |
.vfs_fsync = (void *)eopnotsupp, |
Line 485 msdosfs_mountfs(struct vnode *devvp, str |
|
Line 484 msdosfs_mountfs(struct vnode *devvp, str |
|
bp = NULL; /* both used in error_exit */ |
bp = NULL; /* both used in error_exit */ |
pmp = NULL; |
pmp = NULL; |
|
|
error = fstrans_mount(mp); |
|
if (error) |
|
goto error_exit; |
|
|
|
error = getdisksize(devvp, &psize, &secsize); |
error = getdisksize(devvp, &psize, &secsize); |
if (error) { |
if (error) { |
if (argp->flags & MSDOSFSMNT_GEMDOSFS) |
if (argp->flags & MSDOSFSMNT_GEMDOSFS) |
Line 865 msdosfs_mountfs(struct vnode *devvp, str |
|
Line 860 msdosfs_mountfs(struct vnode *devvp, str |
|
return (0); |
return (0); |
|
|
error_exit: |
error_exit: |
fstrans_unmount(mp); |
|
if (bp) |
if (bp) |
brelse(bp, BC_AGE); |
brelse(bp, BC_AGE); |
if (pmp) { |
if (pmp) { |
Line 930 msdosfs_unmount(struct mount *mp, int mn |
|
Line 924 msdosfs_unmount(struct mount *mp, int mn |
|
free(pmp, M_MSDOSFSMNT); |
free(pmp, M_MSDOSFSMNT); |
mp->mnt_data = NULL; |
mp->mnt_data = NULL; |
mp->mnt_flag &= ~MNT_LOCAL; |
mp->mnt_flag &= ~MNT_LOCAL; |
fstrans_unmount(mp); |
|
return (0); |
return (0); |
} |
} |
|
|
Line 1015 msdosfs_sync(struct mount *mp, int waitf |
|
Line 1008 msdosfs_sync(struct mount *mp, int waitf |
|
/* update FATs here */ |
/* update FATs here */ |
} |
} |
} |
} |
fstrans_start(mp, FSTRANS_SHARED); |
|
/* |
/* |
* Write back each (modified) denode. |
* Write back each (modified) denode. |
*/ |
*/ |
Line 1039 msdosfs_sync(struct mount *mp, int waitf |
|
Line 1031 msdosfs_sync(struct mount *mp, int waitf |
|
/* |
/* |
* Force stale file system control information to be flushed. |
* Force stale file system control information to be flushed. |
*/ |
*/ |
|
vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY); |
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)) != 0) |
allerror = error; |
allerror = error; |
fstrans_done(mp); |
VOP_UNLOCK(pmp->pm_devvp); |
return (allerror); |
return (allerror); |
} |
} |
|
|
Line 1114 msdosfs_vget(struct mount *mp, ino_t ino |
|
Line 1107 msdosfs_vget(struct mount *mp, ino_t ino |
|
|
|
return (EOPNOTSUPP); |
return (EOPNOTSUPP); |
} |
} |
|
|
int |
|
msdosfs_suspendctl(struct mount *mp, int cmd) |
|
{ |
|
int error; |
|
struct lwp *l = curlwp; |
|
|
|
switch (cmd) { |
|
case SUSPEND_SUSPEND: |
|
if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDING)) != 0) |
|
return error; |
|
error = msdosfs_sync(mp, MNT_WAIT, l->l_proc->p_cred); |
|
if (error == 0) |
|
error = fstrans_setstate(mp, FSTRANS_SUSPENDED); |
|
if (error != 0) { |
|
(void) fstrans_setstate(mp, FSTRANS_NORMAL); |
|
return error; |
|
} |
|
return 0; |
|
|
|
case SUSPEND_RESUME: |
|
return fstrans_setstate(mp, FSTRANS_NORMAL); |
|
|
|
default: |
|
return EINVAL; |
|
} |
|
} |
|