[Ocfs2-tools-commits] zab commits r481 - in trunk/fsck.ocfs2: .
include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Dec 13 17:06:32 CST 2004
Author: zab
Date: 2004-12-13 17:06:30 -0600 (Mon, 13 Dec 2004)
New Revision: 481
Modified:
trunk/fsck.ocfs2/Makefile
trunk/fsck.ocfs2/include/problem.h
trunk/fsck.ocfs2/problem.c
Log:
o add a cute target to test if any prompt() callers in fsck
specify the same error code
Modified: trunk/fsck.ocfs2/Makefile
===================================================================
--- trunk/fsck.ocfs2/Makefile 2004-12-13 22:17:18 UTC (rev 480)
+++ trunk/fsck.ocfs2/Makefile 2004-12-13 23:06:30 UTC (rev 481)
@@ -61,4 +61,13 @@
fsck.ocfs2: $(OBJS) $(LIBOCFS2_DEPS)
$(LINK) $(LIBOCFS2_LIBS) $(COM_ERR_LIBS)
+.PHONY: check-prompt-dups
+check-prompt-dups: fsck.ocfs2
+ @rm -f .$@.tmp
+ @nm $^ | \
+ awk -F'[ .]' '/fsck_prompt_callers_with_code/ {print $$3}' | \
+ sort | uniq -c | awk '($$1 > 1){print $$0}' > .$@.tmp
+ @cat .$@.tmp
+ @test ! -s .$@.tmp
+
include $(TOPDIR)/Postamble.make
Modified: trunk/fsck.ocfs2/include/problem.h
===================================================================
--- trunk/fsck.ocfs2/include/problem.h 2004-12-13 22:17:18 UTC (rev 480)
+++ trunk/fsck.ocfs2/include/problem.h 2004-12-13 23:06:30 UTC (rev 481)
@@ -32,9 +32,24 @@
/* returns non-zero for yes and zero for no. The caller is expected to
* provide a thorough description of the state and the action that will
- * be taken depending on the answer. Without \n termination. */
-int prompt(o2fsck_state *ost, unsigned flags, uint16_t code,
- const char *fmt, ...)
+ * be taken depending on the answer. Without \n termination.
+ *
+ * The code argument is a digit that identifies the error. it is used by
+ * input to regression testing utils and referenced in fsck.ocfs2.checks(8).
+ * each code is only supposed to have one call site. we create this
+ * funny symbol so that the 'check-prompt-callers' makefile target
+ * can go groveling through nm to find out if a code has more than
+ * one call site.
+ */
+#define prompt(ost, flags, code, fmt...) ({ \
+ static int fsck_prompt_callers_with_code_##code = code; \
+ int _ret = fsck_prompt_callers_with_code_##code; \
+ _ret = prompt_input(ost, flags, code, fmt); \
+ _ret; \
+})
+
+int prompt_input(o2fsck_state *ost, unsigned flags, uint16_t code,
+ const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
#endif /* __O2FSCK_PROBLEM_H__ */
Modified: trunk/fsck.ocfs2/problem.c
===================================================================
--- trunk/fsck.ocfs2/problem.c 2004-12-13 22:17:18 UTC (rev 480)
+++ trunk/fsck.ocfs2/problem.c 2004-12-13 23:06:30 UTC (rev 481)
@@ -146,8 +146,8 @@
* and have a notion of grouping, as well. The caller is expected to provide
* a fully formed question that isn't terminated with a newline.
*/
-int prompt(o2fsck_state *ost, unsigned flags, uint16_t code, const char *fmt,
- ...)
+int prompt_input(o2fsck_state *ost, unsigned flags, uint16_t code,
+ const char *fmt, ...)
{
va_list ap;
int c, ans = 0;
More information about the Ocfs2-tools-commits
mailing list