gcc-3.4-kfs.patch
Date: Fri Nov  5 12:24:05 EST 2004
Author: Jeremy Kerr
Title: Extend gcc 3.4 compatibility to KFS code
Status: Committed

diff -urN os/servers/kfs/FileSystemKFSK42.C os/servers/kfs/FileSystemKFSK42.C
--- os/servers/kfs/FileSystemKFSK42.C	2004-10-27 13:56:27.000000000 +1000
+++ os/servers/kfs/FileSystemKFSK42.C	2004-11-05 12:02:35.000000000 +1100
@@ -220,7 +220,7 @@
     SysStatus rc;
     void *curr = NULL;
     FileSystemKFSRef fsref = NULL;
-    while ((curr = instances.next(curr, (ObjRef)fsref))) {
+    while ((curr = instances.next(curr, (ObjRef &)fsref))) {
 	rc = DREF(fsref)->sync();
 	_IF_FAILURE_RET(rc);
     }
@@ -275,7 +275,7 @@
     SysStatus rc;
     void *curr = NULL;
     FileSystemKFSRef fsref = NULL;
-    while ((curr = instances.next(curr, (ObjRef)fsref))) {
+    while ((curr = instances.next(curr, (ObjRef &)fsref))) {
 	rc = DREF(fsref)->printStats();
 	_IF_FAILURE_RET(rc);
     }
diff -urN os/servers/kfs/KFSHash.H os/servers/kfs/KFSHash.H
--- os/servers/kfs/KFSHash.H	2004-10-27 13:56:27.000000000 +1000
+++ os/servers/kfs/KFSHash.H	2004-11-05 11:58:53.000000000 +1100
@@ -55,7 +55,7 @@
 
     // returns 1 if element was already there; 0 otherwise
     uval findAddLock(KEY key, KFSHashEntry<NODE> **entry) {
-	AutoLock<BLock> al(&lock);	// locks now, unlocks on return
+	AutoLock<BLock> al(&this->lock);	// locks now, unlocks on return
 	KFSHashEntry<NODE> *tmp;
 	if (locked_find(key, tmp)) {
 	    uval ret = 1;
@@ -78,7 +78,7 @@
 
     // returns 1 if element was already there; 0 otherwise
     uval findLock(KEY key, KFSHashEntry<NODE> **entry) {
-	AutoLock<BLock> al(&lock);	// locks now, unlocks on return
+	AutoLock<BLock> al(&this->lock);	// locks now, unlocks on return
 	KFSHashEntry<NODE> *tmp;
 	if (locked_find(key, tmp)) {
 	    if (!tmp->getInvalid()) {
@@ -93,7 +93,7 @@
     // it should be locked_find, but the parent has a locked_find and it's
     // not virtual
     uval lockedFind(KEY key, KFSHashEntry<NODE>** entry) {
-	_ASSERT_HELD(lock);
+	_ASSERT_HELD(this->lock);
 	passertMsg(0, "NIY");
 	return 0;
     }
@@ -111,7 +111,7 @@
     }
 
     void removeAll() {
-	AutoLock<BLock> al(&lock);	// locks now, unlocks on return
+	AutoLock<BLock> al(&this->lock);	// locks now, unlocks on return
 	KFSHashEntry<NODE> *entry;
 	KEY key;
 	uval restart = 0;
@@ -135,7 +135,7 @@
     }
 
     uval locked_getFirstLock(KEY &key, KFSHashEntry<NODE> **n) {
-	_ASSERT_HELD(lock);
+	_ASSERT_HELD(this->lock);
 	uval elem;
 	uval ret;
 	do {
@@ -165,17 +165,12 @@
 
 
     uval locked_isEmpty() {
-	_ASSERT_HELD(lock);
+	_ASSERT_HELD(this->lock);
 	uval k, n;
 	// do not lock
 	uval ret;
-	do {
-	    ret = HashSimpleBase<AllocGlobal, 0>::getFirst(k, n);
-	    if (ret && !n->getInvalid()) {
-		return 0;
-	    }
-	} while (ret);
-	return 1;
+	ret = HashSimpleBase<AllocGlobal, 0>::getFirst(k, n);
+	return ret ? 1 : 0;
     }
 
     // FIXME: get rid of this!!! Only used by a hack for Linux, and only
@@ -184,19 +179,13 @@
 	uval k, n;
 	// do not lock
 	uval ret;
-	do {
-	    ret = HashSimpleBase<AllocGlobal, 0>::getFirst(k, n);
-	    if (ret && !n->getInvalid()) {
-		return 0;
-	    }
-	} while (ret);
-	return 1;
-
+	ret = HashSimpleBase<AllocGlobal, 0>::getFirst(k, n);
+	return ret ? 1 : 0;
     }
 
     // returns 0 if nothing, non-zero if something (skip invalid)
     uval locked_getFirst(KEY& key, KFSHashEntry<NODE>*& datum) {
-	_ASSERT_HELD(lock);
+	_ASSERT_HELD(this->lock);
 	uval ret;
 	do {
 	    ret = HashSimpleBase<AllocGlobal, 0>::getFirst((uval&)key,
@@ -209,7 +198,7 @@
     }
     // returns 0 if nothing, non-zero if something (skip invalid)
     uval locked_getNext(KEY& key, KFSHashEntry<NODE>*& datum) {
-	_ASSERT_HELD(lock);
+	_ASSERT_HELD(this->lock);
 	uval ret;
 	do {
 	    ret = HashSimpleBase<AllocGlobal, 0>::getNext((uval&)key,
diff -urN os/servers/kfs/ServerObject.C os/servers/kfs/ServerObject.C
--- os/servers/kfs/ServerObject.C	2004-10-27 13:56:27.000000000 +1000
+++ os/servers/kfs/ServerObject.C	2004-11-05 12:00:43.000000000 +1100
@@ -119,11 +119,6 @@
 sval
 ServerObjectAllocator::join(ServerObject *newObj, uval type)
 {
-    if (type > maxTypes) {
-	tassertMsg(0, "?");
-        return -1;
-    }
-
     // FIXME: this function should have a lock around this
     if(obj[type] != NULL) {
 	tassertMsg(0, "?");
@@ -143,10 +138,6 @@
 SysStatusUval
 ServerObjectAllocator::locationAlloc(PsoType type, ObjTokenID id)
 {
-    if ((uval)type > maxTypes) {
-        return 0;
-    }
-
     if (obj[type] == NULL) {
         return 0;
     }
