diff options
author | Karel Zak | 2013-08-22 12:10:13 +0200 |
---|---|---|
committer | Karel Zak | 2013-08-22 12:10:13 +0200 |
commit | b7e47ac1ac3f2d17536e8864db9c8bdada340b87 (patch) | |
tree | 0c881eeba9c54a1d1b5eccd0dc3376dd9fe0bd61 /libmount/python/pylibmount.c | |
parent | libmount: cleanup libmnt_fs list after mnt_table_remove_fs() (diff) | |
download | kernel-qcow2-util-linux-b7e47ac1ac3f2d17536e8864db9c8bdada340b87.tar.gz kernel-qcow2-util-linux-b7e47ac1ac3f2d17536e8864db9c8bdada340b87.tar.xz kernel-qcow2-util-linux-b7e47ac1ac3f2d17536e8864db9c8bdada340b87.zip |
pylibmount: add debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/python/pylibmount.c')
-rw-r--r-- | libmount/python/pylibmount.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libmount/python/pylibmount.c b/libmount/python/pylibmount.c index 5c9eca0e5..d2e79fbcc 100644 --- a/libmount/python/pylibmount.c +++ b/libmount/python/pylibmount.c @@ -22,6 +22,8 @@ /* Libmount-specific Exception class */ PyObject *LibmountError; +int pylibmount_debug_mask; + PyObject *UL_IncRef(void *killme) { @@ -130,9 +132,27 @@ PyMODINIT_FUNC initpylibmount(void) if (!m) return; + /* + * init debug stuff + */ + if (!(pylibmount_debug_mask & PYMNT_DEBUG_INIT)) { + char *str = getenv("PYLIBMOUNT_DEBUG"); + + pylibmount_debug_mask = 0; + if (str) + pylibmount_debug_mask = strtoul(str, 0, 0); - /*mnt_init_debug(0xffff);*/ + pylibmount_debug_mask |= PYMNT_DEBUG_INIT; + } + + if (pylibmount_debug_mask && pylibmount_debug_mask != PYMNT_DEBUG_INIT) + DBG(INIT, pymnt_debug("library debug mask: 0x%04x", + pylibmount_debug_mask)); + mnt_init_debug(0); + /* + * Add module objects + */ LibmountError = PyErr_NewException("libmount.Error", NULL, NULL); Py_INCREF(LibmountError); PyModule_AddObject(m, "Error", (PyObject *)LibmountError); |