sdcard: Fix compilation with FUSE_TRACE == 1.
"PRI{u,x}64" was not compiling on C++ because of macro expansions.
Implement DLOG the same way DCHECK is implemented in
<android-base/logging.h>, and mechanically replace the problematic
lines with C++ logging. Remaining TRACE() lines will be replaced in a
follow-up CL.
Bug: 30222003
Change-Id: I377a91722eb4c035093fc96b79438c4f638b9a45
diff --git a/sdcard/fuse.h b/sdcard/fuse.h
index 634fbf1..9dafa79 100644
--- a/sdcard/fuse.h
+++ b/sdcard/fuse.h
@@ -33,6 +33,7 @@
#include <map>
#include <string>
+#include <android-base/logging.h>
#include <cutils/fs.h>
#include <cutils/log.h>
#include <cutils/multiuser.h>
@@ -40,15 +41,20 @@
#include <private/android_filesystem_config.h>
-// TODO(b/30222003): Fix compilation with FUSE_TRACE == 1.
#define FUSE_TRACE 0
#if FUSE_TRACE
#define TRACE(x...) ALOGD(x)
-#else
+static constexpr bool kEnableDLog = true;
+#else // FUSE_TRACE == 0
#define TRACE(x...) do {} while (0)
+static constexpr bool kEnableDLog = false;
#endif
+// Use same strategy as DCHECK().
+#define DLOG(x) \
+ if (kEnableDLog) LOG(x)
+
#define ERROR(x...) ALOGE(x)
/* Maximum number of bytes to write in one request. */