]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Define afs_warnall routine
authorPerry Ruiter <pruiter@sinenomine.net>
Sat, 22 Mar 2014 07:52:32 +0000 (00:52 -0700)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 23 Jul 2014 15:13:17 +0000 (11:13 -0400)
In a Linux environment afs_warn and afs_warnuser both go to
the same spot, resulting in duplicated messages if both are
invoked back to back.  Define a new function afs_warnall
for use when identical messages are directed to both warn
and warnuser.  In a Linux environment it will do the right
thing and present only one copy of the message.

Reviewed-on: http://gerrit.openafs.org/10943
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
(cherry picked from commit a70f8e1a7e3fcbc13c9a60f8a7409dd01d014afb)

Change-Id: I264633cd4a30cfb7f7264e56512f318cfb23ef3e
Reviewed-on: http://gerrit.openafs.org/11182
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_prototypes.h
src/afs/afs_warn.c

index 3bab010a934e2280131f630615ce3b3d934eb568..2e0d173cf0e7c45fcf360d3da16b6304b8375c07 100644 (file)
@@ -1007,11 +1007,14 @@ extern afs_int32 afs_data_pointer_to_int32(const void *p);
 /* AIX doesn't have usable va_args support in its kernel */
 extern void afs_warn();
 extern void afs_warnuser();
+extern void afs_warnall();
 #else
 extern void afs_warn(char *fmt, ...)
        AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
 extern void afs_warnuser(char *fmt, ...)
        AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
+extern void afs_warnall(char *fmt, ...)
+       AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
 #endif
 
 /* afs_vcache.c */
index 1127e3d362a8001ed4d7d8f8c78890182f897db1..900182002813e2c1b11ba214b5c69f1068f36255 100644 (file)
@@ -210,3 +210,48 @@ afs_warnuser(char *fmt, ...)
 }
 
 #endif /* AFS_AIX_ENV */
+
+
+#ifdef AFS_AIX_ENV
+void
+afs_warnall(fmt, a, b, c, d, e, f, g, h, i)
+    char *fmt;
+    void *a, *b, *c, *d, *e, *f, *g, *h, *i;
+{
+    afs_warn(fmt, a, b, c, d, e, f, g, h, i);
+    afs_warnuser(fmt, a, b, c, d, e, f, g, h, i);
+
+}
+#else /* AFS_AIX_ENV */
+/*  On Linux both afs_warn and afs_warnuser go to the same
+ *  place.  Suppress one of them if we're running on Linux.
+ */
+void
+afs_warnall(char *fmt, ...)
+{
+    va_list ap;
+
+# ifdef AFS_LINUX20_ENV
+    AFS_STATCNT(afs_warn);
+    if ((afs_showflags & GAGCONSOLE) || (afs_showflags & GAGUSER)) {
+       va_start(ap, fmt);
+       afs_vwarn(fmt, ap);
+       va_end(ap);
+    }
+# else /* AFS_LINUX20_ENV */
+    AFS_STATCNT(afs_warn);
+    if (afs_showflags & GAGCONSOLE) {
+       va_start(ap, fmt);
+       afs_vwarn(fmt, ap);
+       va_end(ap);
+    }
+
+    AFS_STATCNT(afs_warnuser);
+    if (afs_showflags & GAGUSER) {
+       va_start(ap, fmt);
+       afs_vwarnuser(fmt, ap);
+       va_end(ap);
+    }
+# endif /* AFS_LINUX20_ENV */
+}
+#endif /* AFS_AIX_ENV */