]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
add user warning facility via mariner for macos
authorDerrick Brashear <shadow@dementia.org>
Tue, 2 Mar 2010 11:53:53 +0000 (06:53 -0500)
committerDerrick Brashear <shadow@dementia.org>
Wed, 3 Mar 2010 03:08:03 +0000 (19:08 -0800)
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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/afs/afs_warn.c
src/config/param.ppc_darwin_80.h
src/config/param.ppc_darwin_90.h
src/config/param.x86_darwin_100.h
src/config/param.x86_darwin_80.h
src/config/param.x86_darwin_90.h

index f7a566fe14f079979c6f9027b0f6ad84654c7563..c1cf0f3c4dcd8e050976cc1f739ebab3fbe3d554 100644 (file)
@@ -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 */
     }
 }
index f9d24f7fb2f9e9f91369b4f9fccf7bafccce2a5c..aae31d851df3d7ffbac9c3173e7f81555cc4c131 100644 (file)
@@ -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
 
 #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"
index b58a39d9699b8b7982b15c633cbdef83c88f9084..1dc8e4255095e89fd5940c5bd8715d6ac740d822 100644 (file)
@@ -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 */
 #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"
index 7558d8d7a2a3537ee5694a46e5d8d5436d6d0321..6d711cd589cc4431fc3239bdba0875bdb5765e49 100644 (file)
@@ -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 
 
 #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"
index 7126112d35d115669948851dd6cac632b3306e5b..058b9bf4c7902bff5364c0be9874a2b20261f917 100644 (file)
@@ -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 */
 #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 */
index 49c1970527a9fcd6820ee11296ee8648c162a41c..2f099875de88eb26dc63e0790f1c7c6ee5419c18 100644 (file)
@@ -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 */
 #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"