Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Provide a version of FILE_UNUSE() for cases where we...



details:   https://anonhg.NetBSD.org/src/rev/bb57e99ac670
branches:  trunk
changeset: 566668:bb57e99ac670
user:      pk <pk%NetBSD.org@localhost>
date:      Sun May 16 17:48:18 2004 +0000

description:
Provide a version of FILE_UNUSE() for cases where we already hold the
file's lock.

diffstat:

 sys/sys/file.h |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 4563188d2d6d -r bb57e99ac670 sys/sys/file.h
--- a/sys/sys/file.h    Sun May 16 17:07:29 2004 +0000
+++ b/sys/sys/file.h    Sun May 16 17:48:18 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.h,v 1.49 2004/04/25 16:42:43 simonb Exp $ */
+/*     $NetBSD: file.h,v 1.50 2004/05/16 17:48:18 pk Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -123,9 +123,10 @@
        simple_unlock(&(fp)->f_slock);                                  \
 } while (/* CONSTCOND */ 0)
 
-#define        FILE_UNUSE(fp, p)                                               \
+#define        FILE_UNUSE_WLOCK(fp, p, havelock)                               \
 do {                                                                   \
-       simple_lock(&(fp)->f_slock);                                    \
+       if (!(havelock))                                                \
+               simple_lock(&(fp)->f_slock);                            \
        if ((fp)->f_iflags & FIF_WANTCLOSE) {                           \
                simple_unlock(&(fp)->f_slock);                          \
                /* Will drop usecount */                                \
@@ -137,6 +138,8 @@
        }                                                               \
        simple_unlock(&(fp)->f_slock);                                  \
 } while (/* CONSTCOND */ 0)
+#define        FILE_UNUSE(fp, p)               FILE_UNUSE_WLOCK(fp, p, 0)
+#define        FILE_UNUSE_HAVELOCK(fp, p)      FILE_UNUSE_WLOCK(fp, p, 1)
 
 /*
  * Flags for fo_read and fo_write.



Home | Main Index | Thread Index | Old Index