Commit 0a817747 authored by spiiroin's avatar spiiroin

[logging] Add enablers for exposing call stack

When debugging complex issues it can be helpful know also which thread is
emitting the diagnostic message and the code path that led to the situation.

This is meant to be used as a development time debugging feature and thus
requires enabling during build time - otherwise all related code is excluded
from usb-moded binary.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 0facd5b1
...@@ -63,6 +63,8 @@ static int android_probed = -1; ...@@ -63,6 +63,8 @@ static int android_probed = -1;
static bool static bool
android_write_file(const char *path, const char *text) android_write_file(const char *path, const char *text)
{ {
LOG_REGISTER_CONTEXT;
bool ack = false; bool ack = false;
if( !path || !text ) if( !path || !text )
...@@ -86,6 +88,8 @@ EXIT: ...@@ -86,6 +88,8 @@ EXIT:
bool bool
android_in_use(void) android_in_use(void)
{ {
LOG_REGISTER_CONTEXT;
if( android_probed < 0 ) if( android_probed < 0 )
log_debug("android_in_use() called before android_probe()"); log_debug("android_in_use() called before android_probe()");
...@@ -95,6 +99,8 @@ android_in_use(void) ...@@ -95,6 +99,8 @@ android_in_use(void)
static bool static bool
android_probe(void) android_probe(void)
{ {
LOG_REGISTER_CONTEXT;
if( android_probed <= 0 ) { if( android_probed <= 0 ) {
android_probed = access(ANDROID0_ENABLE, F_OK) == 0; android_probed = access(ANDROID0_ENABLE, F_OK) == 0;
log_warning("ANDROID0 %sdetected", android_probed ? "" : "not "); log_warning("ANDROID0 %sdetected", android_probed ? "" : "not ");
...@@ -108,6 +114,8 @@ android_probe(void) ...@@ -108,6 +114,8 @@ android_probe(void)
gchar * gchar *
android_get_serial(void) android_get_serial(void)
{ {
LOG_REGISTER_CONTEXT;
static const char path[] = "/proc/cmdline"; static const char path[] = "/proc/cmdline";
static const char find[] = "androidboot.serialno="; static const char find[] = "androidboot.serialno=";
static const char pbrk[] = " \t\r\n,"; static const char pbrk[] = " \t\r\n,";
...@@ -157,6 +165,8 @@ EXIT: ...@@ -157,6 +165,8 @@ EXIT:
bool bool
android_init_values(void) android_init_values(void)
{ {
LOG_REGISTER_CONTEXT;
gchar *text; gchar *text;
if( !android_probe() ) if( !android_probe() )
...@@ -217,6 +227,8 @@ EXIT: ...@@ -217,6 +227,8 @@ EXIT:
bool bool
android_set_enabled(bool enable) android_set_enabled(bool enable)
{ {
LOG_REGISTER_CONTEXT;
bool ack = false; bool ack = false;
if( android_in_use() ) { if( android_in_use() ) {
const char *val = enable ? "1" : "0"; const char *val = enable ? "1" : "0";
...@@ -233,6 +245,8 @@ android_set_enabled(bool enable) ...@@ -233,6 +245,8 @@ android_set_enabled(bool enable)
bool bool
android_set_charging_mode(void) android_set_charging_mode(void)
{ {
LOG_REGISTER_CONTEXT;
bool ack = false; bool ack = false;
if( !android_in_use() ) if( !android_in_use() )
...@@ -262,6 +276,8 @@ EXIT: ...@@ -262,6 +276,8 @@ EXIT:
bool bool
android_set_function(const char *function) android_set_function(const char *function)
{ {
LOG_REGISTER_CONTEXT;
bool ack = false; bool ack = false;
if( !function ) if( !function )
...@@ -293,6 +309,8 @@ EXIT: ...@@ -293,6 +309,8 @@ EXIT:
bool bool
android_set_productid(const char *id) android_set_productid(const char *id)
{ {
LOG_REGISTER_CONTEXT;
bool ack = false; bool ack = false;
if( id && android_in_use() ) { if( id && android_in_use() ) {
...@@ -316,6 +334,8 @@ android_set_productid(const char *id) ...@@ -316,6 +334,8 @@ android_set_productid(const char *id)
bool bool
android_set_vendorid(const char *id) android_set_vendorid(const char *id)
{ {
LOG_REGISTER_CONTEXT;
bool ack = false; bool ack = false;
if( id && android_in_use() ) { if( id && android_in_use() ) {
char str[16]; char str[16];
...@@ -338,6 +358,8 @@ android_set_vendorid(const char *id) ...@@ -338,6 +358,8 @@ android_set_vendorid(const char *id)
bool bool
android_set_attr(const char *function, const char *attr, const char *value) android_set_attr(const char *function, const char *attr, const char *value)
{ {
LOG_REGISTER_CONTEXT;
bool ack = false; bool ack = false;
if( function && attr && value && android_in_use() ) { if( function && attr && value && android_in_use() ) {
......
...@@ -64,6 +64,8 @@ static gboolean dbus_connection_disc = FALSE; // got disconnected ...@@ -64,6 +64,8 @@ static gboolean dbus_connection_disc = FALSE; // got disconnected
static void dbusappsync_release_name(void) static void dbusappsync_release_name(void)
{ {
LOG_REGISTER_CONTEXT;
/* Drop the service name - if we have it */ /* Drop the service name - if we have it */
if( dbus_connection_ses && dbus_connection_name ) if( dbus_connection_ses && dbus_connection_name )
{ {
...@@ -96,6 +98,8 @@ static void dbusappsync_release_name(void) ...@@ -96,6 +98,8 @@ static void dbusappsync_release_name(void)
static gboolean dbusappsync_obtain_name(void) static gboolean dbusappsync_obtain_name(void)
{ {
LOG_REGISTER_CONTEXT;
DBusError error = DBUS_ERROR_INIT; DBusError error = DBUS_ERROR_INIT;
int ret; int ret;
...@@ -150,6 +154,8 @@ EXIT: ...@@ -150,6 +154,8 @@ EXIT:
static DBusHandlerResult dbusappsync_msg_handler(DBusConnection *const connection, DBusMessage *const msg, gpointer const user_data) static DBusHandlerResult dbusappsync_msg_handler(DBusConnection *const connection, DBusMessage *const msg, gpointer const user_data)
{ {
LOG_REGISTER_CONTEXT;
DBusHandlerResult status = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; DBusHandlerResult status = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
int type = dbus_message_get_type(msg); int type = dbus_message_get_type(msg);
const char *interface = dbus_message_get_interface(msg); const char *interface = dbus_message_get_interface(msg);
...@@ -221,6 +227,8 @@ IGNORE: ...@@ -221,6 +227,8 @@ IGNORE:
*/ */
static DBusHandlerResult dbusappsync_handle_disconnect(DBusConnection *conn, DBusMessage *msg, void *user_data) static DBusHandlerResult dbusappsync_handle_disconnect(DBusConnection *conn, DBusMessage *msg, void *user_data)
{ {
LOG_REGISTER_CONTEXT;
if( dbus_message_is_signal(msg, DBUS_INTERFACE_LOCAL, "Disconnected") ) if( dbus_message_is_signal(msg, DBUS_INTERFACE_LOCAL, "Disconnected") )
{ {
log_warning("disconnected from session bus - expecting restart/stop soon\n"); log_warning("disconnected from session bus - expecting restart/stop soon\n");
...@@ -235,6 +243,8 @@ static DBusHandlerResult dbusappsync_handle_disconnect(DBusConnection *conn, DBu ...@@ -235,6 +243,8 @@ static DBusHandlerResult dbusappsync_handle_disconnect(DBusConnection *conn, DBu
*/ */
static void dbusappsync_cleanup_connection(void) static void dbusappsync_cleanup_connection(void)
{ {
LOG_REGISTER_CONTEXT;
if( dbus_connection_ses != 0 ) if( dbus_connection_ses != 0 )
{ {
/* Remove message filters */ /* Remove message filters */
...@@ -259,6 +269,8 @@ static void dbusappsync_cleanup_connection(void) ...@@ -259,6 +269,8 @@ static void dbusappsync_cleanup_connection(void)
*/ */
gboolean dbusappsync_init_connection(void) gboolean dbusappsync_init_connection(void)
{ {
LOG_REGISTER_CONTEXT;
gboolean result = FALSE; gboolean result = FALSE;
DBusError error = DBUS_ERROR_INIT; DBusError error = DBUS_ERROR_INIT;
...@@ -316,6 +328,8 @@ EXIT: ...@@ -316,6 +328,8 @@ EXIT:
*/ */
gboolean dbusappsync_init(void) gboolean dbusappsync_init(void)
{ {
LOG_REGISTER_CONTEXT;
gboolean status = FALSE; gboolean status = FALSE;
if( !dbusappsync_init_connection() ) if( !dbusappsync_init_connection() )
...@@ -336,6 +350,8 @@ EXIT: ...@@ -336,6 +350,8 @@ EXIT:
*/ */
void dbusappsync_cleanup(void) void dbusappsync_cleanup(void)
{ {
LOG_REGISTER_CONTEXT;
dbusappsync_cleanup_connection(); dbusappsync_cleanup_connection();
// NOP // NOP
} }
...@@ -345,6 +361,8 @@ void dbusappsync_cleanup(void) ...@@ -345,6 +361,8 @@ void dbusappsync_cleanup(void)
*/ */
int dbusappsync_launch_app(char *launch) int dbusappsync_launch_app(char *launch)
{ {
LOG_REGISTER_CONTEXT;
int ret = -1; // assume failure int ret = -1; // assume failure
if( dbus_connection_ses == 0 ) if( dbus_connection_ses == 0 )
......
...@@ -82,6 +82,8 @@ static int appsync_no_dbus = 1; // always disabled ...@@ -82,6 +82,8 @@ static int appsync_no_dbus = 1; // always disabled
static void appsync_free_elem(list_elem_t *elem) static void appsync_free_elem(list_elem_t *elem)
{ {
LOG_REGISTER_CONTEXT;
g_free(elem->name); g_free(elem->name);
g_free(elem->launch); g_free(elem->launch);
g_free(elem->mode); g_free(elem->mode);
...@@ -90,12 +92,16 @@ static void appsync_free_elem(list_elem_t *elem) ...@@ -90,12 +92,16 @@ static void appsync_free_elem(list_elem_t *elem)
static void appsync_free_elem_cb(gpointer elem, gpointer user_data) static void appsync_free_elem_cb(gpointer elem, gpointer user_data)
{ {
LOG_REGISTER_CONTEXT;
(void)user_data; (void)user_data;
appsync_free_elem(elem); appsync_free_elem(elem);
} }
void appsync_free_appsync_list(void) void appsync_free_appsync_list(void)
{ {
LOG_REGISTER_CONTEXT;
if( appsync_sync_list != 0 ) if( appsync_sync_list != 0 )
{ {
/*g_list_free_full(appsync_sync_list, appsync_free_elem); */ /*g_list_free_full(appsync_sync_list, appsync_free_elem); */
...@@ -108,11 +114,15 @@ void appsync_free_appsync_list(void) ...@@ -108,11 +114,15 @@ void appsync_free_appsync_list(void)
static gint appsync_list_sort_func(gconstpointer a, gconstpointer b) static gint appsync_list_sort_func(gconstpointer a, gconstpointer b)
{ {
LOG_REGISTER_CONTEXT;
return strcasecmp( (char*)a, (char*)b ); return strcasecmp( (char*)a, (char*)b );
} }
void appsync_read_list(int diag) void appsync_read_list(int diag)
{ {
LOG_REGISTER_CONTEXT;
GDir *confdir = 0; GDir *confdir = 0;
const gchar *dirname; const gchar *dirname;
...@@ -160,6 +170,8 @@ cleanup: ...@@ -160,6 +170,8 @@ cleanup:
static list_elem_t *appsync_read_file(const gchar *filename, int diag) static list_elem_t *appsync_read_file(const gchar *filename, int diag)
{ {
LOG_REGISTER_CONTEXT;
gchar *full_filename = NULL; gchar *full_filename = NULL;
GKeyFile *settingsfile = NULL; GKeyFile *settingsfile = NULL;
list_elem_t *list_item = NULL; list_elem_t *list_item = NULL;
...@@ -215,6 +227,8 @@ cleanup: ...@@ -215,6 +227,8 @@ cleanup:
/* @return 0 on succes, 1 if there is a failure */ /* @return 0 on succes, 1 if there is a failure */
int appsync_activate_sync(const char *mode) int appsync_activate_sync(const char *mode)
{ {
LOG_REGISTER_CONTEXT;
GList *iter; GList *iter;
int count = 0; int count = 0;
...@@ -316,6 +330,8 @@ error: ...@@ -316,6 +330,8 @@ error:
int appsync_activate_sync_post(const char *mode) int appsync_activate_sync_post(const char *mode)
{ {
LOG_REGISTER_CONTEXT;
GList *iter; GList *iter;
log_debug("activate post sync"); log_debug("activate post sync");
...@@ -374,6 +390,8 @@ error: ...@@ -374,6 +390,8 @@ error:
int appsync_mark_active(const gchar *name, int post) int appsync_mark_active(const gchar *name, int post)
{ {
LOG_REGISTER_CONTEXT;
int ret = -1; // assume name not found int ret = -1; // assume name not found
int missing = 0; int missing = 0;
...@@ -417,6 +435,8 @@ int appsync_mark_active(const gchar *name, int post) ...@@ -417,6 +435,8 @@ int appsync_mark_active(const gchar *name, int post)
#ifdef APP_SYNC_DBUS #ifdef APP_SYNC_DBUS
static gboolean appsync_enumerate_usb_cb(gpointer data) static gboolean appsync_enumerate_usb_cb(gpointer data)
{ {
LOG_REGISTER_CONTEXT;
(void)data; (void)data;
appsync_enumerate_usb_id = 0; appsync_enumerate_usb_id = 0;
log_debug("handling enumeration timeout"); log_debug("handling enumeration timeout");
...@@ -427,6 +447,8 @@ static gboolean appsync_enumerate_usb_cb(gpointer data) ...@@ -427,6 +447,8 @@ static gboolean appsync_enumerate_usb_cb(gpointer data)
static void appsync_start_enumerate_usb_timer(void) static void appsync_start_enumerate_usb_timer(void)
{ {
LOG_REGISTER_CONTEXT;
log_debug("scheduling enumeration timeout"); log_debug("scheduling enumeration timeout");
if( appsync_enumerate_usb_id ) if( appsync_enumerate_usb_id )
g_source_remove(appsync_enumerate_usb_id), appsync_enumerate_usb_id = 0; g_source_remove(appsync_enumerate_usb_id), appsync_enumerate_usb_id = 0;
...@@ -441,6 +463,8 @@ static void appsync_start_enumerate_usb_timer(void) ...@@ -441,6 +463,8 @@ static void appsync_start_enumerate_usb_timer(void)
static void appsync_cancel_enumerate_usb_timer(void) static void appsync_cancel_enumerate_usb_timer(void)
{ {
LOG_REGISTER_CONTEXT;
if( appsync_enumerate_usb_id ) if( appsync_enumerate_usb_id )
{ {
log_debug("canceling enumeration timeout"); log_debug("canceling enumeration timeout");
...@@ -450,6 +474,8 @@ static void appsync_cancel_enumerate_usb_timer(void) ...@@ -450,6 +474,8 @@ static void appsync_cancel_enumerate_usb_timer(void)
static void appsync_enumerate_usb(void) static void appsync_enumerate_usb(void)
{ {
LOG_REGISTER_CONTEXT;
struct timeval tv; struct timeval tv;
log_debug("Enumerating"); log_debug("Enumerating");
...@@ -469,6 +495,8 @@ static void appsync_enumerate_usb(void) ...@@ -469,6 +495,8 @@ static void appsync_enumerate_usb(void)
void appsync_stop_apps(int post) void appsync_stop_apps(int post)
{ {
LOG_REGISTER_CONTEXT;
GList *iter = 0; GList *iter = 0;
for( iter = appsync_sync_list; iter; iter = g_list_next(iter) ) for( iter = appsync_sync_list; iter; iter = g_list_next(iter) )
...@@ -487,6 +515,8 @@ void appsync_stop_apps(int post) ...@@ -487,6 +515,8 @@ void appsync_stop_apps(int post)
int appsync_stop(gboolean force) int appsync_stop(gboolean force)
{ {
LOG_REGISTER_CONTEXT;
/* If force arg is used, stop all applications that /* If force arg is used, stop all applications that
* could have been started by usb-moded */ * could have been started by usb-moded */
if(force) if(force)
......
...@@ -68,6 +68,8 @@ gchar *common_get_mode_list (mode_list_type_t type); ...@@ -68,6 +68,8 @@ gchar *common_get_mode_list (mode_list_type_t type);
const char *cable_state_repr(cable_state_t state) const char *cable_state_repr(cable_state_t state)
{ {
LOG_REGISTER_CONTEXT;
static const char * const lut[CABLE_STATE_NUMOF] = { static const char * const lut[CABLE_STATE_NUMOF] = {
[CABLE_STATE_UNKNOWN] = "unknown", [CABLE_STATE_UNKNOWN] = "unknown",
[CABLE_STATE_DISCONNECTED] = "disconnected", [CABLE_STATE_DISCONNECTED] = "disconnected",
...@@ -159,6 +161,8 @@ static const modemapping_t common_modemapping[] = ...@@ -159,6 +161,8 @@ static const modemapping_t common_modemapping[] =
const char * const char *
common_map_mode_to_hardware(const char *internal_mode) common_map_mode_to_hardware(const char *internal_mode)
{ {
LOG_REGISTER_CONTEXT;
const char *hardware_mode = 0; const char *hardware_mode = 0;
for( size_t i = 0; common_modemapping[i].internal_mode; ++i ) { for( size_t i = 0; common_modemapping[i].internal_mode; ++i ) {
...@@ -173,6 +177,8 @@ common_map_mode_to_hardware(const char *internal_mode) ...@@ -173,6 +177,8 @@ common_map_mode_to_hardware(const char *internal_mode)
const char * const char *
common_map_mode_to_external(const char *internal_mode) common_map_mode_to_external(const char *internal_mode)
{ {
LOG_REGISTER_CONTEXT;
const char *external_mode = 0; const char *external_mode = 0;
for( size_t i = 0; common_modemapping[i].internal_mode; ++i ) { for( size_t i = 0; common_modemapping[i].internal_mode; ++i ) {
...@@ -192,6 +198,8 @@ common_map_mode_to_external(const char *internal_mode) ...@@ -192,6 +198,8 @@ common_map_mode_to_external(const char *internal_mode)
*/ */
void common_send_supported_modes_signal(void) void common_send_supported_modes_signal(void)
{ {
LOG_REGISTER_CONTEXT;
gchar *mode_list = common_get_mode_list(SUPPORTED_MODES_LIST); gchar *mode_list = common_get_mode_list(SUPPORTED_MODES_LIST);
umdbus_send_supported_modes_signal(mode_list); umdbus_send_supported_modes_signal(mode_list);
g_free(mode_list); g_free(mode_list);
...@@ -201,6 +209,8 @@ void common_send_supported_modes_signal(void) ...@@ -201,6 +209,8 @@ void common_send_supported_modes_signal(void)
*/ */
void common_send_available_modes_signal(void) void common_send_available_modes_signal(void)
{ {
LOG_REGISTER_CONTEXT;
gchar *mode_list = common_get_mode_list(AVAILABLE_MODES_LIST); gchar *mode_list = common_get_mode_list(AVAILABLE_MODES_LIST);
umdbus_send_available_modes_signal(mode_list); umdbus_send_available_modes_signal(mode_list);
g_free(mode_list); g_free(mode_list);
...@@ -210,6 +220,8 @@ void common_send_available_modes_signal(void) ...@@ -210,6 +220,8 @@ void common_send_available_modes_signal(void)
*/ */
void common_send_hidden_modes_signal(void) void common_send_hidden_modes_signal(void)
{ {
LOG_REGISTER_CONTEXT;
gchar *mode_list = config_get_hidden_modes(); gchar *mode_list = config_get_hidden_modes();
umdbus_send_hidden_modes_signal(mode_list); umdbus_send_hidden_modes_signal(mode_list);
g_free(mode_list); g_free(mode_list);
...@@ -219,6 +231,8 @@ void common_send_hidden_modes_signal(void) ...@@ -219,6 +231,8 @@ void common_send_hidden_modes_signal(void)
*/ */
void common_send_whitelisted_modes_signal(void) void common_send_whitelisted_modes_signal(void)
{ {
LOG_REGISTER_CONTEXT;
gchar *mode_list = config_get_mode_whitelist(); gchar *mode_list = config_get_mode_whitelist();
umdbus_send_whitelisted_modes_signal(mode_list); umdbus_send_whitelisted_modes_signal(mode_list);
g_free(mode_list); g_free(mode_list);
...@@ -237,6 +251,8 @@ void common_send_whitelisted_modes_signal(void) ...@@ -237,6 +251,8 @@ void common_send_whitelisted_modes_signal(void)
*/ */
static void common_write_to_sysfs_file(const char *path, const char *text) static void common_write_to_sysfs_file(const char *path, const char *text)
{ {
LOG_REGISTER_CONTEXT;
int fd = -1; int fd = -1;
if (!path || !text) if (!path || !text)
...@@ -276,6 +292,8 @@ EXIT: ...@@ -276,6 +292,8 @@ EXIT:
*/ */
void common_acquire_wakelock(const char *wakelock_name) void common_acquire_wakelock(const char *wakelock_name)
{ {
LOG_REGISTER_CONTEXT;
char buff[256]; char buff[256];
snprintf(buff, sizeof buff, "%s %lld", snprintf(buff, sizeof buff, "%s %lld",
wakelock_name, wakelock_name,
...@@ -293,6 +311,8 @@ void common_acquire_wakelock(const char *wakelock_name) ...@@ -293,6 +311,8 @@ void common_acquire_wakelock(const char *wakelock_name)
*/ */
void common_release_wakelock(const char *wakelock_name) void common_release_wakelock(const char *wakelock_name)
{ {
LOG_REGISTER_CONTEXT;
#if VERBOSE_WAKELOCKING #if VERBOSE_WAKELOCKING
log_debug("common_release_wakelock %s", wakelock_name); log_debug("common_release_wakelock %s", wakelock_name);
#endif #endif
...@@ -310,6 +330,8 @@ int ...@@ -310,6 +330,8 @@ int
common_system_(const char *file, int line, const char *func, common_system_(const char *file, int line, const char *func,
const char *command) const char *command)
{ {
LOG_REGISTER_CONTEXT;
log_debug("EXEC %s; from %s:%d: %s()", log_debug("EXEC %s; from %s:%d: %s()",
command, file, line, func); command, file, line, func);
...@@ -327,6 +349,8 @@ FILE * ...@@ -327,6 +349,8 @@ FILE *
common_popen_(const char *file, int line, const char *func, common_popen_(const char *file, int line, const char *func,
const char *command, const char *type) const char *command, const char *type)
{ {
LOG_REGISTER_CONTEXT;
log_debug("EXEC %s; from %s:%d: %s()", log_debug("EXEC %s; from %s:%d: %s()",
command, file, line, func); command, file, line, func);
...@@ -336,6 +360,8 @@ common_popen_(const char *file, int line, const char *func, ...@@ -336,6 +360,8 @@ common_popen_(const char *file, int line, const char *func,
waitres_t waitres_t
common_wait(unsigned tot_ms, bool (*ready_cb)(void *aptr), void *aptr) common_wait(unsigned tot_ms, bool (*ready_cb)(void *aptr), void *aptr)
{ {
LOG_REGISTER_CONTEXT;
struct timespec ts; struct timespec ts;
waitres_t res = WAIT_FAILED; waitres_t res = WAIT_FAILED;
...@@ -384,6 +410,8 @@ EXIT: ...@@ -384,6 +410,8 @@ EXIT:
bool bool
common_msleep_(const char *file, int line, const char *func, unsigned msec) common_msleep_(const char *file, int line, const char *func, unsigned msec)
{ {
LOG_REGISTER_CONTEXT;
log_debug("SLEEP %u.%03u seconds; from %s:%d: %s()", log_debug("SLEEP %u.%03u seconds; from %s:%d: %s()",
msec / 1000u, msec % 1000u,file, line, func); msec / 1000u, msec % 1000u,file, line, func);
return common_wait(msec, 0, 0) == WAIT_TIMEOUT; return common_wait(msec, 0, 0) == WAIT_TIMEOUT;
...@@ -396,6 +424,8 @@ common_msleep_(const char *file, int line, const char *func, unsigned msec) ...@@ -396,6 +424,8 @@ common_msleep_(const char *file, int line, const char *func, unsigned msec)
/* check if a mode is in a list */ /* check if a mode is in a list */
static bool common_mode_in_list(const char *mode, char * const *modes) static bool common_mode_in_list(const char *mode, char * const *modes)
{ {
LOG_REGISTER_CONTEXT;
int i; int i;
if (!modes) if (!modes)
...@@ -417,6 +447,8 @@ static bool common_mode_in_list(const char *mode, char * const *modes) ...@@ -417,6 +447,8 @@ static bool common_mode_in_list(const char *mode, char * const *modes)
*/ */
int common_valid_mode(const char *mode) int common_valid_mode(const char *mode)
{ {
LOG_REGISTER_CONTEXT;
int valid = 1; int valid = 1;
/* MODE_ASK, MODE_CHARGER and MODE_CHARGING_FALLBACK are not modes that are settable seen their special 'internal' status /* MODE_ASK, MODE_CHARGER and MODE_CHARGING_FALLBACK are not modes that are settable seen their special 'internal' status
* so we only check the modes that are announed outside. Only exception is the built in MODE_CHARGING */ * so we only check the modes that are announed outside. Only exception is the built in MODE_CHARGING */
...@@ -455,6 +487,8 @@ int common_valid_mode(const char *mode) ...@@ -455,6 +487,8 @@ int common_valid_mode(const char *mode)
*/ */
gchar *common_get_mode_list(mode_list_type_t type) gchar *common_get_mode_list(mode_list_type_t type)
{ {
LOG_REGISTER_CONTEXT;
GString *mode_list_str = g_string_new(NULL); GString *mode_list_str = g_string_new(NULL);
gchar *hidden_modes_value = 0; gchar *hidden_modes_value = 0;
......
This diff is collapsed.
...@@ -112,6 +112,8 @@ static int configfs_probed = -1; ...@@ -112,6 +112,8 @@ static int configfs_probed = -1;
static int configfs_file_type(const char *path) static int configfs_file_type(const char *path)
{ {
LOG_REGISTER_CONTEXT;
int type = -1; int type = -1;
if( !path ) if( !path )
...@@ -130,6 +132,8 @@ EXIT: ...@@ -130,6 +132,8 @@ EXIT:
static const char * static const char *
configfs_function_path(char *buff, size_t size, const char *func, ...) configfs_function_path(char *buff, size_t size, const char *func, ...)
{ {
LOG_REGISTER_CONTEXT;
char *pos = buff; char *pos = buff;
char *end = buff + size; char *end = buff + size;
...@@ -150,12 +154,16 @@ configfs_function_path(char *buff, size_t size, const char *func, ...) ...@@ -150,12 +154,16 @@ configfs_function_path(char *buff, size_t size, const char *func, ...)
static const char * static const char *
configfs_unit_path(char *buff, size_t size, const char *func, const char *unit) configfs_unit_path(char *buff, size_t size, const char *func, const char *unit)
{ {
LOG_REGISTER_CONTEXT;
return configfs_function_path(buff, size, func, unit, NULL); return configfs_function_path(buff, size, func, unit, NULL);
} }
static const char * static const char *
configfs_config_path(char *buff, size_t size, const char *func) configfs_config_path(char *buff, size_t size, const char *func)
{ {
LOG_REGISTER_CONTEXT;
snprintf(buff, size, "%s/%s", CONFIGFS_CONFIG, func); snprintf(buff, size, "%s/%s", CONFIGFS_CONFIG, func);
return buff; return buff;
} }
...@@ -163,6 +171,8 @@ configfs_config_path(char *buff, size_t size, const char *func) ...@@ -163,6 +171,8 @@ configfs_config_path(char *buff, size_t size, const char *func)
static bool static bool
configfs_mkdir(const char *path) configfs_mkdir(const char *path)
{