From: Sam Hartman Date: Fri, 21 May 2004 04:33:38 +0000 (+0000) Subject: * Delete src/venus/lock.h as it is deleted upstream X-Git-Tag: debian/1.3.64-1~13 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b2d9bc48bcd9ba4c29451b79a37c723879ac4501;p=packages%2Fo%2Fopenafs.git * 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 --- 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.c deleted file mode 100644 index 38bfb4920..000000000 --- a/src/uss/lex.c +++ /dev/null @@ -1,207 +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 - */ - -#include -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#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; -#ifdef DEBUG -#define dprint(x) {fprintf(stderr, x); fflush(stderr);} -#else -#define dprint(x) -#endif -%} - -/* definitions */ -C #[^\n]* -W [ \t]+ -L [A-Za-z] -S [\.A-Z0-9a-z/$][^ \t\n#=\^\!\|\(\)\{\};]* -Q \"[^\"\n]*[\"\n] -INVAL [^ADEFLSVGX# ] -EOL [\n] - -%% -{C} {dprint(("got a comment\n"));} -^{EOL} {dprint(("got an empty line\n")); line++;} -^{INVAL} {uss_procs_PrintErr(line," Invalid command \n");} -^[D]{W} {dprint(("got a Dir\n"));return(DIR_TKN);} -^[F]{W} {dprint(("got a File\n"));return(FILE_TKN);} -^[L]{W} {dprint(("got a Link\n"));return(LINK_TKN);} -^[S]{W} {dprint(("got a Symlink\n"));return(SYMLINK_TKN);} -^[E]{W} {dprint(("got an Echo\n"));return(ECHO_TKN);} -^[X]{W} {dprint(("got an Exec\n"));return(EXEC_TKN);} -^[V]{W} {dprint(("got a Vol\n"));return(VOL_TKN);} -^[G]{W} {dprint(("got a Group Declaration\n"));return(GROUP_TKN);} -^[A]{W} {dprint(("got an Auth\n"));return(AUTH_TKN);} -^[Y]{W} {dprint(("got a Vol1\n"));return(VOL1_TKN);} -{S} {dprint(("got a string(%s)\n", yytext)); - Replace(yytext, yylval.strval); - return(STRING_TKN); - } -{Q} {dprint(("got a quote: '%s'\n", yytext)); - Replace(yytext, yylval.strval); - return(STRING_TKN); - } -{EOL} {line++; - return(EOL_TKN);}; - -%% - -/* - * This routine copies the in buf to out and replaces every known - * variable, e.g. $user, $1, ... by its value. This value either - * comes from main program, or the handling routine will figure it - * out. If given a quoted string, it ignores the first double quote - * and replaces the second with a null. - */ - -Replace(in, out) - char *in, *out; - -{ /*Replace*/ - - char *in_text, *in_var, *out_cp, VarNo; - int n; - int isQuotedString; - char *nullP; - - if(in[0] == '"') { - /* - * Strip the opening quote, remember we're handling a - * quoted string - */ - in_text = in+1; - isQuotedString = 1; - } - else { - in_text = in; - isQuotedString = 0; - } - out_cp = out; - - while ((in_var = strchr(in_text, '$')) != NULL) { - while(in_text < in_var) - *out_cp++ = *in_text++; - VarNo = *(in_var+1); - if(VarNo >= '0' && VarNo <= '9') { - /*In the 0-9 range*/ - n = VarNo - '0'; - if (n == 0) { - fprintf(stderr, - "$0 is the program name. Please start from $1.\n"); - exit(-1); - } - if (n > uss_VarMax){ - fprintf(stderr, - "Illegal variable number ($%d is the largest acceptable)\n", - uss_VarMax); - exit(-1); - } - - strcpy(out_cp, uss_Var[n]); - out_cp += strlen(uss_Var[n]); - in_text += 2; - } - - else if (strncmp(in_var, "$USER", 5) == 0) { - strcpy(out_cp, uss_User); - out_cp += strlen(uss_User); - in_text += 5; - } - - else if (strncmp(in_var, "$UID", 4) == 0) { - strcpy(out_cp, uss_Uid); - out_cp += strlen(uss_Uid); - in_text += 4; - } - - else if (strncmp(in_var, "$SERVER", 7) == 0) { - strcpy(out_cp, uss_Server); - out_cp += strlen(uss_Server); - in_text += 7; - } - - else if (strncmp(in_var, "$PART", 5) == 0) { - strcpy(out_cp, uss_Partition); - out_cp += strlen(uss_Partition); - in_text += 5; - } - - else if (strncmp(in_var, "$MTPT", 5) == 0) { - strcpy(out_cp, uss_MountPoint); - out_cp += strlen(uss_MountPoint); - in_text += 5; - } - - else if (strncmp(in_var, "$NAME", 5) == 0) { - strcpy(out_cp, uss_RealName); - out_cp += strlen(uss_RealName); - in_text += 5; - } - - else if (strncmp(in_var, "$AUTO", 5) == 0) { - /*Picks a dir with minimum entries*/ - uss_procs_PickADir(out, out_cp /*, uss_Auto*/); - printf("debug: $AUTO = %s\n", uss_Auto); - strcpy(out_cp, uss_Auto); - out_cp += strlen(uss_Auto); - in_text += 5; - } - else if (strncmp(in_var, "$PWEXPIRES", 10) == 0) { - sprintf(out_cp, " %d ", uss_Expires); - out_cp += strlen(out_cp); - in_text += 10; - } - - else{ - /*Unknown variable*/ - fprintf(stderr, - "Warning: unknown variable in config file: '%s'\n", - in_var); - *out_cp++ = *in_text++; - } - } - - /* - * At this point, we've copied over the in buffer up to the point - * of the last variable instance, so copy over the rest. If this - * is a quoted string, we place the terminating null where the - * ending double quote is. - */ - while(*in_text != '\0') - *out_cp++ = *in_text++; - - if (isQuotedString) { - nullP = strchr(out, '"'); - if (nullP == (char *)0) - nullP = out_cp; - } - else - nullP = out_cp; - *nullP = '\0'; - -} /*Replace*/ - -yywrap() -{ -return(1); -} diff --git a/src/uss/lex.l b/src/uss/lex.l new file mode 100644 index 000000000..25a1caa71 --- /dev/null +++ b/src/uss/lex.l @@ -0,0 +1,209 @@ +%{ +/* + * 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 + */ + +#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 +#ifdef HAVE_STRINGS_H +#include +#endif +#endif + +#include "y.tab.h" +#include "uss_common.h" +int line=1; +#ifdef DEBUG +#define dprint(x) {fprintf(stderr, x); fflush(stderr);} +#else +#define dprint(x) +#endif +%} + +/* definitions */ +C #[^\n]* +W [ \t]+ +L [A-Za-z] +S [\.A-Z0-9a-z/$][^ \t\n#=\^\!\|\(\)\{\};]* +Q \"[^\"\n]*[\"\n] +INVAL [^ADEFLSVGX# ] +EOL [\n] + +%% +{C} {dprint(("got a comment\n"));} +^{EOL} {dprint(("got an empty line\n")); line++;} +^{INVAL} {uss_procs_PrintErr(line," Invalid command \n");} +^[D]{W} {dprint(("got a Dir\n"));return(DIR_TKN);} +^[F]{W} {dprint(("got a File\n"));return(FILE_TKN);} +^[L]{W} {dprint(("got a Link\n"));return(LINK_TKN);} +^[S]{W} {dprint(("got a Symlink\n"));return(SYMLINK_TKN);} +^[E]{W} {dprint(("got an Echo\n"));return(ECHO_TKN);} +^[X]{W} {dprint(("got an Exec\n"));return(EXEC_TKN);} +^[V]{W} {dprint(("got a Vol\n"));return(VOL_TKN);} +^[G]{W} {dprint(("got a Group Declaration\n"));return(GROUP_TKN);} +^[A]{W} {dprint(("got an Auth\n"));return(AUTH_TKN);} +^[Y]{W} {dprint(("got a Vol1\n"));return(VOL1_TKN);} +{S} {dprint(("got a string(%s)\n", yytext)); + Replace(yytext, yylval.strval); + return(STRING_TKN); + } +{Q} {dprint(("got a quote: '%s'\n", yytext)); + Replace(yytext, yylval.strval); + return(STRING_TKN); + } +{EOL} {line++; + return(EOL_TKN);}; + +%% + +/* + * This routine copies the in buf to out and replaces every known + * variable, e.g. $user, $1, ... by its value. This value either + * comes from main program, or the handling routine will figure it + * out. If given a quoted string, it ignores the first double quote + * and replaces the second with a null. + */ + +Replace(in, out) + char *in, *out; + +{ /*Replace*/ + + char *in_text, *in_var, *out_cp, VarNo; + int n; + int isQuotedString; + char *nullP; + + if(in[0] == '"') { + /* + * Strip the opening quote, remember we're handling a + * quoted string + */ + in_text = in+1; + isQuotedString = 1; + } + else { + in_text = in; + isQuotedString = 0; + } + out_cp = out; + + while ((in_var = strchr(in_text, '$')) != NULL) { + while(in_text < in_var) + *out_cp++ = *in_text++; + VarNo = *(in_var+1); + if(VarNo >= '0' && VarNo <= '9') { + /*In the 0-9 range*/ + n = VarNo - '0'; + if (n == 0) { + fprintf(stderr, + "$0 is the program name. Please start from $1.\n"); + exit(-1); + } + if (n > uss_VarMax){ + fprintf(stderr, + "Illegal variable number ($%d is the largest acceptable)\n", + uss_VarMax); + exit(-1); + } + + strcpy(out_cp, uss_Var[n]); + out_cp += strlen(uss_Var[n]); + in_text += 2; + } + + else if (strncmp(in_var, "$USER", 5) == 0) { + strcpy(out_cp, uss_User); + out_cp += strlen(uss_User); + in_text += 5; + } + + else if (strncmp(in_var, "$UID", 4) == 0) { + strcpy(out_cp, uss_Uid); + out_cp += strlen(uss_Uid); + in_text += 4; + } + + else if (strncmp(in_var, "$SERVER", 7) == 0) { + strcpy(out_cp, uss_Server); + out_cp += strlen(uss_Server); + in_text += 7; + } + + else if (strncmp(in_var, "$PART", 5) == 0) { + strcpy(out_cp, uss_Partition); + out_cp += strlen(uss_Partition); + in_text += 5; + } + + else if (strncmp(in_var, "$MTPT", 5) == 0) { + strcpy(out_cp, uss_MountPoint); + out_cp += strlen(uss_MountPoint); + in_text += 5; + } + + else if (strncmp(in_var, "$NAME", 5) == 0) { + strcpy(out_cp, uss_RealName); + out_cp += strlen(uss_RealName); + in_text += 5; + } + + else if (strncmp(in_var, "$AUTO", 5) == 0) { + /*Picks a dir with minimum entries*/ + uss_procs_PickADir(out, out_cp /*, uss_Auto*/); + printf("debug: $AUTO = %s\n", uss_Auto); + strcpy(out_cp, uss_Auto); + out_cp += strlen(uss_Auto); + in_text += 5; + } + else if (strncmp(in_var, "$PWEXPIRES", 10) == 0) { + sprintf(out_cp, " %d ", uss_Expires); + out_cp += strlen(out_cp); + in_text += 10; + } + + else{ + /*Unknown variable*/ + fprintf(stderr, + "Warning: unknown variable in config file: '%s'\n", + in_var); + *out_cp++ = *in_text++; + } + } + + /* + * At this point, we've copied over the in buffer up to the point + * of the last variable instance, so copy over the rest. If this + * is a quoted string, we place the terminating null where the + * ending double quote is. + */ + while(*in_text != '\0') + *out_cp++ = *in_text++; + + if (isQuotedString) { + nullP = strchr(out, '"'); + if (nullP == NULL) + nullP = out_cp; + } + else + nullP = out_cp; + *nullP = '\0'; + +} /*Replace*/ + +yywrap() +{ +return(1); +} 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__ */