[Ocfs2-devel] [PATCH 04/12] ocfs2/dlm: Create debugfs dirs

Joel Becker Joel.Becker at oracle.com
Wed Mar 5 11:04:05 PST 2008


On Wed, Mar 05, 2008 at 10:54:59AM -0800, Joel Becker wrote:
> On Tue, Mar 04, 2008 at 04:49:52PM -0800, Sunil Mushran wrote:
> > This patch creates the debugfs directories that will hold the
> > files to be used to dump the dlm state.
> > 
> > Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
> Signed-off-by: Joel Becker <joel.becker at oracle.com>

	I take this back.  Can't you do the #ifdef in dlmdebug.h
instead?  eg:


+#ifndef DLMDEBUG_H
+#define DLMDEBUG_H
+
+#ifdef CONFIG_DEBUG_FS
+int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm);
+void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm);
+
+int dlm_create_debugfs_root(void);
+void dlm_destroy_debugfs_root(void);
+#else
+static inline int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm)
+{
+	return 0;
+}
+static void int dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm)
+{
+	return;
+}
+static inline int dlm_create_debugfs_root(void);
+{
+	return 0;
+}
+static inline int dlm_destroy_debugfs_root(void);
+{
+	return;
+}
+#endif  /* CONFIG_DEBUG_FS */
+
+#endif  /* DLMDEBUG_H */

	This allows us to leave a million #ifdefs out of dlmdebug.c -
you just wrap the *entire* debugfs bit in a giant #ifdef.  That's much
nicer to read than functions that are ifdef'd out one-by-one.
	Also, in general, can you comment your #endif lines if they are
not on the same 80x24 terminal screen as the opening #ifdef?

Joel

-- 

"I don't want to achieve immortality through my work; I want to
 achieve immortality through not dying."
        - Woody Allen

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-devel mailing list