#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#include "afs/stds.h"
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include <sys/fp_io.h>
#endif
-#if defined(AFS_XBSD_ENV)
-#include <crypto/md5.h>
-#endif
-
afs_int32 afs_new_inum = 0;
#ifndef afs_cv2string
return NULL;
}
#endif
+#ifndef afs_strrchr
+char *
+afs_strrchr(char *s, int c)
+{
+ char *p = NULL;
+
+ do {
+ if (*s == c)
+ p = (char*) s;
+ } while (*s++);
+ return p;
+}
+#endif
char *
afs_strdup(char *s)
-/* * * * * * *
- * this code badly needs to be cleaned up... too many ugly ifdefs.
- * XXX
- */
-#if 0
-void
-afs_warn(char *a, long b, long c, long d, long e, long f, long g, long h,
- long i, long j)
-#else
-void
-afs_warn(a, b, c, d, e, f, g, h, i, j)
- char *a;
-#if defined( AFS_USE_VOID_PTR)
- void *b, *c, *d, *e, *f, *g, *h, *i, *j;
-#else
- long b, c, d, e, f, g, h, i, j;
-#endif
-#endif
-{
- AFS_STATCNT(afs_warn);
-
- if (afs_showflags & GAGCONSOLE) {
-#if defined(AFS_AIX_ENV)
- struct file *fd;
-
- /* cf. console_printf() in oncplus/kernext/nfs/serv/shared.c */
- if (fp_open
- ("/dev/console", O_WRONLY | O_NOCTTY | O_NDELAY, 0666, 0, FP_SYS,
- &fd) == 0) {
- char buf[1024];
- ssize_t len;
- ssize_t count;
-
- sprintf(buf, a, b, c, d, e, f, g, h, i, j);
- len = strlen(buf);
- fp_write(fd, buf, len, 0, UIO_SYSSPACE, &count);
- fp_close(fd);
- }
-#else
- printf(a, b, c, d, e, f, g, h, i, j);
-#endif
- }
-}
-
-#if 0
-void
-afs_warnuser(char *a, long b, long c, long d, long e, long f, long g, long h,
- long i, long j)
-#else
-void
-afs_warnuser(a, b, c, d, e, f, g, h, i, j)
- char *a;
- long b, c, d, e, f, g, h, i, j;
-#endif
-{
- AFS_STATCNT(afs_warnuser);
- if (afs_showflags & GAGUSER) {
-#ifdef AFS_GLOBAL_SUNLOCK
- int haveGlock = ISAFS_GLOCK();
- if (haveGlock)
- AFS_GUNLOCK();
-#endif /* AFS_GLOBAL_SUNLOCK */
-
- uprintf(a, b, c, d, e, f, g, h, i, j);
-
-#ifdef AFS_GLOBAL_SUNLOCK
- if (haveGlock)
- AFS_GLOCK();
-#endif /* AFS_GLOBAL_SUNLOCK */
- }
-}
-
-
/* run everywhere, checking locks */
void
afs_CheckLocks(void)
for (i = 0; i < VCSIZE; i++) {
for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
- if (tvc->states & CVInit) continue;
+ if (tvc->f.states & CVInit) continue;
#ifdef AFS_OSF_ENV
if (VREFCOUNT(tvc) > 1)
#else /* AFS_OSF_ENV */
{
struct srvAddr *sa;
struct server *ts;
- struct conn *tc;
+ struct afs_conn *tc;
for (i = 0; i < NSERVERS; i++) {
for (ts = afs_servers[i]; ts; ts = ts->next) {
if (ts->flags & SRVR_ISDOWN)
return ip.i32[i32_sub];
}
-#if defined(AFS_XBSD_ENV)
-
-#define afs_md5 MD5Context
-#define AFS_MD5_Init(m) MD5Init((m))
-#define AFS_MD5_Update(m, p, l) MD5Update((m), (void *)(p), (l))
-#define AFS_MD5_Final(r, m) MD5Final((r), (m))
-
-#else
+#ifdef AFS_LINUX20_ENV
struct afs_md5 {
unsigned int sz[2];
* From `Performance analysis of MD5' by Joseph D. Touch <touch@isi.edu>
*/
-#if defined(AFSBIG_ENDIAN)
+#if defined(WORDS_BIGENDIAN)
static inline afs_uint32
swap_u_int32_t (afs_uint32 t)
{
p += l;
len -= l;
if(offset == 64){
-#if defined(AFSBIG_ENDIAN)
+#if defined(WORDS_BIGENDIAN)
int i;
- afs_uint32 current[16];
+ afs_uint32 temp[16];
struct x32 *us = (struct x32*)m->save;
for(i = 0; i < 8; i++){
- current[2*i+0] = swap_u_int32_t(us[i].a);
- current[2*i+1] = swap_u_int32_t(us[i].b);
+ temp[2*i+0] = swap_u_int32_t(us[i].a);
+ temp[2*i+1] = swap_u_int32_t(us[i].b);
}
- calc(m, current);
+ calc(m, temp);
#else
calc(m, (afs_uint32*)m->save);
#endif
}
}
}
-#endif
afs_int32 afs_calc_inum (afs_int32 volume, afs_int32 vnode)
{
- afs_int32 ino;
+ afs_int32 ino, vno = vnode;
char digest[16];
struct afs_md5 ct;
AFS_MD5_Update(&ct, &volume, 4);
AFS_MD5_Update(&ct, &vnode, 4);
AFS_MD5_Final(digest, &ct);
- memcpy(&ino, digest, sizeof(ino_t));
+ memcpy(&ino, digest, sizeof(afs_int32));
+ ino ^= (ino ^ vno) & 1;
} else {
ino = (volume << 16) + vnode;
- ino &= 0x7fffffff; /* Assumes 32 bit ino_t ..... */
}
+ ino &= 0x7fffffff; /* Assumes 32 bit ino_t ..... */
return ino;
}
+
+#else
+
+afs_int32 afs_calc_inum (afs_int32 volume, afs_int32 vnode)
+{
+ return (volume << 16) + vnode;
+}
+
+#endif