Index: openafs/src/WINNT/afsd/afskfw.c
diff -c openafs/src/WINNT/afsd/afskfw.c:1.8.2.7 openafs/src/WINNT/afsd/afskfw.c:1.8.2.9
*** openafs/src/WINNT/afsd/afskfw.c:1.8.2.7	Sun Jan 30 23:08:57 2005
--- openafs/src/WINNT/afsd/afskfw.c	Sun Feb 20 20:16:39 2005
***************
*** 100,105 ****
--- 100,106 ----
  DECL_FUNC_PTR(Leash_get_default_renew_min);
  DECL_FUNC_PTR(Leash_get_default_renew_max);
  DECL_FUNC_PTR(Leash_get_default_renewable);
+ DECL_FUNC_PTR(Leash_get_default_mslsa_import);
  
  // krb5 functions
  DECL_FUNC_PTR(krb5_change_password);
***************
*** 154,159 ****
--- 155,161 ----
  DECL_FUNC_PTR(krb5_get_default_config_files);
  DECL_FUNC_PTR(krb5_free_config_files);
  DECL_FUNC_PTR(krb5_get_default_realm);
+ DECL_FUNC_PTR(krb5_free_default_realm);
  DECL_FUNC_PTR(krb5_free_ticket);
  DECL_FUNC_PTR(krb5_decode_ticket);
  DECL_FUNC_PTR(krb5_get_host_realm);
***************
*** 357,363 ****
--- 359,367 ----
  static int                mid_cnt = 0;
  static struct textField * mid_tb = NULL;
  static HINSTANCE hKrb5 = 0;
+ #ifdef USE_KRB4
  static HINSTANCE hKrb4 = 0;
+ #endif /* USE_KRB4 */
  static HINSTANCE hKrb524 = 0;
  #ifdef USE_MS2MIT
  static HINSTANCE hSecur32 = 0;
***************
*** 427,434 ****
--- 431,440 ----
  {
      if (hKrb5)
          FreeLibrary(hKrb5);
+ #ifdef USE_KRB4
      if (hKrb4)
          FreeLibrary(hKrb4);
+ #endif /* USE_KRB4 */
      if (hProfile)
          FreeLibrary(hProfile);
      if (hComErr)
***************
*** 901,908 ****
      char * pname = NULL;
      krb5_data *  princ_realm;
      krb5_error_code code;
!     char cell[128]="", realm[128]="";
      int i;
           
      if (!pkrb5_init_context)
          return;
--- 907,915 ----
      char * pname = NULL;
      krb5_data *  princ_realm;
      krb5_error_code code;
!     char cell[128]="", realm[128]="", *def_realm = 0;
      int i;
+     DWORD dwMsLsaImport;
           
      if (!pkrb5_init_context)
          return;
***************
*** 923,928 ****
--- 930,961 ----
      code = pkrb5_cc_get_principal(ctx, cc, &princ);
      if ( code ) goto cleanup;
  
+     dwMsLsaImport = pLeash_get_default_mslsa_import();
+     switch ( dwMsLsaImport ) {
+     case 0: /* do not import */
+         goto cleanup;
+     case 1: /* always import */
+         break;
+     case 2: { /* matching realm */
+         char ms_realm[128] = "", *r;
+         int i;
+ 
+         for ( r=ms_realm, i=0; i<krb5_princ_realm(ctx, princ)->length; r++, i++ ) {
+             *r = krb5_princ_realm(ctx, princ)->data[i];
+         }
+         *r = '\0';
+ 
+         if (code = pkrb5_get_default_realm(ctx, &def_realm))
+             goto cleanup;
+ 
+         if (strcmp(def_realm, ms_realm))
+             goto cleanup;
+         break;
+     }
+     default:
+         break;
+     }
+ 
      code = pkrb5_unparse_name(ctx,princ,&pname);
      if ( code ) goto cleanup;
  
***************
*** 949,954 ****
--- 982,989 ----
          pkrb5_free_unparsed_name(ctx,pname);
      if (princ)
          pkrb5_free_principal(ctx,princ);
+     if (def_realm)
+         pkrb5_free_default_realm(ctx, def_realm);
      if (cc)
          pkrb5_cc_close(ctx,cc);
      if (ctx)
***************
*** 1166,1173 ****
  {
      krb5_context ctx = 0;
      krb5_ccache cc = 0;
!     char * realm = 0;
!     char ** realmlist = 0;
      krb5_principal principal = 0;
      char * pname = 0;
      krb5_error_code code;
--- 1201,1207 ----
  {
      krb5_context ctx = 0;
      krb5_ccache cc = 0;
!     char * realm = 0, * userrealm = 0;
      krb5_principal principal = 0;
      char * pname = 0;
      krb5_error_code code;
***************
*** 1195,1213 ****
      code = KFW_AFS_get_cellconfig( cell, (void*)&cellconfig, local_cell);
      if ( code ) goto cleanup;
  
!     realm = strchr(username,'@');
!     if ( realm ) {
          pname = strdup(username);
!         realm = strchr(pname, '@');
!         *realm = '\0';
  
          /* handle kerberos iv notation */
          while ( dot = strchr(pname,'.') ) {
              *dot = '/';
          }
!         *realm++ = '@';
      } else {
-         realm = afs_realm_of_cell(ctx, &cellconfig);  // do not free
          pname = malloc(strlen(username) + strlen(realm) + 2);
  
          strcpy(pname, username);
--- 1229,1247 ----
      code = KFW_AFS_get_cellconfig( cell, (void*)&cellconfig, local_cell);
      if ( code ) goto cleanup;
  
!     realm = afs_realm_of_cell(ctx, &cellconfig);  // do not free
!     userrealm = strchr(username,'@');
!     if (userrealm) {
          pname = strdup(username);
!         userrealm = strchr(pname, '@');
!         *userrealm = '\0';
  
          /* handle kerberos iv notation */
          while ( dot = strchr(pname,'.') ) {
              *dot = '/';
          }
!         *userrealm++ = '@';
      } else {
          pname = malloc(strlen(username) + strlen(realm) + 2);
  
          strcpy(pname, username);
***************
*** 2430,2436 ****
--- 2464,2472 ----
  {
      static char lastcell[MAXCELLCHARS+1] = { 0 };
      static char confname[512] = { 0 };
+ #ifdef AFS_ID_TO_NAME
      char username_copy[BUFSIZ];
+ #endif /* AFS_ID_TO_NAME */
      long viceId;			/* AFS uid of user */
      int  status = 0;
  #ifdef ALLOW_REGISTER
***************
*** 2538,2544 ****
--- 2574,2582 ----
  {
      long	rc = 0;
      CREDENTIALS	creds;
+ #ifdef USE_KRB4
      KTEXT_ST    ticket;
+ #endif /* USE_KRB4 */
      struct ktc_principal	aserver;
      struct ktc_principal	aclient;
      char	realm_of_user[REALM_SZ]; /* Kerberos realm of user */
***************
*** 2560,2565 ****
--- 2598,2604 ----
      krb5_creds * k5creds = 0;
      krb5_error_code code;
      krb5_principal client_principal = 0;
+     krb5_data * k5data;
      int i, retry = 0;
  
      CurrentState = 0;
***************
*** 2621,2627 ****
          goto skip_krb5_init;
      }
  
!     if ( strchr(krb5_princ_component(ctx,client_principal,0),'.') != NULL )
      {
          OutputDebugString("Illegal Principal name contains dot in first component\n");
          rc = KRB5KRB_ERR_GENERIC;
--- 2660,2674 ----
          goto skip_krb5_init;
      }
  
!     /* lookfor client principals which cannot be distinguished 
!      * from Kerberos 4 multi-component principal names
!      */
!     k5data = krb5_princ_component(ctx,client_principal,0);
!     for ( i=0; i<k5data->length; i++ ) {
!         if ( k5data->data[i] == '.' )
!             break;
!     }
!     if (i != k5data->length)
      {
          OutputDebugString("Illegal Principal name contains dot in first component\n");
          rc = KRB5KRB_ERR_GENERIC;
Index: openafs/src/WINNT/afsd/afslogon.c
diff -c openafs/src/WINNT/afsd/afslogon.c:1.24.2.5 openafs/src/WINNT/afsd/afslogon.c:1.24.2.6
*** openafs/src/WINNT/afsd/afslogon.c:1.24.2.5	Sun Jan 30 23:05:00 2005
--- openafs/src/WINNT/afsd/afslogon.c	Sun Feb 20 20:16:39 2005
***************
*** 611,617 ****
      DWORD code;
  
      int pw_exp;
!     char *reason;
      char *ctemp;
  
      BOOLEAN interactive;
--- 611,617 ----
      DWORD code;
  
      int pw_exp;
!     char *reason = 0;
      char *ctemp;
  
      BOOLEAN interactive;
***************
*** 623,629 ****
  
      BOOLEAN afsWillAutoStart;
  
!     BOOLEAN uppercased_name = TRUE;
  
      LogonOptions_t opt; /* domain specific logon options */
      int retryInterval;
--- 623,629 ----
  
      BOOLEAN afsWillAutoStart;
  
!     BOOLEAN lowercased_name = TRUE;
  
      LogonOptions_t opt; /* domain specific logon options */
      int retryInterval;
***************
*** 654,663 ****
      ctemp = strchr(uname, '@');
      if (ctemp) *ctemp = 0;
  
!     /* is the name all uppercase? */
      for ( ctemp = uname; *ctemp ; ctemp++) {
!         if ( islower(*ctemp) ) {
!             uppercased_name = FALSE;
              break;
          }
      }
--- 654,663 ----
      ctemp = strchr(uname, '@');
      if (ctemp) *ctemp = 0;
  
!     /* is the name all lowercase? */
      for ( ctemp = uname; *ctemp ; ctemp++) {
!         if ( !islower(*ctemp) ) {
!             lowercased_name = FALSE;
              break;
          }
      }
***************
*** 739,776 ****
  		
          /* if Integrated Logon  */
          if (ISLOGONINTEGRATED(opt.LogonOption))
!         {			
              if ( KFW_is_available() ) {
                  code = KFW_AFS_get_cred(uname, cell, password, 0, opt.smbName, &reason);
!                 DebugEvent("KFW_AFS_get_cred  uname=[%s] smbname=[%s] cell=[%s] code=[%d]",uname,opt.smbName,cell,code);
!             }
!             else {
                  code = ka_UserAuthenticateGeneral2(KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON,
                                                      uname, "", cell, password, opt.smbName, 0, &pw_exp, 0,
                                                      &reason);
!                 DebugEvent("AFS AfsLogon - (INTEGRATED only)ka_UserAuthenticateGeneral2","Code[%x]",
!                             code);
              }       
!             if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && uppercased_name ) {
                  for ( ctemp = uname; *ctemp ; ctemp++) {
                      *ctemp = tolower(*ctemp);
                  }
!                 uppercased_name = FALSE;
                  goto sleeping;
              }
  
              /* is service started yet?*/
-             DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s]",
-                         code,uname,cell);
- 
              /* If we've failed because the client isn't running yet and the
              * client is set to autostart (and therefore it makes sense for
              * us to wait for it to start) then sleep a while and try again. 
              * If the error was something else, then give up. */
              if (code != KTC_NOCM && code != KTC_NOCMRPC || !afsWillAutoStart)
                  break;
!         }
!         else {  
              /*JUST check to see if its running*/
              if (IsServiceRunning())
                  break;
--- 739,782 ----
  		
          /* if Integrated Logon  */
          if (ISLOGONINTEGRATED(opt.LogonOption))
!         {	
              if ( KFW_is_available() ) {
                  code = KFW_AFS_get_cred(uname, cell, password, 0, opt.smbName, &reason);
!                 DebugEvent("KFW_AFS_get_cred  uname=[%s] smbname=[%s] cell=[%s] code=[%d]",
!                            uname,opt.smbName,cell,code);
!             } else {
                  code = ka_UserAuthenticateGeneral2(KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON,
                                                      uname, "", cell, password, opt.smbName, 0, &pw_exp, 0,
                                                      &reason);
! 
!                 DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s] Reason[%s]",
!                             code,uname,cell,reason ? reason : "<none>");
!                 {
!                     char msg[2048];
!                     sprintf(msg, "Code[%x] uname[%s] Cell[%s] Reason[%s]",
!                             code,uname,cell,reason ? reason : "<none>");
!                     MessageBox(hwndOwner,
!                                 msg,
!                                 "AFS Logon",
!                                 MB_ICONINFORMATION | MB_OK);
!                 }
              }       
!             if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && !lowercased_name ) {
                  for ( ctemp = uname; *ctemp ; ctemp++) {
                      *ctemp = tolower(*ctemp);
                  }
!                 lowercased_name = TRUE;
                  goto sleeping;
              }
  
              /* is service started yet?*/
              /* If we've failed because the client isn't running yet and the
              * client is set to autostart (and therefore it makes sense for
              * us to wait for it to start) then sleep a while and try again. 
              * If the error was something else, then give up. */
              if (code != KTC_NOCM && code != KTC_NOCMRPC || !afsWillAutoStart)
                  break;
!         } else {  
              /*JUST check to see if its running*/
              if (IsServiceRunning())
                  break;
Index: openafs/src/WINNT/afsd/cm_aclent.c
diff -c openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.3 openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.4
*** openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.3	Sun Jan 30 23:24:44 2005
--- openafs/src/WINNT/afsd/cm_aclent.c	Sun Feb 20 20:16:20 2005
***************
*** 24,35 ****
   * in either the free list or in the LRU queue.  A read lock prevents someone
   * from modifying the list(s), and a write lock is required for modifying
   * the list.  The actual data stored in the randomUid and randomAccess fields
!  * is actually maintained as up-to-date or not via the scache llock.
   * An aclent structure is free if it has no back vnode pointer.
   */
  osi_rwlock_t cm_aclLock;		/* lock for system's aclents */
  cm_aclent_t *cm_aclLRUp;                /* LRUQ for dudes in vnode's lists */
  cm_aclent_t *cm_aclLRUEndp;             /* ditto */
  /* 
   * Get an acl cache entry for a particular user and file, or return that it doesn't exist.
   * Called with the scp locked.
--- 24,67 ----
   * in either the free list or in the LRU queue.  A read lock prevents someone
   * from modifying the list(s), and a write lock is required for modifying
   * the list.  The actual data stored in the randomUid and randomAccess fields
!  * is actually maintained as up-to-date or not via the scache lock.
   * An aclent structure is free if it has no back vnode pointer.
   */
  osi_rwlock_t cm_aclLock;		/* lock for system's aclents */
  cm_aclent_t *cm_aclLRUp;                /* LRUQ for dudes in vnode's lists */
  cm_aclent_t *cm_aclLRUEndp;             /* ditto */
+ 
+ /* This function must be called with cm_aclLock and the aclp->back_mx held */
+ static void CleanupACLEnt(cm_aclent_t * aclp)
+ {
+     cm_aclent_t *taclp;
+     cm_aclent_t **laclpp;
+ 
+     if (aclp->backp) {
+         /* 
+          * Remove the entry from the vnode's list
+          */
+         laclpp = &aclp->backp->randomACLp;
+         for ( taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp ) {
+             if (taclp == aclp)
+                 break;
+         }
+         if (!taclp)
+             osi_panic("CleanupACLEnt race",__FILE__,__LINE__);
+         *laclpp = aclp->nextp;                  /* remove from the vnode's list */
+         aclp->backp = NULL;
+     }
+ 
+     /* release the old user */
+     if (aclp->userp) {
+         cm_ReleaseUser(aclp->userp);
+         aclp->userp = NULL;
+     }
+ 
+     aclp->randomAccess = 0;
+     aclp->tgtLifetime = 0;
+ }
+ 
  /* 
   * Get an acl cache entry for a particular user and file, or return that it doesn't exist.
   * Called with the scp locked.
***************
*** 40,55 ****
      long retval = -1;
  
      lock_ObtainWrite(&cm_aclLock);
      for (aclp = scp->randomACLp; aclp; aclp = aclp->nextp) {
          if (aclp->userp == userp) {
!             if (aclp->tgtLifetime && aclp->tgtLifetime <= (long) osi_Time()) {
                  /* ticket expired */
!                 aclp->tgtLifetime = 0;
!                 *rightsp = 0;   /* get a new acl from server */
! 
!                 /* Shouldn't we remove this entry from the scp?
!                  * 2005-01-25 - jaltman@secure-endpoints.com
!                  */
              } else {
                  *rightsp = aclp->randomAccess;
                  if (cm_aclLRUEndp == aclp)
--- 72,89 ----
      long retval = -1;
  
      lock_ObtainWrite(&cm_aclLock);
+     *rightsp = 0;       /* get a new acl from server if we don't find a 
+                          * current entry
+                          */
      for (aclp = scp->randomACLp; aclp; aclp = aclp->nextp) {
          if (aclp->userp == userp) {
!             if (aclp->tgtLifetime && aclp->tgtLifetime <= osi_Time()) {
                  /* ticket expired */
!                 osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q);
!                 CleanupACLEnt(aclp);
!                 osi_QAddT((osi_queue_t **) &cm_aclLRUp,
!                            (osi_queue_t **) &cm_aclLRUEndp,
!                            &aclp->q);
              } else {
                  *rightsp = aclp->randomAccess;
                  if (cm_aclLRUEndp == aclp)
***************
*** 78,113 ****
  static cm_aclent_t *GetFreeACLEnt(void)
  {
      cm_aclent_t *aclp;
-     cm_aclent_t *taclp;
-     cm_aclent_t **laclpp;
  
      if (cm_aclLRUp == NULL)
          osi_panic("empty aclent LRU", __FILE__, __LINE__);
  
      aclp = cm_aclLRUEndp;
!     if (aclp == cm_aclLRUEndp)
!         cm_aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q);
      osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q);
!     if (aclp->backp) {
!         /* 
!          * Remove the entry from the vnode's list 
!          */
!         laclpp = &aclp->backp->randomACLp;
!         for (taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp) {
!             if (taclp == aclp) 
!                 break;
!         }
!         if (!taclp) 
!             osi_panic("GetFreeACLEnt race", __FILE__, __LINE__);
!         *laclpp = aclp->nextp;			/* remove from vnode list */
!         aclp->backp = NULL;
!     }
! 
!     /* release the old user */
!     if (aclp->userp) {
!         cm_ReleaseUser(aclp->userp);
!         aclp->userp = NULL;
!     }
      return aclp;
  }
  
--- 112,125 ----
  static cm_aclent_t *GetFreeACLEnt(void)
  {
      cm_aclent_t *aclp;
  
      if (cm_aclLRUp == NULL)
          osi_panic("empty aclent LRU", __FILE__, __LINE__);
  
      aclp = cm_aclLRUEndp;
!     cm_aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q);
      osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q);
!     CleanupACLEnt(aclp);
      return aclp;
  }
  
Index: openafs/src/WINNT/afsd/cm_aclent.h
diff -c openafs/src/WINNT/afsd/cm_aclent.h:1.2 openafs/src/WINNT/afsd/cm_aclent.h:1.2.20.1
*** openafs/src/WINNT/afsd/cm_aclent.h:1.2	Sat Nov  4 05:01:36 2000
--- openafs/src/WINNT/afsd/cm_aclent.h	Sun Feb 20 20:16:20 2005
***************
*** 23,29 ****
      struct cm_scache *backp;	/* back ptr to vnode */
      struct cm_user *userp;	/* user whose access is cached */
      long randomAccess;		/* watch for more rights in acl.h */
!     long tgtLifetime;		/* time this expires */
  } cm_aclent_t;
  
  extern osi_rwlock_t cm_aclLock;
--- 23,29 ----
      struct cm_scache *backp;	/* back ptr to vnode */
      struct cm_user *userp;	/* user whose access is cached */
      long randomAccess;		/* watch for more rights in acl.h */
!     unsigned long tgtLifetime;	/* time this expires */
  } cm_aclent_t;
  
  extern osi_rwlock_t cm_aclLock;
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.9 openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.10
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.9	Sun Jan 30 23:23:45 2005
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Sun Feb 20 20:16:39 2005
***************
*** 1431,1437 ****
                      cm_ReleaseSCache(tscp);
                      if (psp) 
                          cm_FreeSpace(psp);
!                     return code;
                  }
                  haveComponent = 0;	/* component done */
                  dirScp = tscp;		/* for some symlinks */
--- 1431,1440 ----
                      cm_ReleaseSCache(tscp);
                      if (psp) 
                          cm_FreeSpace(psp);
!                     if (code == CM_ERROR_NOSUCHFILE && tscp->fileType == CM_SCACHETYPE_SYMLINK)
!                         return CM_ERROR_NOSUCHPATH;
!                     else
!                         return code;
                  }
                  haveComponent = 0;	/* component done */
                  dirScp = tscp;		/* for some symlinks */
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.42.2.17 openafs/src/WINNT/afsd/smb3.c:1.42.2.20
*** openafs/src/WINNT/afsd/smb3.c:1.42.2.17	Sun Jan 30 23:24:58 2005
--- openafs/src/WINNT/afsd/smb3.c	Sun Feb 20 20:16:40 2005
***************
*** 100,106 ****
      char tc;
  
      while (tc = *maskp++)
!         if (tc == '?' || tc == '*') 
              return 1;
      return 0;
  }
--- 100,106 ----
      char tc;
  
      while (tc = *maskp++)
!         if (tc == '?' || tc == '*' || tc == '<' || tc == '>') 
              return 1;
      return 0;
  }
***************
*** 3362,3368 ****
  // BOOL : TRUE/FALSE (match/mistmatch)
  
  BOOL 
! szWildCardMatchFileName(PSZ pattern, PSZ name) 
  {
      PSZ pename;         // points to the last 'name' character
      PSZ p;
--- 3362,3368 ----
  // BOOL : TRUE/FALSE (match/mistmatch)
  
  BOOL 
! szWildCardMatchFileName(PSZ pattern, PSZ name, int casefold) 
  {
      PSZ pename;         // points to the last 'name' character
      PSZ p;
***************
*** 3379,3391 ****
              if (*pattern == '\0')
                  return TRUE;
              for (p = pename; p >= name; --p) {
!                 if ((mapCaseTable[*p] == mapCaseTable[*pattern]) &&
!                      szWildCardMatchFileName(pattern + 1, p + 1))
                      return TRUE;
              } /* endfor */
              return FALSE;
          default:
!             if (mapCaseTable[*name] != mapCaseTable[*pattern]) 
                  return FALSE;
              ++pattern, ++name;
              break;
--- 3379,3393 ----
              if (*pattern == '\0')
                  return TRUE;
              for (p = pename; p >= name; --p) {
!                 if ((casefold && (mapCaseTable[*p] == mapCaseTable[*pattern]) ||
!                      !casefold && (*p == *pattern)) &&
!                      szWildCardMatchFileName(pattern + 1, p + 1, casefold))
                      return TRUE;
              } /* endfor */
              return FALSE;
          default:
!             if ((casefold && mapCaseTable[*name] != mapCaseTable[*pattern]) ||
!                 (!casefold && *name != *pattern))
                  return FALSE;
              ++pattern, ++name;
              break;
***************
*** 3404,3415 ****
  int smb_V3MatchMask(char *namep, char *maskp, int flags) 
  {
      char * newmask;
!     int    i, j, star, qmark, retval;
  
      /* make sure we only match 8.3 names, if requested */
      if ((flags & CM_FLAG_8DOT3) && !cm_Is8Dot3(namep)) 
          return 0;
      
      /* optimize the pattern:
       * if there is a mixture of '?' and '*',
       * for example  the sequence "*?*?*?*"
--- 3406,3419 ----
  int smb_V3MatchMask(char *namep, char *maskp, int flags) 
  {
      char * newmask;
!     int    i, j, star, qmark, casefold, retval;
  
      /* make sure we only match 8.3 names, if requested */
      if ((flags & CM_FLAG_8DOT3) && !cm_Is8Dot3(namep)) 
          return 0;
      
+     casefold = (flags & CM_FLAG_CASEFOLD) ? 1 : 0;
+ 
      /* optimize the pattern:
       * if there is a mixture of '?' and '*',
       * for example  the sequence "*?*?*?*"
***************
*** 3446,3452 ****
      }
      newmask[j++] = '\0';
  
!     retval = szWildCardMatchFileName(newmask, namep) ? 1:0;
  
      free(newmask);
      return retval;
--- 3450,3456 ----
      }
      newmask[j++] = '\0';
  
!     retval = szWildCardMatchFileName(newmask, namep, casefold) ? 1:0;
  
      free(newmask);
      return retval;
***************
*** 4127,4134 ****
                  bytesInBuffer++;
              }
          }	/* if we're including this name */
!         else if (!NeedShortName &&
!                  !starPattern &&
                   !foundInexact &&
                   dep->fid.vnode != 0 &&
                   smb_V3MatchMask(dep->name, maskp, CM_FLAG_CASEFOLD)) {
--- 4131,4137 ----
                  bytesInBuffer++;
              }
          }	/* if we're including this name */
!         else if (!starPattern &&
                   !foundInexact &&
                   dep->fid.vnode != 0 &&
                   smb_V3MatchMask(dep->name, maskp, CM_FLAG_CASEFOLD)) {
***************
*** 5407,5414 ****
          }
  
          if (scp->fileType != CM_SCACHETYPE_FILE) {
! 			if (dscp)
!             cm_ReleaseSCache(dscp);
              cm_ReleaseSCache(scp);
              cm_ReleaseUser(userp);
              free(realPathp);
--- 5410,5417 ----
          }
  
          if (scp->fileType != CM_SCACHETYPE_FILE) {
!             if (dscp)
!                 cm_ReleaseSCache(dscp);
              cm_ReleaseSCache(scp);
              cm_ReleaseUser(userp);
              free(realPathp);
***************
*** 5419,5425 ****
      /* (only applies to single component case) */
      if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) {
          cm_ReleaseSCache(scp);
!         cm_ReleaseSCache(dscp);
          cm_ReleaseUser(userp);
          free(realPathp);
          return CM_ERROR_NOTDIR;
--- 5422,5429 ----
      /* (only applies to single component case) */
      if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) {
          cm_ReleaseSCache(scp);
!         if (dscp)
!             cm_ReleaseSCache(dscp);
          cm_ReleaseUser(userp);
          free(realPathp);
          return CM_ERROR_NOTDIR;
Index: openafs/src/afs/afs.h
diff -c openafs/src/afs/afs.h:1.48.2.8 openafs/src/afs/afs.h:1.48.2.10
*** openafs/src/afs/afs.h:1.48.2.8	Sun Jan 30 23:24:34 2005
--- openafs/src/afs/afs.h	Sun Feb 20 20:15:34 2005
***************
*** 43,49 ****
  #if     defined(AFS_HPUX102_ENV)
  #define AFS_FLOCK       k_flock
  #else
! #if     defined(AFS_SUN56_ENV) || (defined(AFS_LINUX24_ENV) && !defined(AFS_PPC64_LINUX26_ENV) && !defined(AFS_AMD64_LINUX26_ENV) && !defined(AFS_IA64_LINUX26_ENV))
  #define AFS_FLOCK       flock64
  #else
  #define AFS_FLOCK       flock
--- 43,49 ----
  #if     defined(AFS_HPUX102_ENV)
  #define AFS_FLOCK       k_flock
  #else
! #if     defined(AFS_SUN56_ENV) || (defined(AFS_LINUX24_ENV) && !defined(AFS_PPC64_LINUX26_ENV) && !defined(AFS_AMD64_LINUX26_ENV) && !defined(AFS_IA64_LINUX26_ENV) && !defined(AFS_S390X_LINUX26_ENV))
  #define AFS_FLOCK       flock64
  #else
  #define AFS_FLOCK       flock
***************
*** 696,702 ****
  	struct dcache *dchint;
      } h1;
  #ifdef AFS_LINUX22_ENV
-     u_short flushcnt;		/* Number of flushes which haven't released yet. */
      u_short mapcnt;		/* Number of mappings of this file. */
  #endif
  #if defined(AFS_SGI_ENV)
--- 696,701 ----
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.74.2.4 openafs/src/afs/afs_call.c:1.74.2.5
*** openafs/src/afs/afs_call.c:1.74.2.4	Sun Jan 30 23:23:22 2005
--- openafs/src/afs/afs_call.c	Sun Feb 20 20:15:34 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.4 2005/01/31 04:23:22 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.5 2005/02/21 01:15:34 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 1096,1102 ****
  };
  
  
! #if defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV))
  static void
  iparam32_to_iparam(const struct iparam32 *src, struct iparam *dst)
  {
--- 1096,1102 ----
  };
  
  
! #if defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV))
  static void
  iparam32_to_iparam(const struct iparam32 *src, struct iparam *dst)
  {
***************
*** 1139,1159 ****
      }
  #endif /* AFS_SUN57_64BIT_ENV */
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV)
      struct iparam32 dst32;
  
  #ifdef AFS_SPARC64_LINUX24_ENV
      if (current->thread.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_SPARC64_LINUX20_ENV)
      if (current->tss.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_AMD64_LINUX20_ENV)
      if (current->thread.flags & THREAD_IA32)
  #elif defined(AFS_PPC64_LINUX20_ENV)
      if (current->thread.flags & PPC_FLAG_32BIT) 
  #elif defined(AFS_S390X_LINUX20_ENV)
      if (current->thread.flags & S390_FLAG_31BIT) 
  #else
! #error Not done for this linux version
  #endif
      {
  	AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
--- 1139,1169 ----
      }
  #endif /* AFS_SUN57_64BIT_ENV */
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
      struct iparam32 dst32;
  
  #ifdef AFS_SPARC64_LINUX24_ENV
      if (current->thread.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_SPARC64_LINUX20_ENV)
      if (current->tss.flags & SPARC_FLAG_32BIT)
+ 
+ #elif defined(AFS_AMD64_LINUX26_ENV)
+     if (test_thread_flag(TIF_IA32))
  #elif defined(AFS_AMD64_LINUX20_ENV)
      if (current->thread.flags & THREAD_IA32)
+ 
+ #elif defined(AFS_PPC64_LINUX26_ENV)
+     if (current->thread_info->flags & _TIF_32BIT) 
  #elif defined(AFS_PPC64_LINUX20_ENV)
      if (current->thread.flags & PPC_FLAG_32BIT) 
+ 
+ #elif defined(AFS_S390X_LINUX26_ENV)
+     if (test_thread_flag(TIF_31BIT))
  #elif defined(AFS_S390X_LINUX20_ENV)
      if (current->thread.flags & S390_FLAG_31BIT) 
+ 
  #else
! #error iparam32 not done for this linux platform
  #endif
      {
  	AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
Index: openafs/src/afs/afs_dcache.c
diff -c openafs/src/afs/afs_dcache.c:1.42.2.6 openafs/src/afs/afs_dcache.c:1.42.2.7
*** openafs/src/afs/afs_dcache.c:1.42.2.6	Sun Jan 30 23:24:34 2005
--- openafs/src/afs/afs_dcache.c	Sun Feb 20 20:15:21 2005
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.42.2.6 2005/01/31 04:24:34 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.42.2.7 2005/02/21 01:15:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 1301,1308 ****
  	(*abytesXferredP) += code;
  #endif /* AFS_NOSTATS */
  	if (code != got) {
  	    osi_FreeLargeSpace(tbuffer);
! 	    return -33;
  	}
  	alen -= got;
  	/*
--- 1301,1309 ----
  	(*abytesXferredP) += code;
  #endif /* AFS_NOSTATS */
  	if (code != got) {
+ 	    code = rx_Error(acall);
  	    osi_FreeLargeSpace(tbuffer);
! 	    return code ? code : -33;
  	}
  	alen -= got;
  	/*
Index: openafs/src/afs/afs_memcache.c
diff -c openafs/src/afs/afs_memcache.c:1.15.2.1 openafs/src/afs/afs_memcache.c:1.15.2.2
*** openafs/src/afs/afs_memcache.c:1.15.2.1	Tue Dec  7 01:12:11 2004
--- openafs/src/afs/afs_memcache.c	Sun Feb 20 20:15:21 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_memcache.c,v 1.15.2.1 2004/12/07 06:12:11 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifndef AFS_LINUX22_ENV
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_memcache.c,v 1.15.2.2 2005/02/21 01:15:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifndef AFS_LINUX22_ENV
***************
*** 383,390 ****
  	code = rx_WritevAlloc(acall, tiov, &tnio, RX_MAXIOVECS, tlen);
  	RX_AFS_GLOCK();
  	if (code <= 0) {
  	    osi_FreeSmallSpace(tiov);
! 	    return -33;
  	}
  	tlen = code;
  	code = afs_MemReadvBlk(mceP, offset, tiov, tnio, tlen);
--- 383,391 ----
  	code = rx_WritevAlloc(acall, tiov, &tnio, RX_MAXIOVECS, tlen);
  	RX_AFS_GLOCK();
  	if (code <= 0) {
+ 	    code = rx_Error(acall);
  	    osi_FreeSmallSpace(tiov);
! 	    return code ? code : -33;
  	}
  	tlen = code;
  	code = afs_MemReadvBlk(mceP, offset, tiov, tnio, tlen);
***************
*** 399,406 ****
  	(*abytesXferredP) += code;
  #endif /* AFS_NOSTATS */
  	if (code != tlen) {
  	    osi_FreeSmallSpace(tiov);
! 	    return -33;
  	}
  	offset += tlen;
  	alen -= tlen;
--- 400,408 ----
  	(*abytesXferredP) += code;
  #endif /* AFS_NOSTATS */
  	if (code != tlen) {
+ 	    code = rx_Error(acall);
  	    osi_FreeSmallSpace(tiov);
! 	    return code ? code : -33;
  	}
  	offset += tlen;
  	alen -= tlen;
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.81.2.6 openafs/src/afs/afs_pioctl.c:1.81.2.8
*** openafs/src/afs/afs_pioctl.c:1.81.2.6	Sun Jan 30 23:19:41 2005
--- openafs/src/afs/afs_pioctl.c	Sun Feb 20 20:15:34 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.6 2005/01/31 04:19:41 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.8 2005/02/21 01:15:34 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
***************
*** 195,201 ****
  #define PSetClientContext 99	/*  Special pioctl to setup caller's creds  */
  int afs_nobody = NFS_NOBODY;
  
! #if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV))
  static void
  afs_ioctl32_to_afs_ioctl(const struct afs_ioctl32 *src, struct afs_ioctl *dst)
  {
--- 195,201 ----
  #define PSetClientContext 99	/*  Special pioctl to setup caller's creds  */
  int afs_nobody = NFS_NOBODY;
  
! #if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV))
  static void
  afs_ioctl32_to_afs_ioctl(const struct afs_ioctl32 *src, struct afs_ioctl *dst)
  {
***************
*** 260,284 ****
      }
  #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV)
      struct afs_ioctl32 dst32;
  
  #ifdef AFS_SPARC64_LINUX24_ENV
      if (current->thread.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_SPARC64_LINUX20_ENV)
      if (current->tss.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_AMD64_LINUX20_ENV)
      if (current->thread.flags & THREAD_IA32)
! #elif defined(AFS_PPC64_LINUX20_ENV)
! #ifdef AFS_PPC64_LINUX26_ENV
      if (current->thread_info->flags & _TIF_32BIT)
! #else /*Linux 2.6 */
      if (current->thread.flags & PPC_FLAG_32BIT)
! #endif
  #elif defined(AFS_S390X_LINUX20_ENV)
      if (current->thread.flags & S390_FLAG_31BIT)
  #else
! #error Not done for this linux type
  #endif
      {
  	AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
--- 260,290 ----
      }
  #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
      struct afs_ioctl32 dst32;
  
  #ifdef AFS_SPARC64_LINUX24_ENV
      if (current->thread.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_SPARC64_LINUX20_ENV)
      if (current->tss.flags & SPARC_FLAG_32BIT)
+ 
+ #elif defined(AFS_AMD64_LINUX26_ENV)
+     if (test_thread_flag(TIF_IA32))
  #elif defined(AFS_AMD64_LINUX20_ENV)
      if (current->thread.flags & THREAD_IA32)
! 
! #elif defined(AFS_PPC64_LINUX26_ENV)
      if (current->thread_info->flags & _TIF_32BIT)
! #elif defined(AFS_PPC64_LINUX20_ENV)
      if (current->thread.flags & PPC_FLAG_32BIT)
! 
! #elif defined(AFS_S390X_LINUX26_ENV)
!     if (test_thread_flag(TIF_31BIT))
  #elif defined(AFS_S390X_LINUX20_ENV)
      if (current->thread.flags & S390_FLAG_31BIT)
+ 
  #else
! #error pioctl32 not done for this linux
  #endif
      {
  	AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
***************
*** 1154,1159 ****
--- 1160,1166 ----
  	} else {
  	    osi_FreeLargeSpace(inData);
  	}
+ 	afs_PutFakeStat(&fakestate);
  	return ENOMEM;
      }
      outSize = 0;
Index: openafs/src/afs/afs_segments.c
diff -c openafs/src/afs/afs_segments.c:1.16.2.4 openafs/src/afs/afs_segments.c:1.16.2.5
*** openafs/src/afs/afs_segments.c:1.16.2.4	Tue Dec  7 01:12:12 2004
--- openafs/src/afs/afs_segments.c	Sun Feb 20 20:15:21 2005
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_segments.c,v 1.16.2.4 2004/12/07 06:12:12 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_segments.c,v 1.16.2.5 2005/02/21 01:15:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 60,67 ****
      do {
  	tc = afs_Conn(&avc->fid, areq, SHARED_LOCK);
  	if (tc) {
- 	    RX_AFS_GUNLOCK();
  	  retry:
  	    tcall = rx_NewCall(tc->id);
  	    RX_AFS_GLOCK();
  	    /* Set the client mod time since we always want the file
--- 60,67 ----
      do {
  	tc = afs_Conn(&avc->fid, areq, SHARED_LOCK);
  	if (tc) {
  	  retry:
+ 	    RX_AFS_GUNLOCK();
  	    tcall = rx_NewCall(tc->id);
  	    RX_AFS_GLOCK();
  	    /* Set the client mod time since we always want the file
***************
*** 104,120 ****
  #endif /* AFS_64BIT_CLIENT */
  	    if (code == 0) {
  		code = EndRXAFS_StoreData(tcall, &OutStatus, &tsync);
- #ifdef AFS_64BIT_CLIENT
- 		if (code == RXGEN_OPCODE) {
- 		    afs_serverSetNo64Bit(tc);
- 		    code = rx_EndCall(tcall, code);
- 		    goto retry;
- 		}
- #endif /* AFS_64BIT_CLIENT */
  	    }
  	    code = rx_EndCall(tcall, code);
  	    RX_AFS_GLOCK();
  	    XSTATS_END_TIME;
  	} else
  	    code = -1;
      } while (afs_Analyze
--- 104,119 ----
  #endif /* AFS_64BIT_CLIENT */
  	    if (code == 0) {
  		code = EndRXAFS_StoreData(tcall, &OutStatus, &tsync);
  	    }
  	    code = rx_EndCall(tcall, code);
  	    RX_AFS_GLOCK();
  	    XSTATS_END_TIME;
+ #ifdef AFS_64BIT_CLIENT
+ 	    if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) {
+ 		afs_serverSetNo64Bit(tc);
+ 		goto retry;
+ 	    }
+ #endif /* AFS_64BIT_CLIENT */
  	} else
  	    code = -1;
      } while (afs_Analyze
***************
*** 508,521 ****
  						   shouldwake, &lp1, &lp2);
  #endif /* AFS_NOSTATS */
  			    afs_CFileClose(tfile);
- #ifdef AFS_64BIT_CLIENT
- 			    if (code == RXGEN_OPCODE) {
- 				afs_serverSetNo64Bit(tc);
- 				goto restart;
- 			    }
- #endif /* AFS_64BIT_CLIENT */
  			    if ((tdc->f.chunkBytes < afs_OtherCSize)
! 				&& (i < (nchunks - 1))) {
  				int bsent, tlen, sbytes =
  				    afs_OtherCSize - tdc->f.chunkBytes;
  				char *tbuffer =
--- 507,514 ----
  						   shouldwake, &lp1, &lp2);
  #endif /* AFS_NOSTATS */
  			    afs_CFileClose(tfile);
  			    if ((tdc->f.chunkBytes < afs_OtherCSize)
! 				&& (i < (nchunks - 1)) && code == 0) {
  				int bsent, tlen, sbytes =
  				    afs_OtherCSize - tdc->f.chunkBytes;
  				char *tbuffer =
***************
*** 567,572 ****
--- 560,571 ----
  			    if (code2)
  				code = code2;
  			}
+ #ifdef AFS_64BIT_CLIENT
+ 			if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) {
+ 			    afs_serverSetNo64Bit(tc);
+ 			    goto restart;
+ 			}
+ #endif /* AFS_64BIT_CLIENT */
  		    } while (afs_Analyze
  			     (tc, code, &avc->fid, areq,
  			      AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK,
Index: openafs/src/afs/afs_server.c
diff -c openafs/src/afs/afs_server.c:1.33.2.3 openafs/src/afs/afs_server.c:1.33.2.5
*** openafs/src/afs/afs_server.c:1.33.2.3	Tue Dec  7 01:12:40 2004
--- openafs/src/afs/afs_server.c	Sun Feb 20 20:12:38 2005
***************
*** 33,39 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_server.c,v 1.33.2.3 2004/12/07 06:12:40 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 33,39 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_server.c,v 1.33.2.5 2005/02/21 01:12:38 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 499,505 ****
      afs_int32 i, j;
      afs_int32 code;
      afs_int32 start, end = 0, delta;
-     afs_int32 m_error;
      osi_timeval_t tv;
      struct unixuser *tu;
      char tbuffer[CVBS];
--- 499,504 ----
***************
*** 508,514 ****
      struct conn **conns;
      int nconns;
      struct rx_connection **rxconns;      
!     afs_int32 *conntimer, *deltas;
  
      AFS_STATCNT(afs_CheckServers);
  
--- 507,513 ----
      struct conn **conns;
      int nconns;
      struct rx_connection **rxconns;      
!     afs_int32 *conntimer, *deltas, *results;
  
      AFS_STATCNT(afs_CheckServers);
  
***************
*** 546,551 ****
--- 545,551 ----
      rxconns = (struct rx_connection **)afs_osi_Alloc(j * sizeof(struct rx_connection *));
      conntimer = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32));
      deltas = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32));
+     results = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32));
  
      for (i = 0; i < j; i++) {
  	deltas[i] = 0;
***************
*** 604,612 ****
  	tc = conns[multi_i];
  	sa = tc->srvr;
  	if (conntimer[multi_i] == 0)
! 	  rx_SetConnDeadTime(tc->id, AFS_RXDEADTIME);
  	end = osi_Time();
! 	m_error=multi_error;
  	if ((start == end) && !multi_error)
  	  deltas[multi_i] = end - tv.tv_sec;
  	
--- 604,612 ----
  	tc = conns[multi_i];
  	sa = tc->srvr;
  	if (conntimer[multi_i] == 0)
! 	  rx_SetConnDeadTime(tc->id, afs_rx_deadtime);
  	end = osi_Time();
! 	results[multi_i]=multi_error;
  	if ((start == end) && !multi_error)
  	  deltas[multi_i] = end - tv.tv_sec;
  	
***************
*** 617,623 ****
        tc = conns[i];
        sa = tc->srvr;
        
!       if (( m_error >= 0 ) && (sa->sa_flags & SRVADDR_ISDOWN) && (tc->srvr == sa)) {
  	/* server back up */
  	print_internet_address("afs: file server ", sa, " is back up", 2);
  	
--- 617,623 ----
        tc = conns[i];
        sa = tc->srvr;
        
!       if (( results[i] >= 0 ) && (sa->sa_flags & SRVADDR_ISDOWN) && (tc->srvr == sa)) {
  	/* server back up */
  	print_internet_address("afs: file server ", sa, " is back up", 2);
  	
***************
*** 631,637 ****
  	  afs_osi_Wakeup(&afs_waitForever);
  	}
        } else {
! 	if (m_error < 0) {
  	  /* server crashed */
  	  afs_ServerDown(sa);
  	  ForceNewConnections(sa);  /* multi homed clients */
--- 631,637 ----
  	  afs_osi_Wakeup(&afs_waitForever);
  	}
        } else {
! 	if (results[i] < 0) {
  	  /* server crashed */
  	  afs_ServerDown(sa);
  	  ForceNewConnections(sa);  /* multi homed clients */
***************
*** 713,718 ****
--- 713,719 ----
      afs_osi_Free(rxconns, j * sizeof(struct rx_connection *));
      afs_osi_Free(conntimer, j * sizeof(afs_int32));
      afs_osi_Free(deltas, j * sizeof(afs_int32));
+     afs_osi_Free(results, j * sizeof(afs_int32));
      
  } /*afs_CheckServers*/
  
Index: openafs/src/afs/afs_vcache.c
diff -c openafs/src/afs/afs_vcache.c:1.65.2.9 openafs/src/afs/afs_vcache.c:1.65.2.10
*** openafs/src/afs/afs_vcache.c:1.65.2.9	Sun Jan 30 23:20:35 2005
--- openafs/src/afs/afs_vcache.c	Sun Feb 20 20:12:53 2005
***************
*** 39,45 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65.2.9 2005/01/31 04:20:35 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 39,45 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65.2.10 2005/02/21 01:12:53 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 952,957 ****
--- 952,960 ----
  #endif
  	ip->i_sb = afs_globalVFS;
  	put_inode_on_dummy_list(ip);
+ #ifdef STRUCT_INODE_HAS_I_SB_LIST
+ 	list_add(&ip->i_sb_list, &ip->i_sb->s_inodes);
+ #endif
      }
  #endif
  
Index: openafs/src/afs/sysincludes.h
diff -c openafs/src/afs/sysincludes.h:1.28.2.2 openafs/src/afs/sysincludes.h:1.28.2.4
*** openafs/src/afs/sysincludes.h:1.28.2.2	Wed Dec  8 05:35:28 2004
--- openafs/src/afs/sysincludes.h	Sun Feb 20 20:13:58 2005
***************
*** 84,93 ****
--- 84,95 ----
  #include <asm/uaccess.h>
  #include <linux/list.h>
  #include <linux/dcache.h>
+ #include <linux/mount.h>
  #include <linux/fs.h>
  #include <linux/quota.h>
  #include <linux/sched.h>
  #include <linux/mm.h>
+ #include <linux/slab.h>
  #include <linux/string.h>
  #include <asm/semaphore.h>
  #include <linux/errno.h>
Index: openafs/src/afs/DARWIN/osi_vm.c
diff -c openafs/src/afs/DARWIN/osi_vm.c:1.14 openafs/src/afs/DARWIN/osi_vm.c:1.14.2.1
*** openafs/src/afs/DARWIN/osi_vm.c:1.14	Wed Jun 23 14:34:48 2004
--- openafs/src/afs/DARWIN/osi_vm.c	Sun Feb 20 20:14:18 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vm.c,v 1.14 2004/06/23 18:34:48 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vm.c,v 1.14.2.1 2005/02/21 01:14:18 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 281,287 ****
  		1
  #endif
  		)
! 		VOP_INACTIVE(vp, p);
  	    else
  		VOP_UNLOCK(vp, 0, p);
  #ifdef AFS_DARWIN14_ENV
--- 281,287 ----
  		1
  #endif
  		)
! 	      VOP_UNLOCK(vp, 0, p); /* was VOP_INACTIVE(vp, p); */
  	    else
  		VOP_UNLOCK(vp, 0, p);
  #ifdef AFS_DARWIN14_ENV
***************
*** 290,296 ****
  #endif
  	    if (obj) {
  		if (ISSET(vp->v_flag, VTERMINATE))
! 		    panic("afs_vnreclaim: already teminating");
  		SET(vp->v_flag, VTERMINATE);
  		memory_object_destroy(obj, 0);
  		while (ISSET(vp->v_flag, VTERMINATE)) {
--- 290,296 ----
  #endif
  	    if (obj) {
  		if (ISSET(vp->v_flag, VTERMINATE))
! 		    panic("afs_vnreclaim: already terminating");
  		SET(vp->v_flag, VTERMINATE);
  		memory_object_destroy(obj, 0);
  		while (ISSET(vp->v_flag, VTERMINATE)) {
Index: openafs/src/afs/LINUX/osi_misc.c
diff -c openafs/src/afs/LINUX/osi_misc.c:1.34.2.2 openafs/src/afs/LINUX/osi_misc.c:1.34.2.3
*** openafs/src/afs/LINUX/osi_misc.c:1.34.2.2	Sun Jan 30 23:16:29 2005
--- openafs/src/afs/LINUX/osi_misc.c	Sun Feb 20 20:13:08 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.34.2.2 2005/01/31 04:16:29 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.34.2.3 2005/02/21 01:13:08 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 28,71 ****
  #endif
  
  #if defined(AFS_LINUX24_ENV)
  /* Lookup name and return vnode for same. */
  int
! osi_lookupname(char *aname, uio_seg_t seg, int followlink,
! 			vnode_t ** dirvpp, struct dentry **dpp)
  {
      int code;
!     extern struct nameidata afs_cacheNd;
!     struct nameidata *nd = &afs_cacheNd;
! 
      code = ENOENT;
!     if (seg == AFS_UIOUSER) {
! 	code =
! 	    followlink ? user_path_walk(aname,
! 					nd) : user_path_walk_link(aname, nd);
!     } else {
  #if defined(AFS_LINUX26_ENV)
! 	code = path_lookup(aname, followlink ? LOOKUP_FOLLOW : 0, nd);
  #else
! 	if (path_init(aname, followlink ? LOOKUP_FOLLOW : 0, nd))
! 	    code = path_walk(aname, nd);
  #endif
-     }
  
      if (!code) {
! 	if (nd->dentry->d_inode) {
! 	    *dpp = dget(nd->dentry);
! 	    code = 0;
! 	} else {
! 	    code = ENOENT;
! 	    path_release(nd);
! 	}
      }
      return code;
  }
- #else
  int
  osi_lookupname(char *aname, uio_seg_t seg, int followlink, vnode_t ** dirvpp,
! 	       struct dentry **dpp)
  {
      struct dentry *dp = NULL;
      int code;
--- 28,87 ----
  #endif
  
  #if defined(AFS_LINUX24_ENV)
+ /* LOOKUP_POSITIVE is becoming the default */
+ #ifndef LOOKUP_POSITIVE
+ #define LOOKUP_POSITIVE 0
+ #endif
  /* Lookup name and return vnode for same. */
  int
! osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt,
! 			struct dentry **dpp)
  {
      int code;
!     struct nameidata nd;
!     int flags = LOOKUP_POSITIVE;
      code = ENOENT;
! 
!     if (followlink)
!        flags |= LOOKUP_FOLLOW;
  #if defined(AFS_LINUX26_ENV)
!     code = path_lookup(aname, flags, &nd);
  #else
!     if (path_init(aname, flags, &nd))
!         code = path_walk(aname, &nd);
  #endif
  
      if (!code) {
! 	*dpp = dget(nd.dentry);
!         if (mnt)
!            *mnt = mntget(nd.mnt);
! 	path_release(&nd);
      }
      return code;
  }
  int
  osi_lookupname(char *aname, uio_seg_t seg, int followlink, vnode_t ** dirvpp,
! 			struct dentry **dpp)
! {
!     int code;
!     char *tname;
!     code = ENOENT;
!     if (seg == AFS_UIOUSER) {
!         tname = getname(aname);
!         if (IS_ERR(tname)) 
!             return PTR_ERR(tname);
!     } else {
!         tname = aname;
!     }
!     code = osi_lookupname_internal(tname, followlink, NULL, dpp);   
!     if (seg == AFS_UIOUSER) {
!         putname(tname);
!     }
!     return code;
! }
! #else
! int
! osi_lookupname(char *aname, uio_seg_t seg, int followlink, vnode_t ** dirvpp, struct dentry **dpp)
  {
      struct dentry *dp = NULL;
      int code;
***************
*** 94,105 ****
  osi_InitCacheInfo(char *aname)
  {
      int code;
!     struct dentry *dp;
      extern ino_t cacheInode;
      extern struct osi_dev cacheDev;
      extern afs_int32 afs_fsfragsize;
      extern struct super_block *afs_cacheSBp;
!     code = osi_lookupname(aname, AFS_UIOSYS, 1, NULL, &dp);
      if (code)
  	return ENOENT;
  
--- 110,122 ----
  osi_InitCacheInfo(char *aname)
  {
      int code;
!     struct dentry *dp,*dpp;
      extern ino_t cacheInode;
      extern struct osi_dev cacheDev;
      extern afs_int32 afs_fsfragsize;
      extern struct super_block *afs_cacheSBp;
!     extern struct vfsmnt *afs_cacheMnt;
!     code = osi_lookupname_internal(aname, 1, &afs_cacheMnt, &dp);
      if (code)
  	return ENOENT;
  
Index: openafs/src/afs/LINUX/osi_module.c
diff -c openafs/src/afs/LINUX/osi_module.c:1.52.2.6 openafs/src/afs/LINUX/osi_module.c:1.52.2.7
*** openafs/src/afs/LINUX/osi_module.c:1.52.2.6	Sun Jan 30 23:25:13 2005
--- openafs/src/afs/LINUX/osi_module.c	Sun Feb 20 20:15:35 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.6 2005/01/31 04:25:13 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.7 2005/02/21 01:15:35 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
***************
*** 134,147 ****
  {
  
      struct afsprocdata sysargs;
  
      if (cmd != VIOC_SYSCALL) return -EINVAL;
  
!     if (copy_from_user(&sysargs, (void *)arg, sizeof(struct afsprocdata)))
! 	return -EFAULT;
  
!     return afs_syscall(sysargs.syscall, sysargs.param1,
! 		       sysargs.param2, sysargs.param3, sysargs.param4);
  }
  
  
--- 134,184 ----
  {
  
      struct afsprocdata sysargs;
+     struct afsprocdata32 sysargs32;
  
      if (cmd != VIOC_SYSCALL) return -EINVAL;
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
! #ifdef AFS_SPARC64_LINUX24_ENV
!     if (current->thread.flags & SPARC_FLAG_32BIT)
! #elif defined(AFS_SPARC64_LINUX20_ENV)
!     if (current->tss.flags & SPARC_FLAG_32BIT)
! #elif defined(AFS_AMD64_LINUX20_ENV)
! #ifdef AFS_LINUX26_ENV
!     if (test_thread_flag(TIF_IA32))
! #else
!     if (current->thread.flags & THREAD_IA32)
! #endif
! #elif defined(AFS_PPC64_LINUX20_ENV)
! #ifdef AFS_PPC64_LINUX26_ENV
!     if (current->thread_info->flags & _TIF_32BIT)
! #else /*Linux 2.6 */
!     if (current->thread.flags & PPC_FLAG_32BIT)
! #endif
! #elif defined(AFS_S390X_LINUX20_ENV)
!     if (current->thread.flags & S390_FLAG_31BIT)
! #else
! #error Not done for this linux type
! #endif
!     {
! 	if (copy_from_user(&sysargs32, (void *)arg,
! 			   sizeof(struct afsprocdata32)))
! 	    return -EFAULT;
! 
! 	return afs_syscall((unsigned long)sysargs32.syscall,
! 			   (unsigned long)sysargs32.param1,
! 			   (unsigned long)sysargs32.param2,
! 			   (unsigned long)sysargs32.param3,
! 			   (unsigned long)sysargs32.param4);
!     } else
! #endif
!     {
! 	if (copy_from_user(&sysargs, (void *)arg, sizeof(struct afsprocdata)))
! 	    return -EFAULT;
  
! 	return afs_syscall(sysargs.syscall, sysargs.param1,
! 			   sysargs.param2, sysargs.param3, sysargs.param4);
!     }
  }
  
  
Index: openafs/src/afs/LINUX/osi_probe.c
diff -c openafs/src/afs/LINUX/osi_probe.c:1.1.2.1 openafs/src/afs/LINUX/osi_probe.c:1.1.2.2
*** openafs/src/afs/LINUX/osi_probe.c:1.1.2.1	Sun Jan 30 23:25:13 2005
--- openafs/src/afs/LINUX/osi_probe.c	Sun Feb 20 20:15:35 2005
***************
*** 68,77 ****
  #include <asm/ia32_unistd.h>
  #endif
  
- #ifdef HAVE_KERNEL_LINUX_SYSCALL_H
- #include <linux/syscall.h>
- #endif
- 
  /* number of syscalls */
  /* NB: on MIPS we care about the 4xxx range */
  #ifndef NR_syscalls
--- 68,73 ----
***************
*** 79,89 ****
  #endif
  
  /* lower bound of valid kernel text pointers */
! //#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
  #define ktxt_lower_bound (((unsigned long)&kernel_thread )  & ~0xfffffL)
! //#else
! //#define ktxt_lower_bound (((unsigned long)&empty_zero_page) & ~0xfffffL)
! //#endif
  
  /* On SPARC64 and S390X, sys_call_table contains 32-bit entries
   * even though pointers are 64 bit quantities.
--- 75,85 ----
  #endif
  
  /* lower bound of valid kernel text pointers */
! #ifdef AFS_IA64_LINUX20_ENV
! #define ktxt_lower_bound (((unsigned long)&kernel_thread )  & 0xfff00000L)
! #else
  #define ktxt_lower_bound (((unsigned long)&kernel_thread )  & ~0xfffffL)
! #endif
  
  /* On SPARC64 and S390X, sys_call_table contains 32-bit entries
   * even though pointers are 64 bit quantities.
***************
*** 96,101 ****
--- 92,105 ----
  #define PROBETYPE long
  #endif
  
+ #if defined(AFS_S390X_LINUX20_ENV) && !defined(AFS_S390X_LINUX26_ENV) 
+ #define _SS(x) ((x) << 1)
+ #define _SX(x) ((x) &~ 1)
+ #else
+ #define _SS(x) (x)
+ #define _SX(x) (x)
+ #endif
+ 
  
  /* Allow the user to specify sys_call_table addresses */
  static unsigned long sys_call_table_addr[4] = { 0,0,0,0 };
***************
*** 143,149 ****
--- 147,162 ----
  /* Weak references are our friends.  They are supported by the in-kernel
   * linker in Linux 2.6 and by all versions of modutils back to 2.2pre1.
   * A weak reference not satisified by the kernel will have value zero.
+  *
+  * Unfortunately, weak references to functions don't work right on
+  * IA64; specifically, if you actually try to make a call through
+  * such a reference, and the symbol doesn't exist in the kernel, then
+  * the module relocation code will oops.  A workaround for this is
+  * probably possible, but the use of kallsyms_* is of limited value,
+  * so I'm not bothing with the effort for now.
+  * -- jhutz, 10-Feb-2005
   */
+ #ifdef OSI_PROBE_KALLSYMS
  extern int kallsyms_symbol_to_address(char *name, unsigned long *token,
  				      char **mod_name,
  				      unsigned long *mod_start,
***************
*** 167,186 ****
  				      unsigned long *sym_start,
  				      unsigned long *sym_end
  				     ) __attribute__((weak));
  
  extern SYSCALLTYPE sys_call_table[] __attribute__((weak));
  extern SYSCALLTYPE ia32_sys_call_table[] __attribute__((weak));
  extern SYSCALLTYPE sys_call_table32[] __attribute__((weak));
  
  extern asmlinkage long sys_close(unsigned int) __attribute__((weak));
  extern asmlinkage long sys_chdir(const char *) __attribute__((weak));
! extern asmlinkage int  sys_write(unsigned int, const char *, size_t) __attribute__((weak));
  #ifdef AFS_LINUX26_ENV
  extern asmlinkage long sys_wait4(pid_t, int *, int, struct rusage *) __attribute__((weak));
  #else
  extern asmlinkage long sys_wait4(pid_t, unsigned int *, int, struct rusage *) __attribute__((weak));
  #endif
! extern asmlinkage int  sys_exit (int) __attribute__((weak));
  extern asmlinkage long sys_open (const char *, int, int) __attribute__((weak));
  extern asmlinkage long sys_ioctl(unsigned int, unsigned int, unsigned long) __attribute__((weak));
  
--- 180,201 ----
  				      unsigned long *sym_start,
  				      unsigned long *sym_end
  				     ) __attribute__((weak));
+ #endif
  
  extern SYSCALLTYPE sys_call_table[] __attribute__((weak));
  extern SYSCALLTYPE ia32_sys_call_table[] __attribute__((weak));
  extern SYSCALLTYPE sys_call_table32[] __attribute__((weak));
+ extern SYSCALLTYPE sys_call_table_emu[] __attribute__((weak));
  
  extern asmlinkage long sys_close(unsigned int) __attribute__((weak));
  extern asmlinkage long sys_chdir(const char *) __attribute__((weak));
! extern asmlinkage ssize_t sys_write(unsigned int, const char *, size_t) __attribute__((weak));
  #ifdef AFS_LINUX26_ENV
  extern asmlinkage long sys_wait4(pid_t, int *, int, struct rusage *) __attribute__((weak));
  #else
  extern asmlinkage long sys_wait4(pid_t, unsigned int *, int, struct rusage *) __attribute__((weak));
  #endif
! extern asmlinkage long sys_exit (int) __attribute__((weak));
  extern asmlinkage long sys_open (const char *, int, int) __attribute__((weak));
  extern asmlinkage long sys_ioctl(unsigned int, unsigned int, unsigned long) __attribute__((weak));
  
***************
*** 306,312 ****
   * corresponding __NR macros are not defined, so the tests above fail.
   * Instead, we just have to know the numbers for these.
   */
! #ifdef AFS_S390_LINUX20_ENV
      /* break, stty, gtty, ftime, prof, lock, mpx */
      17, 31, 32, 35, 44, 53, 56,
  #endif
--- 321,327 ----
   * corresponding __NR macros are not defined, so the tests above fail.
   * Instead, we just have to know the numbers for these.
   */
! #if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
      /* break, stty, gtty, ftime, prof, lock, mpx */
      17, 31, 32, 35, 44, 53, 56,
  #endif
***************
*** 400,405 ****
--- 415,427 ----
  
  /* unique syscalls for try_harder */
  static int main_unique_syscalls[] = {
+ #if defined(AFS_SPARC64_LINUX24_ENV) || defined(AFS_SPARC_LINUX24_ENV)
+     /* 
+      * On SPARC, we need some additional unique calls to make sure
+      * we don't match the SunOS-compatibility table.
+      */
+     __NR_sgetmask, __NR_ssetmask,
+ #endif
      __NR_exit, __NR_mount, __NR_read, __NR_write,
      __NR_open, __NR_close, __NR_unlink
  };
***************
*** 428,434 ****
      main_try,                     /* array of combinations to try */
  
      /* symbol in section to try scanning */
! #if defined(AFS_SPARC64_LINUX20_ENV)
      (unsigned long)&sys_close,
  #elif defined(AFS_AMD64_LINUX20_ENV)
      /* On this platform, it's in a different section! */
--- 450,456 ----
      main_try,                     /* array of combinations to try */
  
      /* symbol in section to try scanning */
! #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
      (unsigned long)&sys_close,
  #elif defined(AFS_AMD64_LINUX20_ENV)
      /* On this platform, it's in a different section! */
***************
*** 444,456 ****
      (unsigned long)(&sys_close),
      0xfffff,
      0x10000,
  #elif   defined(AFS_IA64_LINUX20_ENV)
!     (unsigned long)(&sys_close - 0x180000),
!     0,
!     (0x180000 / sizeof(unsigned long *)),
  #elif defined(AFS_AMD64_LINUX20_ENV)
!     (unsigned long)(&tasklist_lock - 0x1000),
      0,
      16384,
  #else
      (unsigned long)&init_mm,
--- 466,487 ----
      (unsigned long)(&sys_close),
      0xfffff,
      0x10000,
+ #elif   defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+     /* bleah; this is so suboptimal */
+     (unsigned long)(&sys_close),
+     0xfffff,
+     0x20000,
  #elif   defined(AFS_IA64_LINUX20_ENV)
!     (unsigned long)(&init_mm),
!     0x1fffff,
!     0x30000,
  #elif defined(AFS_AMD64_LINUX20_ENV)
!     (unsigned long)(&tasklist_lock) - 0x30000,
      0,
+     0x6000,
+ #elif defined(AFS_PPC_LINUX20_ENV) || defined(AFS_PPC_LINUX20_ENV)
+     (unsigned long)&init_mm,
+     0xffff,
      16384,
  #else
      (unsigned long)&init_mm,
***************
*** 570,575 ****
--- 601,619 ----
  };
  
  
+ /********** Probing Configuration: IA64 **********/
+ #elif defined(AFS_IA64_LINUX20_ENV)
+ struct fptr {
+     void *ip;
+     unsigned long gp;
+ };
+ 
+ /* no 32-bit support on IA64 for now */
+ static probectl *probe_list[] = {
+     &main_probe
+ };
+ 
+ 
  /********** Probing Configuration: ppc64, sparc64 sys_call_table32 **********/
  #elif defined(AFS_PPC64_LINUX20_ENV) || defined(AFS_SPARC64_LINUX20_ENV)
  
***************
*** 602,607 ****
--- 646,658 ----
  #ifdef AFS_PPC64_LINUX20_ENV
      __NR_mmap2, __NR_fstat64,
  #endif
+ #ifdef AFS_SPARC64_LINUX24_ENV
+     /* 
+      * On SPARC, we need some additional unique calls to make sure
+      * we don't match the SunOS-compatibility table.
+      */
+     __NR_sgetmask, __NR_ssetmask,
+ #endif
      __NR_exit, __NR_mount, __NR_read, __NR_write,
      __NR_open, __NR_close, __NR_unlink
  };
***************
*** 675,681 ****
  
  
  /********** Probing Configuration: s390x sys_call_table_emu **********/
! #elif defined(AFS_S390X_LINUX20_ENV)
  
  /* syscall pairs/triplets to probe */
  /* nothing worthwhile is exported, so this is empty */
--- 726,736 ----
  
  
  /********** Probing Configuration: s390x sys_call_table_emu **********/
! /* We only actually need to do this on s390x_linux26 and later.
!  * On earlier versions, the two tables were interleaved and so
!  * have related base addresses.
!  */
! #elif defined(AFS_S390X_LINUX26_ENV)
  
  /* syscall pairs/triplets to probe */
  /* nothing worthwhile is exported, so this is empty */
***************
*** 718,731 ****
      emu_try,                      /* array of combinations to try */
  
      /* symbol in section to try scanning */
!     (unsigned long)&init_mm,
  
      /* default base address for scan */
      /* base address bits to force to zero */
      /* default length for scan */
!     (unsigned long)&init_mm,
!     0,
!     16384,
  
      /* number and list of unimplemented system calls */
      ((sizeof(emu_zapped_syscalls)/sizeof(emu_zapped_syscalls[0])) - 1),
--- 773,786 ----
      emu_try,                      /* array of combinations to try */
  
      /* symbol in section to try scanning */
!     (unsigned long)&sys_close,
  
      /* default base address for scan */
      /* base address bits to force to zero */
      /* default length for scan */
!     (unsigned long)&sys_close,
!     0xfffff,
!     0x20000,
  
      /* number and list of unimplemented system calls */
      ((sizeof(emu_zapped_syscalls)/sizeof(emu_zapped_syscalls[0])) - 1),
***************
*** 773,789 ****
      PROBETYPE *x;
      int i, j;
  
!     for (x = ptr, i = 0; i < NR_syscalls; i++, x++) {
  #ifdef OSI_PROBE_DEBUG
  	if (probe_debug & 0x0040) {
  	    for (j = 0; j < 4; j++) {
! 		if (P->debug_ignore_NR[j] == i) break;
  	    }
  	    if (j < 4) continue;
  	}
  #endif
  	for (j = 0; j < 8; j++) {
! 	    if (probe_ignore_syscalls[j] == i) break;
  	}
  	if (j < 8) continue;
  	if (*x <= ktxt_lower_bound) {
--- 828,844 ----
      PROBETYPE *x;
      int i, j;
  
!     for (x = ptr, i = 0; i < _SS(NR_syscalls); i++, x++) {
  #ifdef OSI_PROBE_DEBUG
  	if (probe_debug & 0x0040) {
  	    for (j = 0; j < 4; j++) {
! 		if (_SS(P->debug_ignore_NR[j]) == _SX(i + P->offset)) break;
  	    }
  	    if (j < 4) continue;
  	}
  #endif
  	for (j = 0; j < 8; j++) {
! 	    if (_SS(probe_ignore_syscalls[j]) == _SX(i) + P->offset) break;
  	}
  	if (j < 8) continue;
  	if (*x <= ktxt_lower_bound) {
***************
*** 805,814 ****
--- 860,871 ----
  static void *try(probectl *P, tryctl *T, PROBETYPE *ptr,
  		 unsigned long datalen)
  {
+ #ifdef OSI_PROBE_KALLSYMS
      char *mod_name, *sec_name, *sym_name;
      unsigned long mod_start, mod_end;
      unsigned long sec_start, sec_end;
      unsigned long sym_start, sym_end;
+ #endif
      unsigned long offset, ip1, ip2, ip3;
      int ret;
  
***************
*** 844,857 ****
  	if ((probe_debug & 0x0002) && DEBUG_IN_RANGE(P,ptr))
  	    printk("<7>try 0x%lx\n", (unsigned long)ptr);
  #endif
! 	if (ptr[T->NR1 - P->offset] != ip1)                    continue;
! 	if (ptr[T->NR2 - P->offset] != ip2)        continue;
! 	if (ip3 && ptr[T->NR3 - P->offset] != ip3) continue;
  
  #ifdef OSI_PROBE_DEBUG
  	if (probe_debug & 0x0002)
  	    printk("<7>try found 0x%lx\n", (unsigned long)ptr);
  #endif
  	if (kallsyms_address_to_symbol) {
  	    ret = kallsyms_address_to_symbol((unsigned long)ptr,
  					     &mod_name, &mod_start, &mod_end,
--- 901,915 ----
  	if ((probe_debug & 0x0002) && DEBUG_IN_RANGE(P,ptr))
  	    printk("<7>try 0x%lx\n", (unsigned long)ptr);
  #endif
! 	if (ptr[_SS(T->NR1 - P->offset)] != ip1)        continue;
! 	if (ptr[_SS(T->NR2 - P->offset)] != ip2)        continue;
! 	if (ip3 && ptr[_SS(T->NR3 - P->offset)] != ip3) continue;
  
  #ifdef OSI_PROBE_DEBUG
  	if (probe_debug & 0x0002)
  	    printk("<7>try found 0x%lx\n", (unsigned long)ptr);
  #endif
+ #ifdef OSI_PROBE_KALLSYMS
  	if (kallsyms_address_to_symbol) {
  	    ret = kallsyms_address_to_symbol((unsigned long)ptr,
  					     &mod_name, &mod_start, &mod_end,
***************
*** 859,864 ****
--- 917,923 ----
  					     &sym_name, &sym_start, &sym_end);
  	    if (!ret || strcmp(sym_name, P->symbol)) continue;
  	}
+ #endif
  	/* XXX should we make sure there is only one match? */
  	return (void *)ptr;
      }
***************
*** 873,879 ****
  
      /* Check zapped syscalls */
      for (i = 1; i < P->n_zapped_syscalls; i++) {
! 	if (p[P->zapped_syscalls[i]] != p[P->zapped_syscalls[0]]) {
  #ifdef OSI_PROBE_DEBUG
  	    if ((probe_debug & 0x0020) && DEBUG_IN_RANGE(P,p))
  		printk("<7>check_harder 0x%lx zapped failed i=%d\n", (unsigned long)p, i);
--- 932,938 ----
  
      /* Check zapped syscalls */
      for (i = 1; i < P->n_zapped_syscalls; i++) {
! 	if (p[_SS(P->zapped_syscalls[i])] != p[_SS(P->zapped_syscalls[0])]) {
  #ifdef OSI_PROBE_DEBUG
  	    if ((probe_debug & 0x0020) && DEBUG_IN_RANGE(P,p))
  		printk("<7>check_harder 0x%lx zapped failed i=%d\n", (unsigned long)p, i);
***************
*** 885,891 ****
      /* Check unique syscalls */
      for (i = 0; i < P->n_unique_syscalls; i++) {
  	for (s = 0; s < NR_syscalls; s++) {
! 	    if (p[s] == p[P->unique_syscalls[i]] && s != P->unique_syscalls[i]) {
  #ifdef OSI_PROBE_DEBUG
  		if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
  		    printk("<7>check_harder 0x%lx unique failed i=%d s=%d\n", (unsigned long)p, i, s);
--- 944,951 ----
      /* Check unique syscalls */
      for (i = 0; i < P->n_unique_syscalls; i++) {
  	for (s = 0; s < NR_syscalls; s++) {
! 	    if (p[_SS(s)] == p[_SS(P->unique_syscalls[i])]
! 		&& s != P->unique_syscalls[i]) {
  #ifdef OSI_PROBE_DEBUG
  		if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
  		    printk("<7>check_harder 0x%lx unique failed i=%d s=%d\n", (unsigned long)p, i, s);
***************
*** 901,907 ****
      ip1 = (unsigned long)(P->verify_fn);
  #endif
  
!     if (ip1 && p[P->verifyNR - P->offset] != ip1) {
  #ifdef OSI_PROBE_DEBUG
  	if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
  	    printk("<7>check_harder 0x%lx verify failed\n", (unsigned long)p);
--- 961,967 ----
      ip1 = (unsigned long)(P->verify_fn);
  #endif
  
!     if (ip1 && p[_SS(P->verifyNR - P->offset)] != ip1) {
  #ifdef OSI_PROBE_DEBUG
  	if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
  	    printk("<7>check_harder 0x%lx verify failed\n", (unsigned long)p);
***************
*** 918,927 ****
--- 978,989 ----
  
  static void *try_harder(probectl *P, PROBETYPE *ptr, unsigned long datalen)
  {
+ #ifdef OSI_PROBE_KALLSYMS
      char *mod_name, *sec_name, *sym_name;
      unsigned long mod_start, mod_end;
      unsigned long sec_start, sec_end;
      unsigned long sym_start, sym_end;
+ #endif
      unsigned long offset;
      void *match = 0;
      int ret;
***************
*** 951,956 ****
--- 1013,1019 ----
  	    printk("<7>try_harder found 0x%lx\n", (unsigned long)ptr);
  #endif
  
+ #ifdef OSI_PROBE_KALLSYMS
  	if (kallsyms_address_to_symbol) {
  	    ret = kallsyms_address_to_symbol((unsigned long)ptr,
  					     &mod_name, &mod_start, &mod_end,
***************
*** 958,963 ****
--- 1021,1027 ----
  					     &sym_name, &sym_start, &sym_end);
  	    if (!ret || strcmp(sym_name, P->symbol)) continue;
  	}
+ #endif
  
  	if (match) {
  #ifdef OSI_PROBE_DEBUG
***************
*** 995,1012 ****
  #endif
  static void *do_find_syscall_table(probectl *P, char **method)
  {
      char *mod_name, *sec_name, *sym_name;
      unsigned long mod_start, mod_end;
      unsigned long sec_start, sec_end;
      unsigned long sym_start, sym_end;
      PROBETYPE *B;
!     unsigned long token, L;
      tryctl *T;
      void *answer;
  #ifdef OSI_PROBE_DEBUG
      void *final_answer = 0;
  #endif
-     int ret;
  
      *method = "not found";
  
--- 1059,1082 ----
  #endif
  static void *do_find_syscall_table(probectl *P, char **method)
  {
+ #ifdef OSI_PROBE_KALLSYMS
      char *mod_name, *sec_name, *sym_name;
      unsigned long mod_start, mod_end;
      unsigned long sec_start, sec_end;
      unsigned long sym_start, sym_end;
+     unsigned long token;
+     int ret;
+ #endif
      PROBETYPE *B;
!     unsigned long L;
      tryctl *T;
      void *answer;
+ #if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+     void *answer2;
+ #endif
  #ifdef OSI_PROBE_DEBUG
      void *final_answer = 0;
  #endif
  
      *method = "not found";
  
***************
*** 1014,1019 ****
--- 1084,1090 ----
      check_result(P->weak_answer, "exported");
  
      /* ask the kernel to do the name lookup, if it's willing */
+ #ifdef OSI_PROBE_KALLSYMS
      if (kallsyms_symbol_to_address) {
  	token = 0;
          sym_start = 0;
***************
*** 1028,1033 ****
--- 1099,1105 ----
  	} while (ret);
          check_result(sym_start, "kallsyms_symbol_to_address");
      }
+ #endif
  
      /* Maybe a little birdie told us */
      check_result(P->parm_answer,  "module parameter");
***************
*** 1037,1042 ****
--- 1109,1115 ----
      B = (PROBETYPE *)((P->try_base) & ~(P->try_base_mask));
      L = P->try_length;
      /* Now, see if the kernel will tell us something better than the default */
+ #ifdef OSI_PROBE_KALLSYMS
      if (kallsyms_address_to_symbol) {
  	ret = kallsyms_address_to_symbol(P->try_sect_sym,
  					 &mod_name, &mod_start, &mod_end,
***************
*** 1047,1052 ****
--- 1120,1126 ----
  	    L = (sec_end - sec_start) / sizeof(unsigned long);
  	}
      }
+ #endif
  
  #ifdef OSI_PROBE_DEBUG
      if (probe_debug & 0x0007)
***************
*** 1062,1073 ****
--- 1136,1173 ----
  
      for (T = P->trylist; T->name; T++) {
  	answer = try(P, T, B, L);
+ #if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+ 	answer2 = try(P, T, (PROBETYPE *)(2 + (void *)B), L);
+ #ifdef OSI_PROBE_DEBUG
+ 	if (probe_debug & 0x0003) {
+ 	    printk("<7>osi_probe: %s = 0x%016lx %s (even)\n",
+ 		   P->symbol, (unsigned long)(answer), T->name);
+ 	    printk("<7>osi_probe: %s = 0x%016lx %s (odd)\n",
+ 		   P->symbol, (unsigned long)(answer2), T->name);
+ 	}
+ #endif
+ 	if (answer && answer2) answer = 0;
+ 	else if (answer2) answer = answer2;
+ #endif
          check_result(answer, T->name);
      }
  
      /* XXX more checks here */
  
      answer = try_harder(P, B, L);
+ #if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+     answer2 = try_harder(P, (PROBETYPE *)(2 + (void *)B), L);
+ #ifdef OSI_PROBE_DEBUG
+     if (probe_debug & 0x0005) {
+ 	printk("<7>osi_probe: %s = 0x%016lx pattern scan (even)\n",
+ 	       P->symbol, (unsigned long)(answer));
+ 	printk("<7>osi_probe: %s = 0x%016lx pattern scan (odd)\n",
+ 	       P->symbol, (unsigned long)(answer2));
+     }
+ #endif
+     if (answer && answer2) answer = 0;
+     else if (answer2) answer = answer2;
+ #endif
      check_result(answer, "pattern scan");
  
  #ifdef OSI_PROBE_DEBUG
Index: openafs/src/afs/LINUX/osi_syscall.c
diff -c openafs/src/afs/LINUX/osi_syscall.c:1.1.2.1 openafs/src/afs/LINUX/osi_syscall.c:1.1.2.2
*** openafs/src/afs/LINUX/osi_syscall.c:1.1.2.1	Sun Jan 30 23:25:13 2005
--- openafs/src/afs/LINUX/osi_syscall.c	Sun Feb 20 20:15:35 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.1.2.1 2005/01/31 04:25:13 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.1.2.2 2005/02/21 01:15:35 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
***************
*** 49,55 ****
  #define SYSCALL2POINTER (void *)
  #endif
  
! #if defined(AFS_S390X_LINUX24_ENV)
  #define _S(x) ((x)<<1)
  #elif defined(AFS_IA64_LINUX20_ENV)
  #define _S(x) ((x)-1024)
--- 49,55 ----
  #define SYSCALL2POINTER (void *)
  #endif
  
! #if defined(AFS_S390X_LINUX24_ENV) && !defined(AFS_LINUX26_ENV)
  #define _S(x) ((x)<<1)
  #elif defined(AFS_IA64_LINUX20_ENV)
  #define _S(x) ((x)-1024)
***************
*** 123,131 ****
  afs_syscall32(long syscall, long parm1, long parm2, long parm3, long parm4,
  	      long parm5)
  {
!     __asm__ __volatile__("srl %o4, 0, %o4\n\t" "mov %o7, %i7\n\t"
! 			 "call afs_syscall\n\t" "srl %o5, 0, %o5\n\t"
! 			 "ret\n\t" "nop");
  }
  #endif /* AFS_SPARC64_LINUX20_ENV */
  
--- 123,134 ----
  afs_syscall32(long syscall, long parm1, long parm2, long parm3, long parm4,
  	      long parm5)
  {
!     __asm__ __volatile__("srl %o4, 0, %o4\n\t"
!                          "mov %o7, %i7\n\t"
! 			 "call afs_syscall\n\t"
!                          "srl %o5, 0, %o5\n\t"
! 			 "ret\n\t"
!                          "nop");
  }
  #endif /* AFS_SPARC64_LINUX20_ENV */
  
***************
*** 136,156 ****
  asmlinkage long
  afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
!     __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" "mov r41 = b0\n\t"	/* save rp */
! 			 "mov out0 = in0\n\t" "mov out1 = in1\n\t" "mov out2 = in2\n\t" "mov out3 = in3\n\t" "mov out4 = in4\n\t" "mov out5 = gp\n\t"	/* save gp */
! 			 ";;\n" ".L1:\n\t" "mov r3 = ip\n\t" ";;\n\t" "addl r15=.fptr_afs_syscall-.L1,r3\n\t" ";;\n\t" "ld8 r15=[r15]\n\t" ";;\n\t" "ld8 r16=[r15],8\n\t" ";;\n\t" "ld8 gp=[r15]\n\t" "mov b6=r16\n\t" "br.call.sptk.many b0 = b6\n\t" ";;\n\t" "mov ar.pfs = r42\n\t" "mov b0 = r41\n\t" "mov gp = r48\n\t"	/* restore gp */
! 			 "br.ret.sptk.many b0\n" ".fptr_afs_syscall:\n\t"
! 			 "data8 @fptr(afs_syscall)\n\t" ".skip 8");
  }
  
  asmlinkage long
  afs_xsetgroups_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
!     __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" "mov r41 = b0\n\t"	/* save rp */
! 			 "mov out0 = in0\n\t" "mov out1 = in1\n\t" "mov out2 = in2\n\t" "mov out3 = in3\n\t" "mov out4 = in4\n\t" "mov out5 = gp\n\t"	/* save gp */
! 			 ";;\n" ".L2:\n\t" "mov r3 = ip\n\t" ";;\n\t" "addl r15=.fptr_afs_xsetgroups - .L2,r3\n\t" ";;\n\t" "ld8 r15=[r15]\n\t" ";;\n\t" "ld8 r16=[r15],8\n\t" ";;\n\t" "ld8 gp=[r15]\n\t" "mov b6=r16\n\t" "br.call.sptk.many b0 = b6\n\t" ";;\n\t" "mov ar.pfs = r42\n\t" "mov b0 = r41\n\t" "mov gp = r48\n\t"	/* restore gp */
! 			 "br.ret.sptk.many b0\n" ".fptr_afs_xsetgroups:\n\t"
! 			 "data8 @fptr(afs_xsetgroups)\n\t" ".skip 8");
  }
  
  struct fptr {
--- 139,207 ----
  asmlinkage long
  afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
!     __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t"
!                          "mov r41 = b0\n\t"	/* save rp */
!                          "mov out0 = in0\n\t"
!                          "mov out1 = in1\n\t"
!                          "mov out2 = in2\n\t"
!                          "mov out3 = in3\n\t"
!                          "mov out4 = in4\n\t"
!                          "mov out5 = gp\n\t"	/* save gp */
!                          ";;\n"
!                          ".L1:\n\t"
!                          "mov r3 = ip\n\t"
!                          ";;\n\t"
!                          "addl r15=.fptr_afs_syscall-.L1,r3\n\t"
!                          ";;\n\t"
!                          "ld8 r15=[r15]\n\t"
!                          ";;\n\t"
!                          "ld8 r16=[r15],8\n\t"
!                          ";;\n\t"
!                          "ld8 gp=[r15]\n\t"
!                          "mov b6=r16\n\t"
!                          "br.call.sptk.many b0 = b6\n\t"
!                          ";;\n\t"
!                          "mov ar.pfs = r42\n\t"
!                          "mov b0 = r41\n\t"
!                          "mov gp = r48\n\t"	/* restore gp */
!                          "br.ret.sptk.many b0\n"
!                          ".fptr_afs_syscall:\n\t"
!                          "data8 @fptr(afs_syscall)\n\t"
!                          ".skip 8");
  }
  
  asmlinkage long
  afs_xsetgroups_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
!     __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t"
!                          "mov r41 = b0\n\t"	/* save rp */
! 			 "mov out0 = in0\n\t"
!                          "mov out1 = in1\n\t"
!                          "mov out2 = in2\n\t"
!                          "mov out3 = in3\n\t"
!                          "mov out4 = in4\n\t"
!                          "mov out5 = gp\n\t"	/* save gp */
! 			 ";;\n"
!                          ".L2:\n\t"
!                          "mov r3 = ip\n\t"
!                          ";;\n\t"
!                          "addl r15=.fptr_afs_xsetgroups - .L2,r3\n\t"
!                          ";;\n\t"
!                          "ld8 r15=[r15]\n\t"
!                          ";;\n\t"
!                          "ld8 r16=[r15],8\n\t"
!                          ";;\n\t"
!                          "ld8 gp=[r15]\n\t"
!                          "mov b6=r16\n\t"
!                          "br.call.sptk.many b0 = b6\n\t"
!                          ";;\n\t"
!                          "mov ar.pfs = r42\n\t"
!                          "mov b0 = r41\n\t"
!                          "mov gp = r48\n\t"	/* restore gp */
! 			 "br.ret.sptk.many b0\n"
!                          ".fptr_afs_xsetgroups:\n\t"
! 			 "data8 @fptr(afs_xsetgroups)\n\t"
!                          ".skip 8");
  }
  
  struct fptr {
***************
*** 204,210 ****
  	    SYSCALL2POINTER afs_sys_call_table[_S(__NR_setgroups)];
  	((struct fptr *)sys_setgroupsp)->gp = kernel_gp;
  
! 	afs_sys_call_table[__S(_NR_setgroups)] =
  	    POINTER2SYSCALL((struct fptr *)afs_xsetgroups_stub)->ip;
      }
  
--- 255,261 ----
  	    SYSCALL2POINTER afs_sys_call_table[_S(__NR_setgroups)];
  	((struct fptr *)sys_setgroupsp)->gp = kernel_gp;
  
! 	afs_sys_call_table[_S(_NR_setgroups)] =
  	    POINTER2SYSCALL((struct fptr *)afs_xsetgroups_stub)->ip;
      }
  
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.1 openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.2
*** openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.1	Tue Dec  7 01:12:13 2004
--- openafs/src/afs/LINUX/osi_vfsops.c	Sun Feb 20 20:13:08 2005
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.1 2004/12/07 06:12:13 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.2 2005/02/21 01:13:08 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 34,40 ****
  struct vcache *afs_globalVp = 0;
  struct vfs *afs_globalVFS = 0;
  #if defined(AFS_LINUX24_ENV)
! struct nameidata afs_cacheNd;
  #endif
  int afs_was_mounted = 0;	/* Used to force reload if mount/unmount/mount */
  
--- 34,40 ----
  struct vcache *afs_globalVp = 0;
  struct vfs *afs_globalVFS = 0;
  #if defined(AFS_LINUX24_ENV)
! struct vfsmount *afs_cacheMnt;
  #endif
  int afs_was_mounted = 0;	/* Used to force reload if mount/unmount/mount */
  
***************
*** 336,342 ****
      afs_globalVp = 0;
      afs_shutdown();
  #if defined(AFS_LINUX24_ENV)
!     path_release(&afs_cacheNd);
  #endif
  
      osi_linux_verify_alloced_memory();
--- 336,342 ----
      afs_globalVp = 0;
      afs_shutdown();
  #if defined(AFS_LINUX24_ENV)
!     mntput(afs_cacheMnt);
  #endif
  
      osi_linux_verify_alloced_memory();
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.11 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.12
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.11	Sun Jan 30 23:23:11 2005
--- openafs/src/afs/LINUX/osi_vnodeops.c	Sun Feb 20 20:13:24 2005
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.11 2005/01/31 04:23:11 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.12 2005/02/21 01:13:24 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 590,618 ****
      return -code;
  }
  
- /* afs_Close is called from release, since release is used to handle all
-  * file closings. In addition afs_linux_flush is called from sys_close to
-  * handle flushing the data back to the server. The kicker is that we could
-  * ignore flush completely if only sys_close took it's return value from
-  * fput. See afs_linux_flush for notes on interactions between release and
-  * flush.
-  */
  static int
  afs_linux_release(struct inode *ip, struct file *fp)
  {
-     int code = 0;
-     cred_t *credp = crref();
      struct vcache *vcp = ITOAFS(ip);
  
  #ifdef AFS_LINUX24_ENV
      lock_kernel();
  #endif
      AFS_GLOCK();
!     if (vcp->flushcnt) {
! 	vcp->flushcnt--;	/* protected by AFS global lock. */
!     } else {
! 	code = afs_close(vcp, fp->f_flags, credp);
!     }
      AFS_GUNLOCK();
  #ifdef AFS_LINUX24_ENV
      unlock_kernel();
--- 590,607 ----
      return -code;
  }
  
  static int
  afs_linux_release(struct inode *ip, struct file *fp)
  {
      struct vcache *vcp = ITOAFS(ip);
+     cred_t *credp = crref();
+     int code = 0;
  
  #ifdef AFS_LINUX24_ENV
      lock_kernel();
  #endif
      AFS_GLOCK();
!     code = afs_close(vcp, fp->f_flags, credp);
      AFS_GUNLOCK();
  #ifdef AFS_LINUX24_ENV
      unlock_kernel();
***************
*** 690,726 ****
  }
  
  /* afs_linux_flush
!  * flush is called from sys_close. We could ignore it, but sys_close return
!  * code comes from flush, not release. We need to use release to keep
!  * the vcache open count correct. Note that flush is called before release
!  * (via fput) in sys_close. vcp->flushcnt is a bit of ugliness to avoid
!  * races and also avoid calling afs_close twice when closing the file.
!  * If we merely checked for opens > 0 in afs_linux_release, then if an
!  * new open occurred when storing back the file, afs_linux_release would
!  * incorrectly close the file and decrement the opens count. Calling afs_close
!  * on the just flushed file is wasteful, since the background daemon will
!  * execute the code that finally decides there is nothing to do.
   */
  int
  afs_linux_flush(struct file *fp)
  {
      struct vcache *vcp = ITOAFS(FILE_INODE(fp));
!     int code = 0;
!     cred_t *credp;
  
!     /* Only do this on the last close of the file pointer. */
! #if defined(AFS_LINUX24_ENV)
!     if (atomic_read(&fp->f_count) > 1)
! #else
!     if (fp->f_count > 1)
! #endif
! 	return 0;
  
!     credp = crref();
  
!     AFS_GLOCK();
!     code = afs_close(vcp, fp->f_flags, credp);
!     vcp->flushcnt++;		/* protected by AFS global lock. */
      AFS_GUNLOCK();
  
      crfree(credp);
--- 679,712 ----
  }
  
  /* afs_linux_flush
!  * essentially the same as afs_fsync() but we need to get the return
!  * code for the sys_close() here, not afs_linux_release(), so call
!  * afs_StoreAllSegments() with AFS_LASTSTORE
   */
  int
  afs_linux_flush(struct file *fp)
  {
+     struct vrequest treq;
      struct vcache *vcp = ITOAFS(FILE_INODE(fp));
!     cred_t *credp = crref();
!     int code;
  
!     AFS_GLOCK();
  
!     code = afs_InitReq(&treq, credp);
!     if (code)
! 	goto out;
  
!     ObtainSharedLock(&vcp->lock, 535);
!     if (vcp->execsOrWriters > 0) {
! 	UpgradeSToWLock(&vcp->lock, 536);
! 	code = afs_StoreAllSegments(vcp, &treq, AFS_SYNC | AFS_LASTSTORE);
! 	ConvertWToSLock(&vcp->lock);
!     }
!     code = afs_CheckCode(code, &treq, 54);
!     ReleaseSharedLock(&vcp->lock);
! 
! out:
      AFS_GUNLOCK();
  
      crfree(credp);
Index: openafs/src/afsd/afs.rc.solaris.2.9
diff -c openafs/src/afsd/afs.rc.solaris.2.9:1.2 openafs/src/afsd/afs.rc.solaris.2.9:1.2.8.1
*** openafs/src/afsd/afs.rc.solaris.2.9:1.2	Thu Nov  1 00:10:38 2001
--- openafs/src/afsd/afs.rc.solaris.2.9	Sun Feb 20 20:15:04 2005
***************
*** 62,67 ****
--- 62,70 ----
  ## If sparcv9 then the location of the afs and nfs extensions differ
  
  case `/bin/isalist` in
+     *amd64* )
+               nfssrv=/kernel/misc/amd64/nfssrv
+               afs=/kernel/fs/amd64/afs ;;
      *sparcv9* )
                nfssrv=/kernel/misc/sparcv9/nfssrv
                afs=/kernel/fs/sparcv9/afs ;;
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.20.2.3 openafs/src/cf/linux-test4.m4:1.20.2.4
*** openafs/src/cf/linux-test4.m4:1.20.2.3	Sun Jan 30 23:25:33 2005
--- openafs/src/cf/linux-test4.m4	Sun Feb 20 20:12:54 2005
***************
*** 284,289 ****
--- 284,305 ----
  CPPFLAGS="$save_CPPFLAGS"])
  
  
+ AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_I_SB_LIST], [
+ AC_MSG_CHECKING(for i_sb_list in struct inode)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_sb_list, 
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/fs.h>],
+ [struct inode _inode;
+ printf("%d\n", _inode.i_sb_list);], 
+ ac_cv_linux_fs_struct_inode_has_i_sb_list=yes,
+ ac_cv_linux_fs_struct_inode_has_i_sb_list=no)])
+ AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_sb_list)
+ CPPFLAGS="$save_CPPFLAGS"])
+ 
+ 
  AC_DEFUN([LINUX_RECALC_SIGPENDING_ARG_TYPE],[
  AC_MSG_CHECKING(for recalc_sigpending arg type)
  save_CPPFLAGS="$CPPFLAGS"
Index: openafs/src/cf/osconf.m4
diff -c openafs/src/cf/osconf.m4:1.51.2.9 openafs/src/cf/osconf.m4:1.51.2.11
*** openafs/src/cf/osconf.m4:1.51.2.9	Sun Jan 30 23:13:49 2005
--- openafs/src/cf/osconf.m4	Sun Feb 20 20:15:35 2005
***************
*** 414,434 ****
  		EXTRA_VLIBOBJS="fstab.o"
  		;;
  
! 	ppc_linux22)
! 		INSTALL="install"
! 		KERN_OPTMZ=-O2
! 		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
! 		MT_LIBS="-lpthread"
! 		PAM_CFLAGS="-O2 -Dlinux -DLINUX_PAM -fPIC"
! 		SHLIB_LDFLAGS="-shared -Xlinker -x"
! 		TXLIBS="-lncurses"
! 		XCFLAGS="-O2 -D_LARGEFILE64_SOURCE"
! 		YACC="bison -y"
! 		SHLIB_LINKER="${MT_CC} -shared"
! 		;;
! 
! 	ppc_linux24)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
--- 414,420 ----
  		EXTRA_VLIBOBJS="fstab.o"
  		;;
  
! 	ppc_linux*)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
***************
*** 503,509 ****
  		SHLIB_LINKER="${MT_CC} -shared"
  		;;
  
! 	s390_linux24)
  		CC="gcc"
  		CCOBJ="gcc"
  		LD="ld"
--- 489,495 ----
  		SHLIB_LINKER="${MT_CC} -shared"
  		;;
  
! 	s390_linux24|s390_linux26)
  		CC="gcc"
  		CCOBJ="gcc"
  		LD="ld"
***************
*** 520,526 ****
  		SHLIB_LINKER="${MT_CC} -shared"
  		;;
  
! 	s390x_linux24)
  		CC="gcc"
  		CCOBJ="gcc"
  		LD="ld"
--- 506,512 ----
  		SHLIB_LINKER="${MT_CC} -shared"
  		;;
  
! 	s390x_linux24|s390x_linux26)
  		CC="gcc"
  		CCOBJ="gcc"
  		LD="ld"
***************
*** 786,792 ****
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=v9'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
--- 772,778 ----
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=amd64'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
***************
*** 807,813 ****
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=v9'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
--- 793,799 ----
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=amd64'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
***************
*** 828,834 ****
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=v9'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
--- 814,820 ----
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=amd64'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
***************
*** 849,855 ****
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=v9'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
--- 835,841 ----
  		SHLIB_CFLAGS="-KPIC"
  		SHLIB_LDFLAGS="-G -Bsymbolic"
  		TXLIBS="-lcurses"
! 		XCFLAGS64='${XCFLAGS} -xarch=amd64'
  		XCFLAGS="-dy -Bdynamic"
  		XLIBELFA="-lelf"
  		XLIBKVM="-lkvm"
Index: openafs/src/config/afs_args.h
diff -c openafs/src/config/afs_args.h:1.13.2.1 openafs/src/config/afs_args.h:1.13.2.2
*** openafs/src/config/afs_args.h:1.13.2.1	Tue Dec  7 00:50:12 2004
--- openafs/src/config/afs_args.h	Sun Feb 20 20:15:36 2005
***************
*** 191,196 ****
--- 191,204 ----
    long param1;
    long syscall;
  };
+ 
+ struct afsprocdata32 {
+   unsigned int param4;
+   unsigned int param3;
+   unsigned int param2;
+   unsigned int param1;
+   unsigned int syscall;
+ };
   
  #endif
  
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.50.2.7 openafs/src/config/afs_sysnames.h:1.50.2.9
*** openafs/src/config/afs_sysnames.h:1.50.2.7	Sun Jan 30 23:13:49 2005
--- openafs/src/config/afs_sysnames.h	Sun Feb 20 20:15:36 2005
***************
*** 154,159 ****
--- 154,160 ----
  #define SYS_NAME_ID_s390x_linux2         1903
  #define SYS_NAME_ID_s390x_linux22        1904
  #define SYS_NAME_ID_s390x_linux24        1905
+ #define SYS_NAME_ID_s390x_linux26        1906
  
  #define SYS_NAME_ID_alpha_linux_2       2000
  #define SYS_NAME_ID_alpha_linux_22      2001
***************
*** 222,227 ****
--- 223,230 ----
  #define SYS_NAME_ID_ppc64_linux24	2902
  #define SYS_NAME_ID_ppc64_linux26	2903
  
+ #define SYS_NAME_ID_amd64_fbsd_53        3008
+ 
  /*
   * Placeholder to keep system-wide standard flags since this file is included by all 
   * files (i.e in afs/param.h)
Index: openafs/src/config/param.amd64_fbsd_53.h
diff -c /dev/null openafs/src/config/param.amd64_fbsd_53.h:1.1.2.1
*** /dev/null	Sun Feb 20 20:55:58 2005
--- openafs/src/config/param.amd64_fbsd_53.h	Sun Feb 20 20:12:09 2005
***************
*** 0 ****
--- 1,202 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VM_RDWR_ENV	1
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ #define SYS_NAME	"amd64_fbsd_53"
+ #define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_53
+ 
+ #define AFS_HAVE_FFS            1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	0	/* System doesn't supports statvfs */
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ #define AFSLITTLE_ENDIAN 1
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BITPOINTER_ENV  1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ /* Machine / Operating system information */
+ #include <afs/afs_sysnames.h>
+ #define SYS_NAME	"i386_fbsd_53"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_53
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <limits.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <netinet/in.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.ia64_linux26.h
diff -c openafs/src/config/param.ia64_linux26.h:1.1.2.1 openafs/src/config/param.ia64_linux26.h:1.1.2.2
*** openafs/src/config/param.ia64_linux26.h:1.1.2.1	Fri Dec 17 10:29:27 2004
--- openafs/src/config/param.ia64_linux26.h	Sun Feb 20 20:12:43 2005
***************
*** 50,62 ****
  
  #include <linux/config.h>
  #ifdef CONFIG_SMP
! #undef CONFIG_SMP
  #endif
  /* Using "AFS_SMP" to map to however many #define's are required to get
   * MP to compile for Linux
   */
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef __SMP__
  #define __SMP__
  #endif
--- 50,66 ----
  
  #include <linux/config.h>
  #ifdef CONFIG_SMP
! #ifndef AFS_SMP
! #define AFS_SMP 1
! #endif
  #endif
  /* Using "AFS_SMP" to map to however many #define's are required to get
   * MP to compile for Linux
   */
  #ifdef AFS_SMP
+ #ifndef CONFIG_SMP
  #define CONFIG_SMP 1
+ #endif
  #ifndef __SMP__
  #define __SMP__
  #endif
Index: openafs/src/config/param.s390x_linux26.h
diff -c /dev/null openafs/src/config/param.s390x_linux26.h:1.1.2.1
*** /dev/null	Sun Feb 20 20:55:58 2005
--- openafs/src/config/param.s390x_linux26.h	Sun Feb 20 20:15:36 2005
***************
*** 0 ****
--- 1,173 ----
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ /*
+  * 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 AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously s390 specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define AFS_LINUX20_ENV 1
+ #define AFS_LINUX22_ENV	1
+ #define AFS_LINUX24_ENV	1
+ #define AFS_LINUX26_ENV	1
+ #define AFS_S390_LINUX20_ENV    1
+ #define AFS_S390_LINUX22_ENV	1
+ #define AFS_S390_LINUX24_ENV	1
+ #define AFS_S390X_LINUX20_ENV    1
+ #define AFS_S390X_LINUX22_ENV	1
+ #define AFS_S390X_LINUX24_ENV	1
+ #define AFS_S390X_LINUX26_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 137
+ #define AFS_64BIT_ENV  1
+ #define AFS_64BITPOINTER_ENV  1
+ #define AFS_64BIT_CLIENT  1
+ #define AFS_64BIT_KERNEL  1
+ #define AFS_LINUX_64BIT_KERNEL  1
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ 
+ #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
+ #include <linux/config.h>
+ #ifdef CONFIG_SMP
+ #ifndef AFS_SMP
+ #define AFS_SMP 1
+ #endif
+ #endif
+ /* Using "AFS_SMP" to map to however many #define's are required to get
+  * MP to compile for Linux
+  */
+ #ifdef AFS_SMP
+ #ifndef CONFIG_SMP
+ #define CONFIG_SMP 1
+ #endif
+ #ifndef __SMP__
+ #define __SMP__
+ #endif
+ #define AFS_GLOBAL_SUNLOCK
+ #endif
+ extern unsigned long __per_cpu_offset[NR_CPUS];
+ extern SYSCALLTYPE sys_call_table_emu[] __attribute__((weak));
+ #endif /* __KERNEL__  && !DUMP_KERNEL */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS       2	/* Set to Userdisabled, allow sysctl to override */
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"s390x_linux26"
+ #define SYS_NAME_ID	SYS_NAME_ID_s390x_linux26
+ #define AFSBIG_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* AFS_PARAM_H */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ /* 
+  * 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 AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously s390 specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_USR_LINUX20_ENV     1
+ #define AFS_USR_LINUX22_ENV	1
+ #define AFS_USR_LINUX24_ENV	1
+ #define AFS_USR_LINUX26_ENV	1
+ #define AFS_S390X_LINUX20_ENV    1
+ #define AFS_S390X_LINUX22_ENV	1
+ #define AFS_S390X_LINUX24_ENV	1
+ #define AFS_S390X_LINUX26_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 137
+ #define AFS_64BIT_ENV  1
+ #define AFS_64BIT_CLIENT  1
+ #define AFS_64BITPOINTER_ENV  1
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS		0	/* if nonzero, garbage collect PAGs */
+ 
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"s390x_linux26"
+ #define SYS_NAME_ID	SYS_NAME_ID_s390x_linux26
+ #define AFSBIG_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
+ 
+ #endif /* !defined(UKERNEL) */
Index: openafs/src/config/param.sun4x_510.h
diff -c openafs/src/config/param.sun4x_510.h:1.2.2.1 openafs/src/config/param.sun4x_510.h:1.2.2.2
*** openafs/src/config/param.sun4x_510.h:1.2.2.1	Tue Dec  7 13:30:42 2004
--- openafs/src/config/param.sun4x_510.h	Sun Feb 20 20:14:57 2005
***************
*** 113,121 ****
  #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
  #define	AFS_KFREE		kmem_free
  #define	VATTR_NULL		vattr_null
- #define memset(A, B, S)		bzero(A, S)
- #define memcpy(B, A, S)		bcopy(A, B, S)
- #define memcmp(A, B, S)		bcmp(A, B, S)
  #endif /* KERNEL */
  #define	AFS_DIRENT
  #ifndef CMSERVERPREF
--- 113,118 ----
Index: openafs/src/config/param.sunx86_510.h
diff -c openafs/src/config/param.sunx86_510.h:1.2.2.1 openafs/src/config/param.sunx86_510.h:1.2.2.3
*** openafs/src/config/param.sunx86_510.h:1.2.2.1	Sun Jan 30 23:14:21 2005
--- openafs/src/config/param.sunx86_510.h	Sun Feb 20 20:15:06 2005
***************
*** 97,103 ****
    * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
    * AFS_64BIT_ENV is for use of 64 bit inode numbers
    */
! #if defined(__sparcv9)
  #define	AFS_SUN57_64BIT_ENV	1
  #define AFS_64BIT_INO   	1
  #endif
--- 97,103 ----
    * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
    * AFS_64BIT_ENV is for use of 64 bit inode numbers
    */
! #if defined(__amd64)
  #define	AFS_SUN57_64BIT_ENV	1
  #define AFS_64BIT_INO   	1
  #endif
***************
*** 117,125 ****
  #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
  #define	AFS_KFREE		kmem_free
  #define	VATTR_NULL		vattr_null
- #define memset(A, B, S)		bzero(A, S)
- #define memcpy(B, A, S)		bcopy(A, B, S)
- #define memcmp(A, B, S)		bcmp(A, B, S)
  #endif /* KERNEL */
  #define	AFS_DIRENT
  #ifndef CMSERVERPREF
--- 117,122 ----
Index: openafs/src/libafs/MakefileProto.LINUX.in
diff -c openafs/src/libafs/MakefileProto.LINUX.in:1.40.2.5 openafs/src/libafs/MakefileProto.LINUX.in:1.40.2.6
*** openafs/src/libafs/MakefileProto.LINUX.in:1.40.2.5	Sun Jan 30 23:25:16 2005
--- openafs/src/libafs/MakefileProto.LINUX.in	Sun Feb 20 20:15:37 2005
***************
*** 66,72 ****
  CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
  DEFINES = $(COMMON_DEFINES) -D__s390__ 
  
! <s390x_linux22 s390x_linux24>
  CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
  DEFINES = $(COMMON_DEFINES) -D__s390x__ 
  
--- 66,72 ----
  CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
  DEFINES = $(COMMON_DEFINES) -D__s390__ 
  
! <s390x_linux22 s390x_linux24 s390x_linux26>
  CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
  DEFINES = $(COMMON_DEFINES) -D__s390x__ 
  
***************
*** 160,168 ****
  	ln -fs ${LINUX_KERNEL_PATH}/arch/um/include/sysdep
  <amd64_linux24 amd64_linux26>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm
! <s390_linux22 s390_linux24 s390_linux26>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm
! <s390x_linux22 s390x_linux24 s390x_linux26>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390x asm
  <ppc_linux22 ppc_linux24 ppc_linux26>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm 
--- 160,168 ----
  	ln -fs ${LINUX_KERNEL_PATH}/arch/um/include/sysdep
  <amd64_linux24 amd64_linux26>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm
! <s390_linux22 s390_linux24 s390_linux26 s390x_linux26>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm
! <s390x_linux22 s390x_linux24>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390x asm
  <ppc_linux22 ppc_linux24 ppc_linux26>
  	ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm 
Index: openafs/src/libafs/MakefileProto.SOLARIS.in
diff -c openafs/src/libafs/MakefileProto.SOLARIS.in:1.24 openafs/src/libafs/MakefileProto.SOLARIS.in:1.24.2.1
*** openafs/src/libafs/MakefileProto.SOLARIS.in:1.24	Thu Jun 24 13:38:30 2004
--- openafs/src/libafs/MakefileProto.SOLARIS.in	Sun Feb 20 20:15:11 2005
***************
*** 30,42 ****
  #LD = /usr/ccs/bin/ld
  #LORDER = /usr/ccs/bin/lorder
  #CC = /opt/SUNWspro/bin/cc
! KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \
! 	-DSYSV -dn ${ARCH_DEFS}
  
! <sun4x_57 sun4x_58 sun4x_59 sun4x_510 sunx86_57 sunx86_58 sunx86_59 sunx86_510>
  KDEFS_32 = 
  KDEFS_64 = -xarch=v9 
  
  <all>
  CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
--- 30,45 ----
  #LD = /usr/ccs/bin/ld
  #LORDER = /usr/ccs/bin/lorder
  #CC = /opt/SUNWspro/bin/cc
! KDEFS= -D_KERNEL -DSYSV -dn ${ARCH_DEFS}
  
! <sun4x_57 sun4x_58 sun4x_59 sun4x_510>
  KDEFS_32 = 
  KDEFS_64 = -xarch=v9 
  
+ <sunx86_57 sunx86_58 sunx86_59 sunx86_510>
+ KDEFS_32 = 
+ KDEFS_64 = -xarch=amd64 -xmodel=kernel
+ 
  <all>
  CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
Index: openafs/src/lwp/Makefile.in
diff -c openafs/src/lwp/Makefile.in:1.29.2.5 openafs/src/lwp/Makefile.in:1.29.2.6
*** openafs/src/lwp/Makefile.in:1.29.2.5	Sun Jan 30 23:34:45 2005
--- openafs/src/lwp/Makefile.in	Sun Feb 20 20:12:10 2005
***************
*** 59,64 ****
--- 59,69 ----
  		${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \
  		${AS} process.ss -o process.o ;  \
  		$(RM) -f process.S ;;\
+ 	amd64_*bsd*) \
+ 		cp ${srcdir}/process.amd64.s process.S ; \
+ 		${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \
+ 		${AS} process.ss -o process.o ;  \
+ 		$(RM) -f process.S ;;\
  	ncrx86_* | sunx86_*) \
  		/usr/ccs/lib/cpp -P -D__sun -D__i386 -DIGNORE_STDS_H -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s process.ss; \
  		${AS} -o process.o process.ss; \
Index: openafs/src/lwp/iomgr.c
diff -c openafs/src/lwp/iomgr.c:1.13 openafs/src/lwp/iomgr.c:1.13.2.1
*** openafs/src/lwp/iomgr.c:1.13	Thu Jul  8 01:16:57 2004
--- openafs/src/lwp/iomgr.c	Sun Feb 20 20:13:50 2005
***************
*** 36,42 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /cvs/openafs/src/lwp/iomgr.c,v 1.13 2004/07/08 05:16:57 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 36,42 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /cvs/openafs/src/lwp/iomgr.c,v 1.13.2.1 2005/02/21 01:13:50 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 536,545 ****
  		iomgr_timeout.tv_sec = 100000000;
  		iomgr_timeout.tv_usec = 0;
  	    }
! #ifdef AFS_NT40_ENV
  	    /* On NT, signals don't interrupt a select call. So this can potentially
  	     * lead to long wait times before a signal is honored. To avoid this we
  	     * dont do select() for longer than IOMGR_MAXWAITTIME (5 secs) */
  	    if (iomgr_timeout.tv_sec > (IOMGR_MAXWAITTIME - 1)) {
  	      iomgr_timeout.tv_sec = IOMGR_MAXWAITTIME;
  	      iomgr_timeout.tv_usec = 0;
--- 536,546 ----
  		iomgr_timeout.tv_sec = 100000000;
  		iomgr_timeout.tv_usec = 0;
  	    }
! #if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV)
  	    /* On NT, signals don't interrupt a select call. So this can potentially
  	     * lead to long wait times before a signal is honored. To avoid this we
  	     * dont do select() for longer than IOMGR_MAXWAITTIME (5 secs) */
+ 	    /* Whereas Linux seems to sometimes "lose" signals */
  	    if (iomgr_timeout.tv_sec > (IOMGR_MAXWAITTIME - 1)) {
  	      iomgr_timeout.tv_sec = IOMGR_MAXWAITTIME;
  	      iomgr_timeout.tv_usec = 0;
***************
*** 640,650 ****
  		/* Real timeout only if signal handler hasn't set
  		   iomgr_timeout to zero. */
  
! #ifdef AFS_NT40_ENV
  		/* On NT, real timeout only if above and if iomgr_timeout
  		 * interval is equal to timeout interval (i.e., not adjusted
  		 * to check for pseudo-signals).
  		 */
  		if (iomgr_timeout.tv_sec  != timeout.tv_sec ||
  		    iomgr_timeout.tv_usec != timeout.tv_usec) {
  		    /* signal check interval timed out; not real timeout */
--- 641,652 ----
  		/* Real timeout only if signal handler hasn't set
  		   iomgr_timeout to zero. */
  
! #if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV)
  		/* On NT, real timeout only if above and if iomgr_timeout
  		 * interval is equal to timeout interval (i.e., not adjusted
  		 * to check for pseudo-signals).
  		 */
+ 		/* And also for Linux as above */
  		if (iomgr_timeout.tv_sec  != timeout.tv_sec ||
  		    iomgr_timeout.tv_usec != timeout.tv_usec) {
  		    /* signal check interval timed out; not real timeout */
Index: openafs/src/lwp/lwp.h
diff -c openafs/src/lwp/lwp.h:1.14.2.1 openafs/src/lwp/lwp.h:1.14.2.2
*** openafs/src/lwp/lwp.h:1.14.2.1	Tue Dec  7 11:48:43 2004
--- openafs/src/lwp/lwp.h	Sun Feb 20 20:13:50 2005
***************
*** 389,396 ****
--- 389,402 ----
  extern PROCESS LWP_ThreadId(void);
  #endif
  
+ #ifdef AFS_LINUX24_ENV
+ /* max time we are allowed to spend in a select call on Linux to avoid 
+  lost signal issues */
+ #define IOMGR_MAXWAITTIME        60	/* seconds */
+ #else
  /* max time we are allowed to spend in a select call on NT */
  #define IOMGR_MAXWAITTIME        5	/* seconds */
+ #endif
  
  /* max time we spend on a select in a Win95 DOS box */
  #define IOMGR_WIN95WAITTIME 5000	/* microseconds */
Index: openafs/src/lwp/process.amd64.s
diff -c /dev/null openafs/src/lwp/process.amd64.s:1.1.2.1
*** /dev/null	Sun Feb 20 20:55:58 2005
--- openafs/src/lwp/process.amd64.s	Sun Feb 20 20:12:10 2005
***************
*** 0 ****
--- 1,161 ----
+ /* $Id: process.amd64.s,v 1.1.2.1 2005/02/21 01:12:10 shadow Exp $ */
+ 
+ /*
+  * Copyright (c) 2003,2005 Kungliga Tekniska Högskolan
+  * (Royal Institute of Technology, Stockholm, Sweden).
+  * All rights reserved.
+  * 
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 
+  * 3. Neither the name of the Institute nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  * 
+  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ #undef RCSID
+ 
+ /* x86_64 Assembly
+  *
+  * By Harald Barth <haba@stacken.kth.se> after looking
+  * at Derek Atkins' i386 routines and realizing that
+  * there were some differences and it was not enough
+  * just renaming the registers.
+  */
+ 	
+ #ifdef HAVE_MACHINE_ASM_H
+ #include <machine/asm.h>
+ #endif
+ 
+ #include <lwp_elf.h>
+ 	
+ 	.file "process.s"
+ 	.data
+ 	.text
+ 
+ /*
+  * struct savearea {
+  *    char    *topstack;
+  * }
+  */
+ 
+ 	.set    topstack,0
+ 
+ /*
+  * savecontext(int (*f)(), struct savearea *area1, char *newsp)
+  */
+ 
+ /* 
+  * In spite of passing arguments in registers, gcc first copies the content of the
+  * registers onto the stack. I do not know why gcc does this, but for now I mimic
+  * gcc's behaviour. Here are the offsets the arguments are copied to.
+  */
+ 	.set    f,-8
+ 	.set    area1,-16
+ 	.set    newsp,-24
+ 
+ .globl		_C_LABEL(PRE_Block)
+ .globl		_C_LABEL(savecontext)
+ 
+ ENTRY(savecontext)
+ 	pushq   %rbp                    /* The frame setup is just like gcc */
+ 	movq    %rsp,%rbp
+ 	subq	$32, %rsp		/* make room for args on the stack */
+ 	movq	%rdi, f(%rbp)		/* (3*8=24 but increments seem to */
+ 	movq	%rsi, area1(%rbp)	/* i multiples of 24, so 32 it is) */
+ 	movq	%rdx, newsp(%rbp)	/* and copy them there. */
+ 
+ 	movl    $1,_C_LABEL(PRE_Block)  /* Do not allow any interrupts */
+ 
+ 	pushq	%rsp			/* Push all registers onto the stack */
+ 	pushq	%rax			/* Probably not _all_ are necessary */
+ 	pushq	%rcx			/* but better one too much than one */
+ 	pushq	%rdx			/* forgotten */
+ 	pushq	%rbx
+ 	pushq	%rbp
+ 	pushq	%rsi
+ 	pushq	%rdi
+ 	pushq	%r8
+ 	pushq	%r9
+ 	pushq	%r10
+ 	pushq	%r11
+ 	pushq	%r12
+ 	pushq	%r13
+ 	pushq	%r14
+ 	pushq	%r15			/* Btw, the pusha instruction is no more */
+ 
+ 	movq    area1(%rbp),%rax        /* rax = base of savearea */
+ 	movq    %rsp,topstack(%rax)	/* area->topstack = rsp */
+ 	movq    newsp(%rbp),%rax        /* rax = new sp */
+ 	cmpq    $0,%rax
+ 	je      L1                      /* if new sp is 0 then dont change rsp */
+ 	movq    %rax,%rsp               /* Change rsp to the new sp */
+ L1:
+ 	jmp     *f(%rbp)                /* jump to function pointer passed in arg */
+ 
+ /* Shouldnt be here....*/
+ 	call    _C_LABEL(abort)
+ 
+ /*
+  * returnto(struct savearea *area2)
+  */
+ 
+ /* Offset where we put arg - se savecontext */
+ 	.set    area2,-8
+ 
+ .globl		_C_LABEL(returnto)
+ 
+ ENTRY(returnto)
+ 	pushq   %rbp			/* New frame, gcc style */
+ 	movq    %rsp, %rbp              /* See savecontext above */
+ 	subq	$16, %rsp		/* Make room for 2 args */
+ 	movq	%rdi, area2(%rbp)	/* use room to copy 1 arg */
+ 	movq    area2(%rbp),%rax        /* rax = area2 */
+ 	movq    topstack(%rax),%rsp	/* restore rsp from place relative rbp*/
+ 
+ 	popq	%r15			/* Restore regs */
+ 	popq	%r14
+ 	popq	%r13
+ 	popq	%r12
+ 	popq	%r11
+ 	popq	%r10
+ 	popq	%r9
+ 	popq	%r8
+ 	popq	%rdi
+ 	popq	%rsi
+ 	popq	%rbp
+ 	popq	%rbx
+ 	popq	%rdx
+ 	popq	%rcx
+ 	popq	%rax
+ 	popq	%rsp			/* See savecontext */
+ 	
+ 	movl    $0,_C_LABEL(PRE_Block)  /* clear it up... */
+ 	addq	$32, %rsp		/* We did rsp-32 above, correct that */
+ 	popq    %rbp
+ 	ret
+ 	
+ /* We never should get here, put in emergency brake as in i386 code */
+ 	pushq   $1234
+ 	call    _C_LABEL(abort)
+ 
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.5 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.6
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.5	Sun Jan 30 23:37:23 2005
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Sun Feb 20 20:28:00 2005
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.78</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.78</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.79</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.79</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
Index: openafs/src/packaging/MacOS/OpenAFS.info
diff -c openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.5 openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.6
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.5	Sun Jan 30 23:37:23 2005
--- openafs/src/packaging/MacOS/OpenAFS.info	Sun Feb 20 20:28:00 2005
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.3.78
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
--- 1,5 ----
  Title OpenAFS
! Version 1.3.79
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
Index: openafs/src/sys/Makefile.in
diff -c openafs/src/sys/Makefile.in:1.27.2.3 openafs/src/sys/Makefile.in:1.27.2.4
*** openafs/src/sys/Makefile.in:1.27.2.3	Sun Jan 30 23:34:46 2005
--- openafs/src/sys/Makefile.in	Sun Feb 20 20:12:10 2005
***************
*** 57,63 ****
  		$(RM) -f syscall.ss syscall.i;; \
  	 hp_ux11? ) \
  		touch syscall.o;; \
! 	i386_*bsd*|*nbsd*) \
  		touch syscall.o;; \
  	 *) \
  		/lib/cpp  ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \
--- 57,63 ----
  		$(RM) -f syscall.ss syscall.i;; \
  	 hp_ux11? ) \
  		touch syscall.o;; \
! 	amd64_fbsd*|i386_*bsd*|*nbsd*) \
  		touch syscall.o;; \
  	 *) \
  		/lib/cpp  ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \
Index: openafs/src/ubik/remote.c
diff -c openafs/src/ubik/remote.c:1.12.2.1 openafs/src/ubik/remote.c:1.12.2.2
*** openafs/src/ubik/remote.c:1.12.2.1	Wed Aug 25 03:09:43 2004
--- openafs/src/ubik/remote.c	Sun Feb 20 20:15:27 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.12.2.1 2004/08/25 07:09:43 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.12.2.2 2005/02/21 01:15:27 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 30,35 ****
--- 30,36 ----
  #include <lock.h>
  #include <rx/xdr.h>
  #include <rx/rx.h>
+ #include <afs/afsutil.h>
  
  #define UBIK_INTERNALS
  #include "ubik.h"
