From: David Goulet Date: Tue, 23 Aug 2011 18:24:42 +0000 (-0400) Subject: Cleanup comments and bad indent X-Git-Tag: v2.0-pre12~7 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=050349bbb362ea993533591532643022efeab864;hp=809dc2811860434a76e4f10cb9f05d938148090c Cleanup comments and bad indent Signed-off-by: David Goulet --- diff --git a/ltt-sessiond/kernel-ctl.c b/ltt-sessiond/kernel-ctl.c index 3879c2bbb..5c452ca92 100644 --- a/ltt-sessiond/kernel-ctl.c +++ b/ltt-sessiond/kernel-ctl.c @@ -29,9 +29,7 @@ #include "kernel-ctl.h" /* - * kernel_add_channel_context - * - * Add context on a kernel channel. + * Add context on a kernel channel. */ int kernel_add_channel_context(struct ltt_kernel_channel *chan, struct lttng_kernel_context *ctx) @@ -65,9 +63,7 @@ error: } /* - * kernel_add_event_context - * - * Add context on a kernel event. + * Add context on a kernel event. */ int kernel_add_event_context(struct ltt_kernel_event *event, struct lttng_kernel_context *ctx) @@ -96,10 +92,8 @@ error: } /* - * kernel_create_session - * - * Create a new kernel session, register it to the kernel tracer and add it to - * the session daemon session. + * Create a new kernel session, register it to the kernel tracer and add it to + * the session daemon session. */ int kernel_create_session(struct ltt_session *session, int tracer_fd) { @@ -139,12 +133,11 @@ error: } /* - * kernel_create_channel - * - * Create a kernel channel, register it to the kernel tracer and add it to the - * kernel session. + * Create a kernel channel, register it to the kernel tracer and add it to the + * kernel session. */ -int kernel_create_channel(struct ltt_kernel_session *session, struct lttng_channel *chan, char *path) +int kernel_create_channel(struct ltt_kernel_session *session, + struct lttng_channel *chan, char *path) { int ret; struct ltt_kernel_channel *lkc; @@ -184,12 +177,11 @@ error: } /* - * kernel_create_event - * - * Create a kernel event, enable it to the kernel tracer and add it to the - * channel event list of the kernel session. + * Create a kernel event, enable it to the kernel tracer and add it to the + * channel event list of the kernel session. */ -int kernel_create_event(struct lttng_event *ev, struct ltt_kernel_channel *channel) +int kernel_create_event(struct lttng_event *ev, + struct ltt_kernel_channel *channel) { int ret; struct ltt_kernel_event *event; @@ -227,9 +219,7 @@ error: } /* - * kernel_disable_channel - * - * Disable a kernel channel. + * Disable a kernel channel. */ int kernel_disable_channel(struct ltt_kernel_channel *chan) { @@ -252,9 +242,7 @@ error: } /* - * kernel_enable_channel - * - * Enable a kernel channel. + * Enable a kernel channel. */ int kernel_enable_channel(struct ltt_kernel_channel *chan) { @@ -277,9 +265,7 @@ error: } /* - * kernel_enable_event - * - * Enable a kernel event. + * Enable a kernel event. */ int kernel_enable_event(struct ltt_kernel_event *event) { @@ -304,9 +290,7 @@ error: } /* - * kernel_disable_event - * - * Disable a kernel event. + * Disable a kernel event. */ int kernel_disable_event(struct ltt_kernel_event *event) { @@ -328,10 +312,8 @@ error: } /* - * kernel_open_metadata - * - * Create kernel metadata, open from the kernel tracer and add it to the - * kernel session. + * Create kernel metadata, open from the kernel tracer and add it to the + * kernel session. */ int kernel_open_metadata(struct ltt_kernel_session *session, char *path) { @@ -368,9 +350,7 @@ error: } /* - * kernel_start_session - * - * Start tracing session. + * Start tracing session. */ int kernel_start_session(struct ltt_kernel_session *session) { @@ -391,9 +371,7 @@ error: } /* - * kernel_wait_quiescent - * - * Make a kernel wait to make sure in-flight probe have completed. + * Make a kernel wait to make sure in-flight probe have completed. */ void kernel_wait_quiescent(int fd) { @@ -409,7 +387,7 @@ void kernel_wait_quiescent(int fd) } /* - * kernel_calibrate + * Kernel calibrate */ int kernel_calibrate(int fd, struct lttng_kernel_calibrate *calibrate) { @@ -426,8 +404,6 @@ int kernel_calibrate(int fd, struct lttng_kernel_calibrate *calibrate) /* - * kernel_metadata_flush_buffer - * * Force flush buffer of metadata. */ int kernel_metadata_flush_buffer(int fd) @@ -443,9 +419,7 @@ int kernel_metadata_flush_buffer(int fd) } /* - * kernel_flush_buffer - * - * Force flush buffer for channel. + * Force flush buffer for channel. */ int kernel_flush_buffer(struct ltt_kernel_channel *channel) { @@ -468,9 +442,7 @@ int kernel_flush_buffer(struct ltt_kernel_channel *channel) } /* - * kernel_stop_session - * - * Stop tracing session. + * Stop tracing session. */ int kernel_stop_session(struct ltt_kernel_session *session) { @@ -490,12 +462,10 @@ error: } /* - * kernel_open_channel_stream + * Open stream of channel, register it to the kernel tracer and add it + * to the stream list of the channel. * - * Open stream of channel, register it to the kernel tracer and add it - * to the stream list of the channel. - * - * Return the number of created stream. Else, a negative value. + * Return the number of created stream. Else, a negative value. */ int kernel_open_channel_stream(struct ltt_kernel_channel *channel) { @@ -538,9 +508,7 @@ error: } /* - * kernel_open_metadata_stream - * - * Open the metadata stream and set it to the kernel session. + * Open the metadata stream and set it to the kernel session. */ int kernel_open_metadata_stream(struct ltt_kernel_session *session) { diff --git a/ltt-sessiond/kernel-ctl.h b/ltt-sessiond/kernel-ctl.h index df0cca2af..a78173953 100644 --- a/ltt-sessiond/kernel-ctl.h +++ b/ltt-sessiond/kernel-ctl.h @@ -8,7 +8,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -24,11 +24,12 @@ /* * Default size for the event list when kernel_list_events is called. This size - * value is based on the initial LTTng 2.0 version set of tracepoints. This is - * NOT an upper bound because if the real event list size is bigger, dynamic - * reallocation is performed. + * value is based on the initial LTTng 2.0 version set of tracepoints. + * + * This is NOT an upper bound because if the real event list size is bigger, + * dynamic reallocation is performed. */ -#define KERNEL_EVENT_LIST_SIZE 2000 +#define KERNEL_EVENT_LIST_SIZE 80 int kernel_add_channel_context(struct ltt_kernel_channel *chan, struct lttng_kernel_context *ctx); diff --git a/ltt-sessiond/ltt-sessiond.h b/ltt-sessiond/ltt-sessiond.h index acdc9724b..2b09a06ba 100644 --- a/ltt-sessiond/ltt-sessiond.h +++ b/ltt-sessiond/ltt-sessiond.h @@ -8,7 +8,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -19,10 +19,10 @@ #ifndef _LTT_SESSIOND_H #define _LTT_SESSIOND_H -#define DEFAULT_HOME_DIR "/tmp" -#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks" -#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global" -#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng" +#define DEFAULT_HOME_DIR "/tmp" +#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks" +#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global" +#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng" struct module_param { const char *name; diff --git a/ltt-sessiond/session.c b/ltt-sessiond/session.c index 3131006f1..1ffe1d8e7 100644 --- a/ltt-sessiond/session.c +++ b/ltt-sessiond/session.c @@ -8,7 +8,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -49,11 +49,9 @@ static struct ltt_session_list ltt_session_list = { }; /* - * add_session_list + * Add a ltt_session structure to the global list. * - * Add a ltt_session structure to the global list. - * - * The caller MUST acquire the session list lock before. + * The caller MUST acquire the session list lock before. */ static void add_session_list(struct ltt_session *ls) { @@ -62,11 +60,9 @@ static void add_session_list(struct ltt_session *ls) } /* - * del_session_list - * - * Delete a ltt_session structure to the global list. + * Delete a ltt_session structure to the global list. * - * The caller MUST acquire the session list lock before. + * The caller MUST acquire the session list lock before. */ static void del_session_list(struct ltt_session *ls) { @@ -78,9 +74,7 @@ static void del_session_list(struct ltt_session *ls) } /* - * get_session_list - * - * Return a pointer to the session list. + * Return a pointer to the session list. */ struct ltt_session_list *get_session_list(void) { @@ -120,10 +114,8 @@ void unlock_session(struct ltt_session *session) } /* - * find_session_by_name - * - * Return a ltt_session structure ptr that matches name. - * If no session found, NULL is returned. + * Return a ltt_session structure ptr that matches name. + * If no session found, NULL is returned. */ struct ltt_session *find_session_by_name(char *name) { @@ -147,11 +139,9 @@ struct ltt_session *find_session_by_name(char *name) } /* - * destroy_session - * - * Delete session from the session list and free the memory. + * Delete session from the session list and free the memory. * - * Return -1 if no session is found. On success, return 1; + * Return -1 if no session is found. On success, return 1; */ int destroy_session(char *name) { @@ -177,9 +167,7 @@ int destroy_session(char *name) } /* - * create_session - * - * Create a brand new session and add it to the session list. + * Create a brand new session and add it to the session list. */ int create_session(char *name, char *path) { diff --git a/ltt-sessiond/session.h b/ltt-sessiond/session.h index dad0cd929..d87b54daa 100644 --- a/ltt-sessiond/session.h +++ b/ltt-sessiond/session.h @@ -19,7 +19,6 @@ #ifndef _LTT_SESSION_H #define _LTT_SESSION_H -//#include #include /* diff --git a/ltt-sessiond/trace.c b/ltt-sessiond/trace.c index 621e4dd3f..0ae80adbc 100644 --- a/ltt-sessiond/trace.c +++ b/ltt-sessiond/trace.c @@ -27,9 +27,7 @@ #include "trace.h" /* - * get_kernel_channel_by_name - * - * Find the channel name for the given kernel session. + * Find the channel name for the given kernel session. */ struct ltt_kernel_channel *get_kernel_channel_by_name( char *name, struct ltt_kernel_session *session) @@ -53,9 +51,7 @@ error: } /* - * get_kernel_event_by_name - * - * Find the event name for the given channel. + * Find the event name for the given channel. */ struct ltt_kernel_event *get_kernel_event_by_name( char *name, struct ltt_kernel_channel *channel) @@ -80,11 +76,9 @@ error: } /* - * trace_create_kernel_session - * - * Allocate and initialize a kernel session data structure. + * Allocate and initialize a kernel session data structure. * - * Return pointer to structure or NULL. + * Return pointer to structure or NULL. */ struct ltt_kernel_session *trace_create_kernel_session(void) { @@ -113,11 +107,9 @@ error: } /* - * trace_create_kernel_channel + * Allocate and initialize a kernel channel data structure. * - * Allocate and initialize a kernel channel data structure. - * - * Return pointer to structure or NULL. + * Return pointer to structure or NULL. */ struct ltt_kernel_channel *trace_create_kernel_channel(struct lttng_channel *chan, char *path) { @@ -159,11 +151,9 @@ error: } /* - * trace_create_kernel_event - * - * Allocate and initialize a kernel event. Set name and event type. + * Allocate and initialize a kernel event. Set name and event type. * - * Return pointer to structure or NULL. + * Return pointer to structure or NULL. */ struct ltt_kernel_event *trace_create_kernel_event(struct lttng_event *ev) { @@ -226,11 +216,9 @@ error: } /* - * trace_create_kernel_metadata + * Allocate and initialize a kernel metadata. * - * Allocate and initialize a kernel metadata. - * - * Return pointer to structure or NULL. + * Return pointer to structure or NULL. */ struct ltt_kernel_metadata *trace_create_kernel_metadata(char *path) { @@ -270,12 +258,10 @@ error: } /* - * trace_create_kernel_stream - * - * Allocate and initialize a kernel stream. The stream is set to ACTIVE_FD by - * default. + * Allocate and initialize a kernel stream. The stream is set to ACTIVE_FD by + * default. * - * Return pointer to structure or NULL. + * Return pointer to structure or NULL. */ struct ltt_kernel_stream *trace_create_kernel_stream(void) { @@ -298,6 +284,9 @@ error: return NULL; } +/* + * Cleanup kernel stream structure. + */ void trace_destroy_kernel_stream(struct ltt_kernel_stream *stream) { DBG("[trace] Closing stream fd %d", stream->fd); @@ -310,6 +299,9 @@ void trace_destroy_kernel_stream(struct ltt_kernel_stream *stream) free(stream); } +/* + * Cleanup kernel event structure. + */ void trace_destroy_kernel_event(struct ltt_kernel_event *event) { DBG("[trace] Closing event fd %d", event->fd); @@ -323,6 +315,9 @@ void trace_destroy_kernel_event(struct ltt_kernel_event *event) free(event); } +/* + * Cleanup kernel channel structure. + */ void trace_destroy_kernel_channel(struct ltt_kernel_channel *channel) { struct ltt_kernel_stream *stream, *stmp; @@ -350,6 +345,9 @@ void trace_destroy_kernel_channel(struct ltt_kernel_channel *channel) free(channel); } +/* + * Cleanup kernel metadata structure. + */ void trace_destroy_kernel_metadata(struct ltt_kernel_metadata *metadata) { DBG("[trace] Closing metadata fd %d", metadata->fd); @@ -361,6 +359,9 @@ void trace_destroy_kernel_metadata(struct ltt_kernel_metadata *metadata) free(metadata); } +/* + * Cleanup kernel session structure + */ void trace_destroy_kernel_session(struct ltt_kernel_session *session) { struct ltt_kernel_channel *channel, *ctmp; diff --git a/ltt-sessiond/trace.h b/ltt-sessiond/trace.h index 9255bc932..ac070908a 100644 --- a/ltt-sessiond/trace.h +++ b/ltt-sessiond/trace.h @@ -107,9 +107,6 @@ struct ltt_ust_marker { char *channel; }; -/* - * Get functions. - */ struct ltt_kernel_event *get_kernel_event_by_name( char *name, struct ltt_kernel_channel *channel); struct ltt_kernel_channel *get_kernel_channel_by_name( diff --git a/ltt-sessiond/traceable-app.c b/ltt-sessiond/traceable-app.c index 52cfb0f0d..cce8a5827 100644 --- a/ltt-sessiond/traceable-app.c +++ b/ltt-sessiond/traceable-app.c @@ -42,10 +42,8 @@ static void add_traceable_app(struct ltt_traceable_app *lta); static void del_traceable_app(struct ltt_traceable_app *lta); /* - * add_traceable_app - * - * Add a traceable application structure to the global - * list protected by a mutex. + * Add a traceable application structure to the global list protected by a + * mutex. */ static void add_traceable_app(struct ltt_traceable_app *lta) { @@ -56,10 +54,8 @@ static void add_traceable_app(struct ltt_traceable_app *lta) } /* - * del_traceable_app - * - * Delete a traceable application structure from the - * global list protected by a mutex. + * Delete a traceable application structure from the global list protected by a + * mutex. */ static void del_traceable_app(struct ltt_traceable_app *lta) { @@ -73,13 +69,10 @@ static void del_traceable_app(struct ltt_traceable_app *lta) } /* - * register_traceable_app + * Using pid and uid (of the app), allocate a new ltt_traceable_app struct and + * add it to the global traceable app list. * - * Using pid and uid (of the app), allocate - * a new ltt_traceable_app struct and add it - * to the global traceable app list. - * - * On success, return 0, else return malloc ENOMEM. + * On success, return 0, else return malloc ENOMEM. */ int register_traceable_app(pid_t pid, uid_t uid) { @@ -100,10 +93,8 @@ int register_traceable_app(pid_t pid, uid_t uid) } /* - * unregister_traceable_app - * - * Unregister app by removing it from the global - * traceable app list and freeing the data struct. + * Unregister app by removing it from the global traceable app list and freeing + * the data struct. */ void unregister_traceable_app(pid_t pid) { @@ -118,9 +109,7 @@ void unregister_traceable_app(pid_t pid) } /* - * get_app_count - * - * Return traceable_app_count + * Return traceable_app_count */ unsigned int get_app_count(void) { @@ -128,10 +117,8 @@ unsigned int get_app_count(void) } /* - * find_app_by_pid - * - * Iterate over the traceable apps list and - * return a pointer or NULL if not found. + * Iterate over the traceable apps list and return a pointer or NULL if not + * found. */ struct ltt_traceable_app *find_app_by_pid(pid_t pid) { @@ -151,10 +138,7 @@ struct ltt_traceable_app *find_app_by_pid(pid_t pid) } /* - * get_app_list_pids - * - * List traceable user-space application and fill an - * array of pids. + * List traceable user-space application and fill an array of pids. */ void get_app_list_pids(pid_t *pids) { diff --git a/ltt-sessiond/traceable-app.h b/ltt-sessiond/traceable-app.h index 364e70598..4a9e11493 100644 --- a/ltt-sessiond/traceable-app.h +++ b/ltt-sessiond/traceable-app.h @@ -24,9 +24,8 @@ struct ltt_traceable_app_list { struct cds_list_head head; }; -/* Registered traceable applications. Libust registers - * to the session daemon and a linked list is kept - * of all running traceable app. +/* Registered traceable applications. Libust registers to the session daemon + * and a linked list is kept of all running traceable app. */ struct ltt_traceable_app { struct cds_list_head list; diff --git a/ltt-sessiond/utils.c b/ltt-sessiond/utils.c index 5b8e31b8d..6b22d9693 100644 --- a/ltt-sessiond/utils.c +++ b/ltt-sessiond/utils.c @@ -30,10 +30,9 @@ #include "utils.h" /* - * get_home_dir + * Return pointer to home directory path using the env variable HOME. * - * Return pointer to home directory path using the env variable HOME. - * No home, NULL is returned. + * No home, NULL is returned. */ const char *get_home_dir(void) { @@ -41,9 +40,7 @@ const char *get_home_dir(void) } /* - * mkdir_recursive - * - * Create recursively directory using the FULL path. + * Create recursively directory using the FULL path. */ int mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid) { @@ -76,9 +73,8 @@ int mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid) } } else if (ret == 0) { /* - * We created the directory. Set its - * ownership to the user/group - * specified. + * We created the directory. Set its ownership to the + * user/group specified. */ ret = chown(tmp, uid, gid); if (ret < 0) { @@ -96,8 +92,8 @@ int mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid) ret = -errno; } else if (ret == 0) { /* - * We created the directory. Set its ownership to the - * user/group specified. + * We created the directory. Set its ownership to the user/group + * specified. */ ret = chown(tmp, uid, gid); if (ret < 0) { diff --git a/ltt-sessiond/utils.h b/ltt-sessiond/utils.h index 41aad2557..4da5f498e 100644 --- a/ltt-sessiond/utils.h +++ b/ltt-sessiond/utils.h @@ -5,25 +5,24 @@ * Copyright (C) 2011 - David Goulet * Copyright (C) 2011 - Mathieu Desnoyers * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; only version 2 - * of the License. + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; only version 2 of the License. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / (sizeof((array)[0]))) +#define ARRAY_SIZE(array) (sizeof(array) / (sizeof((array)[0]))) #endif int mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid);