projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add copyright
[unix-history]
/
usr
/
src
/
sys
/
ufs
/
lfs
/
lfs_vfsops.c
diff --git
a/usr/src/sys/ufs/lfs/lfs_vfsops.c
b/usr/src/sys/ufs/lfs/lfs_vfsops.c
index
527206d
..
66e84b2
100644
(file)
--- a/
usr/src/sys/ufs/lfs/lfs_vfsops.c
+++ b/
usr/src/sys/ufs/lfs/lfs_vfsops.c
@@
-1,4
+1,10
@@
-/* lfs_vfsops.c 6.9 84/09/28 */
+/*
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ * @(#)lfs_vfsops.c 6.11 (Berkeley) %G%
+ */
#include "param.h"
#include "systm.h"
#include "param.h"
#include "systm.h"
@@
-35,11
+41,16
@@
smount()
ip = namei(ndp);
if (ip == NULL)
return;
ip = namei(ndp);
if (ip == NULL)
return;
- if (ip->i_count
!=1 || (ip->i_mode&IFMT) != IFDIR
) {
+ if (ip->i_count
!= 1
) {
iput(ip);
u.u_error = EBUSY;
return;
}
iput(ip);
u.u_error = EBUSY;
return;
}
+ if ((ip->i_mode&IFMT) != IFDIR) {
+ iput(ip);
+ u.u_error = ENOTDIR;
+ return;
+ }
fs = mountfs(dev, uap->ronly, ip);
if (fs == 0)
return;
fs = mountfs(dev, uap->ronly, ip);
if (fs == 0)
return;
@@
-62,11
+73,13
@@
mountfs(dev, ronly, ip)
caddr_t space;
int i, size;
register error;
caddr_t space;
int i, size;
register error;
+ int needclose = 0;
error =
(*bdevsw[major(dev)].d_open)(dev, ronly ? FREAD : FREAD|FWRITE);
if (error)
goto out;
error =
(*bdevsw[major(dev)].d_open)(dev, ronly ? FREAD : FREAD|FWRITE);
if (error)
goto out;
+ needclose = 1;
tp = bread(dev, SBLOCK, SBSIZE);
if (tp->b_flags & B_ERROR)
goto out;
tp = bread(dev, SBLOCK, SBSIZE);
if (tp->b_flags & B_ERROR)
goto out;
@@
-140,6
+153,9
@@
out:
brelse(bp);
if (tp)
brelse(tp);
brelse(bp);
if (tp)
brelse(tp);
+ if (needclose)
+ (*bdevsw[major(dev)].d_close)(dev, ronly ? FREAD : FREAD|FWRITE);
+ binval(dev);
u.u_error = error;
return (0);
}
u.u_error = error;
return (0);
}
@@
-251,8
+267,11
@@
getmdev(pdev, fname)
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = fname;
ip = namei(ndp);
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = fname;
ip = namei(ndp);
- if (ip == NULL)
+ if (ip == NULL) {
+ if (u.u_error == ENOENT)
+ return (ENODEV); /* needs translation */
return (u.u_error);
return (u.u_error);
+ }
if ((ip->i_mode&IFMT) != IFBLK) {
iput(ip);
return (ENOTBLK);
if ((ip->i_mode&IFMT) != IFBLK) {
iput(ip);
return (ENOTBLK);