From 82781dd6da2b6a1eb113e20d100052509bb85a90 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 19 Apr 2001 22:11:52 +0000 Subject: 2001-02-18 Marcus Brinkmann * dev.h (struct dev): New member nperopens. * storeio.c (open_hook): Hold device lock and check if this is the first open. If yes, activate the store. (close_hook): Hold global_lock and check if this was the last open. If yes, inactivate the store. * dev.c (dev_open): Open the store with STORE_INACTIVE (in store_parsed_open as well as in store_create). --- storeio/dev.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'storeio/dev.h') diff --git a/storeio/dev.h b/storeio/dev.h index 7a64c54e..d5b9d1a4 100644 --- a/storeio/dev.h +++ b/storeio/dev.h @@ -50,8 +50,12 @@ struct dev indicates that there is no owner. */ pid_t owner; - /* This lock protects `store' and `owner'. The other members never - change after creation, except for those locked by io_lock (below). */ + /* The number of active opens. */ + int nperopens; + + /* This lock protects `store', `owner' and `nperopens'. The other + members never change after creation, except for those locked by + io_lock (below). */ struct mutex lock; /* Nonzero iff the --no-cache flag was given. -- cgit v1.2.3