aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo.h
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-04-22 17:04:23 -0500
committerPeter Seebach <peter.seebach@windriver.com>2014-04-22 17:04:23 -0500
commit5392d265efd29e374080dca062ff1d1a834bfbed (patch)
treefedf5a7db8974343ae3848ada4d5da7956f8873f /pseudo.h
parent1c0d6d9a3cbb193a1c2f0e4f57a70781e7b69931 (diff)
downloadpseudo-5392d265efd29e374080dca062ff1d1a834bfbed.tar.gz
pseudo-5392d265efd29e374080dca062ff1d1a834bfbed.tar.bz2
pseudo-5392d265efd29e374080dca062ff1d1a834bfbed.zip
xattr support and other path stuff: reduce allocation and copying
The xattr first-pass implementation was allocating a buffer to hold the name and value for a set operation, then pseudo_client was allocating *another* buffer to hold the path and those two values. pseudo_client_op develops more nuanced argument handling, and also uses a static buffer for the extended paths it sometimes needs. So for the typical use case, only occasional operations will need to reallocate/expand the buffer, and we'll be down to copying things into that buffer once per operation, instead of having two alloc/free pairs and two copies. And of course, that wasn't two alloc/free pairs, it was one alloc/free pair and one alloc without a free. Whoops. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
Diffstat (limited to 'pseudo.h')
-rw-r--r--pseudo.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/pseudo.h b/pseudo.h
index ad78686..62678b7 100644
--- a/pseudo.h
+++ b/pseudo.h
@@ -49,13 +49,22 @@ extern int pseudo_diag(char *, ...) __attribute__ ((format (printf, 1, 2)));
if (pseudo_util_debug_flags & (x)) { pseudo_diag(__VA_ARGS__); } \
} \
} while (0)
+#define pseudo_debug_call(x, fn, ...) do { \
+ if ((x) & PDBGF_VERBOSE) { \
+ if ((pseudo_util_debug_flags & PDBGF_VERBOSE) && (pseudo_util_debug_flags & ((x) & ~PDBGF_VERBOSE))) { fn(__VA_ARGS__); } \
+ } else { \
+ if (pseudo_util_debug_flags & (x)) { fn(__VA_ARGS__); } \
+ } \
+} while (0)
#else
/* this used to be a static inline function, but that meant that arguments
* were still evaluated for side effects. We don't want that. The ...
* is a C99ism, also supported by GNU C.
*/
#define pseudo_debug(...) 0
+#define pseudo_debug_call(...) 0
#endif
+extern void pseudo_dump_data(char *, const void *, size_t);
void pseudo_new_pid(void);
/* pseudo_fix_path resolves symlinks up to this depth */
#define PSEUDO_MAX_LINK_RECURSION 16