From 5faeff77b0c9f551cd6d36daa2cbc12a41d8508d Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 2 Mar 2010 06:53:53 -0500 Subject: [PATCH] add user warning facility via mariner for macos existing mariner clients treat fetch$ and store$ special and otherwise just blat out a string. use this to our advantage Change-Id: Ib218918abe6038a08af58ea58405b2856ba1da9f Reviewed-on: http://gerrit.openafs.org/1505 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/afs_warn.c | 28 +++++++++++++++++++++++++++- src/config/param.ppc_darwin_80.h | 3 +++ src/config/param.ppc_darwin_90.h | 2 ++ src/config/param.x86_darwin_100.h | 2 ++ src/config/param.x86_darwin_80.h | 2 ++ src/config/param.x86_darwin_90.h | 2 ++ 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_warn.c b/src/afs/afs_warn.c index f7a566fe1..c1cf0f3c4 100644 --- a/src/afs/afs_warn.c +++ b/src/afs/afs_warn.c @@ -115,6 +115,9 @@ void afs_warnuser(char *fmt, ...) #endif { +#if defined(AFS_WARNUSER_MARINER_ENV) + char buf[256]; +#endif AFS_STATCNT(afs_warnuser); if (afs_showflags & GAGUSER) { #if !defined(AFS_AIX_ENV) @@ -122,22 +125,45 @@ afs_warnuser(char *fmt, ...) #endif #ifdef AFS_GLOBAL_SUNLOCK int haveGlock = ISAFS_GLOCK(); +#if defined(AFS_WARNUSER_MARINER_ENV) + /* gain GLOCK for mariner */ + if (!haveGlock) + AFS_GLOCK(); +#else + /* drop GLOCK for uprintf */ if (haveGlock) AFS_GUNLOCK(); +#endif #endif /* AFS_GLOBAL_SUNLOCK */ #if defined(AFS_AIX_ENV) uprintf(fmt, a, b, c, d, e, f, g, h, i); #else - va_start(ap, fmt); +#if defined(AFS_WARNUSER_MARINER_ENV) + /* mariner log the warning */ + snprintf(buf, sizeof(buf), "warn$"); + vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); + afs_MarinerLog(buf, NULL); + va_end(ap); + va_start(ap, fmt); + vprintf(fmt, ap); +#else afs_vprintf(fmt, ap); +#endif va_end(ap); #endif #ifdef AFS_GLOBAL_SUNLOCK +#if defined(AFS_WARNUSER_MARINER_ENV) + /* drop GLOCK we got for mariner */ + if (!haveGlock) + AFS_GUNLOCK(); +#else + /* regain GLOCK we dropped for uprintf */ if (haveGlock) AFS_GLOCK(); +#endif #endif /* AFS_GLOBAL_SUNLOCK */ } } diff --git a/src/config/param.ppc_darwin_80.h b/src/config/param.ppc_darwin_80.h index f9d24f7fb..aae31d851 100644 --- a/src/config/param.ppc_darwin_80.h +++ b/src/config/param.ppc_darwin_80.h @@ -26,6 +26,8 @@ #define AFS_NONFSTRANS #define AFS_SYSCALL 230 #define AFS_NAMEI_ENV 1 +#define DARWIN_REFBASE 3 +#define AFS_WARNUSER_MARINER_ENV 1 #define AFS_BOZONLOCK_ENV 1 @@ -118,6 +120,7 @@ #define AFS_NONFSTRANS #define AFS_SYSCALL 230 #define DARWIN_REFBASE 0 +#define AFS_WARNUSER_MARINER_ENV 1 /* File system entry (used if mount.h doesn't define MOUNT_AFS */ #define AFS_MOUNT_AFS "afs" diff --git a/src/config/param.ppc_darwin_90.h b/src/config/param.ppc_darwin_90.h index b58a39d96..1dc8e4255 100644 --- a/src/config/param.ppc_darwin_90.h +++ b/src/config/param.ppc_darwin_90.h @@ -28,6 +28,7 @@ #define AFS_SYSCALL 230 #define AFS_NAMEI_ENV 1 #define DARWIN_REFBASE 3 +#define AFS_WARNUSER_MARINER_ENV 1 #define AFS_CACHE_VNODE_PATH /* File system entry (used if mount.h doesn't define MOUNT_AFS */ @@ -122,6 +123,7 @@ #define AFS_NONFSTRANS #define AFS_SYSCALL 230 #define DARWIN_REFBASE 0 +#define AFS_WARNUSER_MARINER_ENV 1 /* File system entry (used if mount.h doesn't define MOUNT_AFS */ #define AFS_MOUNT_AFS "afs" diff --git a/src/config/param.x86_darwin_100.h b/src/config/param.x86_darwin_100.h index 7558d8d7a..6d711cd58 100644 --- a/src/config/param.x86_darwin_100.h +++ b/src/config/param.x86_darwin_100.h @@ -32,6 +32,7 @@ #define AFS_SYSCALL 230 #define AFS_NAMEI_ENV 1 #define DARWIN_REFBASE 3 +#define AFS_WARNUSER_MARINER_ENV 1 #define AFS_CACHE_VNODE_PATH #define NEED_IOCTL32 @@ -159,6 +160,7 @@ #define AFS_NONFSTRANS #define AFS_SYSCALL 230 #define DARWIN_REFBASE 0 +#define AFS_WARNUSER_MARINER_ENV 1 /* File system entry (used if mount.h doesn't define MOUNT_AFS */ #define AFS_MOUNT_AFS "afs" diff --git a/src/config/param.x86_darwin_80.h b/src/config/param.x86_darwin_80.h index 7126112d3..058b9bf4c 100644 --- a/src/config/param.x86_darwin_80.h +++ b/src/config/param.x86_darwin_80.h @@ -26,6 +26,7 @@ #define AFS_NONFSTRANS #define AFS_SYSCALL 230 #define AFS_NAMEI_ENV 1 +#define AFS_WARNUSER_MARINER_ENV 1 #define DARWIN_REFBASE 3 /* File system entry (used if mount.h doesn't define MOUNT_AFS */ @@ -116,6 +117,7 @@ #undef AFS_NONFSTRANS #define AFS_NONFSTRANS #define AFS_SYSCALL 230 +#define AFS_WARNUSER_MARINER_ENV 1 #define DARWIN_REFBASE 0 /* File system entry (used if mount.h doesn't define MOUNT_AFS */ diff --git a/src/config/param.x86_darwin_90.h b/src/config/param.x86_darwin_90.h index 49c197052..2f099875d 100644 --- a/src/config/param.x86_darwin_90.h +++ b/src/config/param.x86_darwin_90.h @@ -28,6 +28,7 @@ #define AFS_SYSCALL 230 #define AFS_NAMEI_ENV 1 #define DARWIN_REFBASE 3 +#define AFS_WARNUSER_MARINER_ENV 1 #define AFS_CACHE_VNODE_PATH /* File system entry (used if mount.h doesn't define MOUNT_AFS */ @@ -121,6 +122,7 @@ #define AFS_NONFSTRANS #define AFS_SYSCALL 230 #define DARWIN_REFBASE 0 +#define AFS_WARNUSER_MARINER_ENV 1 /* File system entry (used if mount.h doesn't define MOUNT_AFS */ #define AFS_MOUNT_AFS "afs" -- 2.39.5