From b2d9bc48bcd9ba4c29451b79a37c723879ac4501 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Fri, 21 May 2004 04:33:38 +0000 Subject: [PATCH] * Delete src/venus/lock.h as it is deleted upstream * src/pam/Makefile.in should not link in libs; it uses pic objects * Fix merge errors in src/sys and src/ubik --- src/pam/Makefile.in | 2 +- src/rx/xdr_arrayn.c | 1 - src/sys/Makefile.in | 4 +- src/ubik/Makefile.in | 6 +- src/uss/{lex.c => lex.l} | 8 +- src/venus/lock.h | 187 --------------------------------------- 6 files changed, 10 insertions(+), 198 deletions(-) rename src/uss/{lex.c => lex.l} (97%) delete mode 100644 src/venus/lock.h diff --git a/src/pam/Makefile.in b/src/pam/Makefile.in index ed92d7c90..26c3ec1d5 100644 --- a/src/pam/Makefile.in +++ b/src/pam/Makefile.in @@ -61,7 +61,7 @@ pam_afs.so.1: $(SHOBJS) afs_setcred.o afs_auth.o afs_util.o $(SHOBJS) $(LIBS) ;; \ *linux*) \ $(CC) $(LDFLAGS) $(PAM_CFLAGS) -o $@ afs_setcred.o \ - afs_auth.o afs_util.o $(SHOBJS) $(LIBS) `find ../pic/ -name "*.o" | grep -v AFS_compo` -lpam -lresolv;;\ + afs_auth.o afs_util.o $(SHOBJS) `find ../pic/ -name "*.o" | grep -v AFS_compo` -lpam -lresolv;;\ *fbsd*) \ $(CC) $(LDFLAGS) -o $@ afs_setcred.o \ afs_auth.o afs_util.o $(SHOBJS) $(LIBS) ;;\ diff --git a/src/rx/xdr_arrayn.c b/src/rx/xdr_arrayn.c index 294ce52d8..21486e931 100644 --- a/src/rx/xdr_arrayn.c +++ b/src/rx/xdr_arrayn.c @@ -29,7 +29,6 @@ #include #include -<<<<<<< local RCSID ("$Header: /cvs/openafs/src/rx/xdr_arrayn.c,v 1.8 2003/07/15 23:16:12 shadow Exp $"); diff --git a/src/sys/Makefile.in b/src/sys/Makefile.in index a2fc5b707..88b8f068d 100644 --- a/src/sys/Makefile.in +++ b/src/sys/Makefile.in @@ -17,7 +17,7 @@ LIBS=libsys.a ${TOP_LIBDIR}/librx.a libsys.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR PICTARGET =../pic/sys PICOBJS = $(patsubst %.o,$(PICTARGET)/%.o,$(OBJS)) $(PICTARGET)/%.o: %.c $(PICTARGET) - $(CC) -c $(PAM_CFLAGS) $(CFLAGS) $< -o $@ + $(CC) -c $(PAM_CFLAGS) ${CFLAGS} $< -o $@ $(PICTARGET): mkdir -p $(PICTARGET) @@ -79,6 +79,8 @@ afssyscalls.o: afssyscalls.c afssyscalls.h ${CCOBJ} ${CFLAGS} -c ${srcdir}/afssyscalls.c rmtsysnet.o rmtsysc.o rmtsyss.o rmtsysd.o: rmtsys.h +$(PICTARGET)/rmtsysnet.o $(PICTARGET)/rmtsysc.o: rmtsys.h + rmtsysd: AFS_component_version_number.o afs.exp afsl.exp rmtsys.cs.c: rmtsys.xg diff --git a/src/ubik/Makefile.in b/src/ubik/Makefile.in index 0fc806d7b..1dd8390f3 100644 --- a/src/ubik/Makefile.in +++ b/src/ubik/Makefile.in @@ -34,7 +34,7 @@ depinstall: \ $(PICTARGET): mkdir -p $(PICTARGET) -all: ukinstall ${TOP_LIBDIR}/libubik.a ${TOP_INCDIR}/ubik.h ${TOP_INCDIR}/ubik_int.h udebug utst_server utst_client $(PICOBJS) + utst_server: utst_server.o utst_int.ss.o utst_int.xdr.o libubik.a ${CC} ${CFLAGS} -o utst_server utst_server.o utst_int.ss.o utst_int.xdr.o libubik.a $(LIBS) @@ -175,10 +175,6 @@ ${DESTDIR}${includedir}/ubik_int.h: ubik_int.h ${TOP_INCDIR}/ubik_int.h: ubik_int.h ${INSTALL} $? $@ - -${DESTDIR}${bindir}/udebug: udebug - ${INSTALL} $? $@ - ${DESTDIR}${afssrvbindir}/udebug: udebug ${INSTALL} $? $@ diff --git a/src/uss/lex.c b/src/uss/lex.l similarity index 97% rename from src/uss/lex.c rename to src/uss/lex.l index 38bfb4920..25a1caa71 100644 --- a/src/uss/lex.c +++ b/src/uss/lex.l @@ -10,6 +10,10 @@ #include #include + +RCSID("$Header: /cvs/openafs/src/uss/lex.l,v 1.1 2003/06/19 16:55:10 shadow Exp $"); + + #ifdef HAVE_STRING_H #include #else @@ -18,8 +22,6 @@ #endif #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/uss/lex.c,v 1.1.1.6 2003/07/30 17:13:24 hartmans Exp $"); - #include "y.tab.h" #include "uss_common.h" int line=1; @@ -192,7 +194,7 @@ Replace(in, out) if (isQuotedString) { nullP = strchr(out, '"'); - if (nullP == (char *)0) + if (nullP == NULL) nullP = out_cp; } else diff --git a/src/venus/lock.h b/src/venus/lock.h deleted file mode 100644 index cfbcbeef0..000000000 --- a/src/venus/lock.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - */ - -#ifndef __AFSLOCK_INCLUDE__ -#define __AFSLOCK_INCLUDE__ 1 - -/*******************************************************************\ -* * -* Information Technology Center * -* Carnegie-Mellon University * -* * -* * -* * -\*******************************************************************/ - -/* - Include file for using Vice locking routines. -*/ - -/* The following macros allow multi statement macros to be defined safely, i.e. - - the multi statement macro can be the object of an if statement; - - the call to the multi statement macro may be legally followed by a semi-colon. - BEGINMAC and ENDMAC have been tested with both the portable C compiler and - Hi-C. Both compilers were from the Palo Alto 4.2BSD software releases, and - both optimized out the constant loop code. For an example of the use - of BEGINMAC and ENDMAC, see the definition for ReleaseWriteLock, below. - An alternative to this, using "if(1)" for BEGINMAC is not used because it - may generate worse code with pcc, and may generate warning messages with hi-C. -*/ - -#define BEGINMAC do { -#define ENDMAC } while (0) - -struct afs_bozoLock { - short count; /* count of excl locks */ - char flags; /* bit 1: is anyone waiting? */ - char spare; /* for later */ - char *proc; /* process holding the lock, really a struct proc * */ -}; - -#define AFS_BOZONWAITING 1 /* someone is waiting for this lock */ - -/* all locks wait on excl_locked except for READ_LOCK, which waits on readers_reading */ -struct afs_lock { - unsigned char wait_states; /* type of lockers waiting */ - unsigned char excl_locked; /* anyone have boosted, shared or write lock? */ - unsigned char readers_reading; /* # readers actually with read locks */ - unsigned char num_waiting; /* probably need this soon */ -}; - -#define READ_LOCK 1 -#define WRITE_LOCK 2 -#define SHARED_LOCK 4 -/* this next is not a flag, but rather a parameter to Afs_Lock_Obtain */ -#define BOOSTED_LOCK 6 - -/* next defines wait_states for which we wait on excl_locked */ -#define EXCL_LOCKS (WRITE_LOCK|SHARED_LOCK) - -#define ObtainReadLock(lock)\ - if (!((lock)->excl_locked & WRITE_LOCK))\ - (lock) -> readers_reading++;\ - else\ - Afs_Lock_Obtain(lock, READ_LOCK) - -#define ObtainWriteLock(lock)\ - if (!(lock)->excl_locked && !(lock)->readers_reading)\ - (lock) -> excl_locked = WRITE_LOCK;\ - else\ - Afs_Lock_Obtain(lock, WRITE_LOCK) - -#define ObtainSharedLock(lock)\ - if (!(lock)->excl_locked)\ - (lock) -> excl_locked = SHARED_LOCK;\ - else\ - Afs_Lock_Obtain(lock, SHARED_LOCK) - -#define UpgradeSToWLock(lock)\ - if (!(lock)->readers_reading)\ - (lock)->excl_locked = WRITE_LOCK;\ - else\ - Afs_Lock_Obtain(lock, BOOSTED_LOCK) - -/* this must only be called with a WRITE or boosted SHARED lock! */ -#define ConvertWToSLock(lock)\ - BEGINMAC\ - (lock)->excl_locked = SHARED_LOCK; \ - if((lock)->wait_states) \ - Afs_Lock_ReleaseR(lock); \ - ENDMAC - -#define ConvertWToRLock(lock) \ - BEGINMAC\ - (lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);\ - (lock)->readers_reading++;\ - Afs_Lock_ReleaseR(lock);\ - ENDMAC - -#define ConvertSToRLock(lock) \ - BEGINMAC\ - (lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);\ - (lock)->readers_reading++;\ - Afs_Lock_ReleaseR(lock);\ - ENDMAC - -#define ReleaseReadLock(lock)\ - BEGINMAC\ - if (!--(lock)->readers_reading && (lock)->wait_states)\ - Afs_Lock_ReleaseW(lock) ; \ - ENDMAC - -#define ReleaseWriteLock(lock)\ - BEGINMAC\ - (lock)->excl_locked &= ~WRITE_LOCK;\ - if ((lock)->wait_states) Afs_Lock_ReleaseR(lock);\ - ENDMAC - -/* can be used on shared or boosted (write) locks */ -#define ReleaseSharedLock(lock)\ - BEGINMAC\ - (lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);\ - if ((lock)->wait_states) Afs_Lock_ReleaseR(lock);\ - ENDMAC - -/* I added this next macro to make sure it is safe to nuke a lock -- Mike K. */ -#define LockWaiters(lock)\ - ((int) ((lock)->num_waiting)) - -#define CheckLock(lock)\ - ((lock)->excl_locked? (int) -1 : (int) (lock)->readers_reading) - -#define WriteLocked(lock)\ - ((lock)->excl_locked & WRITE_LOCK) - -/* - -You can also use the lock package for handling parent locks for independently-lockable sets of -small objects. The concept here is that the parent lock is at the same level in the -locking hierarchy as the little locks, but certain restrictions apply. - -The general usage pattern is as follows. You have a set of entries to search. When searching it, you -have a "scan" lock on the table. If you find what you're looking for, you drop the lock down -to a "hold" lock, lock the entry, and release the parent lock. If you don't find what -you're looking for, you create the entry, downgrade the "scan" lock to a "hold" lock, -lock the entry and unlock the parent. - -To delete an item from the table, you initially obtain a "purge" lock on the parent. Unlike all -of the other parent lock modes described herein, in order to obtain a "purge" lock mode, you -must have released all locks on any items in the table. Once you have obtained the parent -lock in "purge" mode, you should check to see if the entry is locked. If its not locked, you -are free to delete the entry, knowing that no one else can attempt to obtain a lock -on the entry while you have the purge lock held on the parent. Unfortunately, if it *is* locked, -you can not lock it yourself and wait for the other dude to release it, since the entry's locker -may need to lock another entry before unlocking the entry you want (which would result in -deadlock). Instead, then, you must release the parent lock, and try again "later" (see Lock_Wait -for assistance in waiting until later). Unfortunately, this is the best locking paradigm I've yet -come up with. - -What are the advantages to this scheme? First, the use of the parent lock ensures that -two people don't try to add the same entry at the same time or delete an entry while someone -else is adding it. It also ensures that when one process is deleting an entry, no one else is -preparing to lock the entry. Furthermore, when obtaining a lock on a little entry, you -are only holding a "hold" lock on the parent lock, so that others may come in and search -the table during this time. Thus it will not hold up the system if a little entry takes -a great deal of time to free up. - -Here's how to compute the compatibility matrix: - -The invariants are: - -add no deletions, additions allowed, additions will be performed, will obtain little locks -hold no deletions, additions allowed, no additions will be performed, will obtain little locks -purge no deletions or additions allowed, deletions will be performed, don't obtain little locks - -When we compute the locking matrix, we note that hold is compatible with hold and add. -Add is compatible only with hold. purge is not compatible with anything. This is the same -matrix as obtained by mapping add->S, hold->read and purge->write locks. Thus we -can use the locks above to solve this problem, and we do. - -*/ -#endif /* __AFSLOCK_INCLUDE__ */ -- 2.39.5