diff options
author | sos <sos@FreeBSD.org> | 2000-02-07 23:05:40 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2000-02-07 23:05:40 +0000 |
commit | dc230127daec112c1a3bb700232c22ac04631e88 (patch) | |
tree | e072c7f077d8cba1f690c8122a148d5cad899a12 /sys/dev/ata/atapi-tape.c | |
parent | a3a1cb67da99bf7ec2e1c0d9321f78e13d17bbc5 (diff) | |
download | FreeBSD-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.c | 7 |
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 |