summaryrefslogtreecommitdiffstats
path: root/sys/dev/slice
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-04-22 10:25:27 +0000
committerjulian <julian@FreeBSD.org>1998-04-22 10:25:27 +0000
commitdb37f632a083922cf897d2643cc01bca4ebff768 (patch)
treef9fe78dbd70b3d36af499750acc24a6235a6fa5f /sys/dev/slice
parent2fe90b3e8973616fd8f5635f2897c83ae98dce83 (diff)
downloadFreeBSD-src-db37f632a083922cf897d2643cc01bca4ebff768.zip
FreeBSD-src-db37f632a083922cf897d2643cc01bca4ebff768.tar.gz
close() is no longer a SLICE method.
Close is simply an open with no-read and no-write once internal to SLICE (it still exports a close to the rest of the kernel)
Diffstat (limited to 'sys/dev/slice')
-rw-r--r--sys/dev/slice/disklabel.c8
-rw-r--r--sys/dev/slice/mbr.c8
-rw-r--r--sys/dev/slice/slice_base.c30
-rw-r--r--sys/dev/slice/slice_device.c34
4 files changed, 49 insertions, 31 deletions
diff --git a/sys/dev/slice/disklabel.c b/sys/dev/slice/disklabel.c
index cb2119b..513d11f 100644
--- a/sys/dev/slice/disklabel.c
+++ b/sys/dev/slice/disklabel.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: $
+ * $Id: disklabel.c,v 1.1 1998/04/19 23:31:03 julian Exp $
*/
@@ -63,7 +63,7 @@ static sl_h_constructor_t dkl_constructor; /* constructor (from device) */
static sl_h_IO_req_t dkl_IOreq; /* IO req downward (to device) */
static sl_h_ioctl_t dkl_ioctl; /* ioctl req downward (to device) */
static sl_h_open_t dkl_open; /* downwards travelling open */
-static sl_h_close_t dkl_close; /* downwards travelling close */
+/*static sl_h_close_t dkl_close; */ /* downwards travelling close */
static sl_h_claim_t dkl_claim; /* upwards travelling claim */
static sl_h_revoke_t dkl_revoke;/* upwards travelling revokation */
static sl_h_verify_t dkl_verify;/* things changed, are we stil valid? */
@@ -78,7 +78,7 @@ static struct slice_handler slicetype = {
&dkl_IOreq,
&dkl_ioctl,
&dkl_open,
- &dkl_close,
+ /*&dkl_close*/NULL,
&dkl_revoke, /* revoke */
&dkl_claim, /* claim */
&dkl_verify, /* verify */
@@ -658,6 +658,7 @@ RR;
return (0);
}
+#if 0
static void
dkl_close(void *private, int flags, int mode, struct proc * p)
{
@@ -701,6 +702,7 @@ RR;
pd->savedoflags = newoflags;
return ;
}
+#endif /* 0 */
static int
dkl_ioctl(void *private, int cmd, caddr_t addr, int flag, struct proc * p)
diff --git a/sys/dev/slice/mbr.c b/sys/dev/slice/mbr.c
index 7babfc9..29e8b01 100644
--- a/sys/dev/slice/mbr.c
+++ b/sys/dev/slice/mbr.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: $
+ * $Id: mbr.c,v 1.1 1998/04/19 23:31:05 julian Exp $
*/
#include <sys/param.h>
@@ -80,7 +80,7 @@ static sl_h_constructor_t mbr_constructor; /* constructor (from device) */
static sl_h_IO_req_t mbr_IOreq; /* IO req downward (to device) */
static sl_h_ioctl_t mbr_ioctl; /* ioctl req downward (to device) */
static sl_h_open_t mbr_open; /* downwards travelling open */
-static sl_h_close_t mbr_close; /* downwards travelling close */
+/*static sl_h_close_t mbr_close; */ /* downwards travelling close */
static sl_h_claim_t mbr_claim; /* upwards travelling claim */
static sl_h_revoke_t mbr_revoke;/* upwards travelling revokation */
static sl_h_verify_t mbr_verify;/* things changed, are we stil valid? */
@@ -95,7 +95,7 @@ static struct slice_handler slicetype = {
&mbr_IOreq,
&mbr_ioctl,
&mbr_open,
- &mbr_close,
+ /*&mbr_close*/NULL,
&mbr_revoke, /* revoke */
&mbr_claim, /* claim */
&mbr_verify, /* verify */
@@ -761,6 +761,7 @@ RR;
return (0);
}
+#if 0
static void
mbr_close(void *private, int flags, int mode, struct proc * p)
{
@@ -801,6 +802,7 @@ RR;
pd->savedoflags = newoflags;
return ;
}
+#endif /* 0 */
static int
mbr_ioctl(void *private, int cmd, caddr_t addr, int flag, struct proc * p)
diff --git a/sys/dev/slice/slice_base.c b/sys/dev/slice/slice_base.c
index 983de11..e5f23de 100644
--- a/sys/dev/slice/slice_base.c
+++ b/sys/dev/slice/slice_base.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: slice_base.c,v 1.1 1998/04/19 23:31:12 julian Exp $
+ * $Id: slice_base.c,v 1.2 1998/04/22 01:51:34 julian Exp $
*/
#include <sys/param.h>
@@ -575,6 +575,31 @@ sliceopen(struct slice *slice, int flags, int mode,
}
slice->flags &= ~SLF_OPEN_STATE;
slice->flags |= sl_flags;
+#if 1 /* it was basically a close */
+ if ((slice->flags & SLF_OPEN_STATE) == SLF_CLOSED) {
+ sh_p tp;
+
+ /*
+ * If we had an upper handler, ask it to check if it's still
+ * valid. it may decide to self destruct.
+ */
+ if (slice->handler_up) {
+ (*slice->handler_up->verify)(slice);
+ }
+ /*
+ * If we don't have an upper handler, check if
+ * maybe there is now a suitable environment for one.
+ * We may end up with a different handler
+ * from what we had above. Maybe we should clear the hint?
+ * Maybe we should ask the lower one to re-issue the request?
+ */
+ if (slice->handler_up == NULL) {
+ if ((tp = slice_probeall(slice)) != NULL) {
+ (*tp->constructor)(slice);
+ }
+ }
+ }
+#endif
reject:
unlockslice(slice);
if ((slice->flags & SLF_INVALID) == SLF_INVALID)
@@ -583,6 +608,7 @@ reject:
return (error);
}
+#if 0
void
sliceclose(struct slice *slice, int flags, int mode,
struct proc * p, enum slc_who who)
@@ -643,7 +669,7 @@ sliceclose(struct slice *slice, int flags, int mode,
sl_unref(slice);
return ;
}
-
+#endif /* 0 */
/*
* control behaviour of slices WRT sharing:
diff --git a/sys/dev/slice/slice_device.c b/sys/dev/slice/slice_device.c
index 4b7f86b..783a862 100644
--- a/sys/dev/slice/slice_device.c
+++ b/sys/dev/slice/slice_device.c
@@ -23,8 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: $
+ * $Id: slice_device.c,v 1.1 1998/04/19 23:31:14 julian Exp $
*/
+#define DIAGNOSTIC 1
#include <sys/param.h>
#include <sys/systm.h>
@@ -140,26 +141,7 @@ minor_to_slice(unsigned int minor)
return (NULL);
}
-/*
- * Macro to check that the unit number is valid Often this isn't needed as
- * once the open() is performed, the unit number is pretty much safe.. The
- * exception would be if we implemented devices that could "go away". in
- * which case all these routines would be wise to check the number,
- * DIAGNOSTIC or not.
- */
-#define CHECKUNIT() \
-do { /* the do-while is a safe way to do this grouping */ \
- if (slice == NULL) { \
- printf( __FUNCTION__ ": unit not attached\n", unit); \
- panic ("slice"); \
- } \
-} while (0)
-#ifdef DIAGNOSTIC
-#define CHECKUNIT_DIAG() CHECKUNIT()
-#else /* DIAGNOSTIC */
-#define CHECKUNIT_DIAG()
-#endif /* DIAGNOSTIC */
int
slcdevioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc * p)
@@ -167,7 +149,6 @@ slcdevioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc * p)
sl_p slice = minor_to_slice(minor(dev));
int error = 0;
- CHECKUNIT_DIAG();
RR;
/*
@@ -246,8 +227,15 @@ slcdevclose(dev_t dev, int flags, int mode, struct proc * p)
{
sl_p slice = minor_to_slice(minor(dev));
RR;
- CHECKUNIT_DIAG();
- sliceclose(slice, flags, mode, p, SLW_DEVICE);
+#ifdef DIAGNOSTIC
+ if ((flags & (FWRITE | FREAD)) != 0) {
+ printf("sliceclose called with non 0 flags\n");
+ }
+#endif
+ /*
+ * Close is just an open for non-read/nonwrite in this context.
+ */
+ sliceopen(slice, 0, mode, p, SLW_DEVICE);
return(0);
}
OpenPOWER on IntegriCloud