summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/atapi-tape.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2000-02-07 23:05:40 +0000
committersos <sos@FreeBSD.org>2000-02-07 23:05:40 +0000
commitdc230127daec112c1a3bb700232c22ac04631e88 (patch)
treee072c7f077d8cba1f690c8122a148d5cad899a12 /sys/dev/ata/atapi-tape.c
parenta3a1cb67da99bf7ec2e1c0d9321f78e13d17bbc5 (diff)
downloadFreeBSD-src-dc230127daec112c1a3bb700232c22ac04631e88.zip
FreeBSD-src-dc230127daec112c1a3bb700232c22ac04631e88.tar.gz
Do refcounting of open devices (more) correctly.
count_dev funtion by phk.
Diffstat (limited to 'sys/dev/ata/atapi-tape.c')
-rw-r--r--sys/dev/ata/atapi-tape.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index 93e42e9..81953c2 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.c
@@ -240,7 +240,7 @@ astopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
if (!stp)
return ENXIO;
- if (stp->flags == F_OPEN)
+ if (count_dev(dev) > 1)
return EBUSY;
atapi_test_ready(stp->atp);
@@ -253,7 +253,6 @@ astopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
stp->atp->flags &= ~ATAPI_F_MEDIA_CHANGED;
stp->flags &= ~(F_DATA_WRITTEN | F_FM_WRITTEN);
- stp->flags |= F_OPEN;
ast_total = 0;
return 0;
}
@@ -276,10 +275,10 @@ astclose(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
if (!(minor(dev) & 0x01))
ast_rewind(stp);
- if (stp->cap.lock)
+ if (stp->cap.lock && count_dev(dev) == 1)
ast_prevent_allow(stp, 0);
- stp->flags &= ~(F_OPEN | F_CTL_WARN);
+ stp->flags &= F_CTL_WARN;
#ifdef AST_DEBUG
printf("ast%d: %llu total bytes transferred\n", stp->lun, ast_total);
#endif
OpenPOWER on IntegriCloud