+/**
+ * parser/cpu_ctrl.c
+ * @author Vasiliy Ulyanov <v.ulyanov@samsung.com>
+ *
+ * @section 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * @section COPYRIGHT
+ *
+ * Copyright (C) Samsung Electronics, 2014
+ *
+ * @section DESCRIPTION
+ *
+ * CPU controls implementation.
+ */
+
#include <linux/cpumask.h>
#include <linux/cpu.h>
#include <ksyms/ksyms.h>
static int (*swap_cpu_down)(unsigned int, int);
static int (*swap_cpu_up)(unsigned int, int);
+/**
+ * @brief Disables nonboot CPUs lock.
+ *
+ * @param mask Pointer to CPU mask struct.
+ * @return 0 on success, error code on error.
+ */
int swap_disable_nonboot_cpus_lock(struct cpumask *mask)
{
int boot_cpu, cpu;
return ret;
}
+/**
+ * @brief Enables nonboot CPUs unlock.
+ *
+ * @param mask Pointer to CPU mask struct.
+ * @return 0 on success, error code on error.
+ */
int swap_enable_nonboot_cpus_unlock(struct cpumask *mask)
{
int cpu, ret = 0;
return ret;
}
+/**
+ * @brief Intializes CPU controls.
+ *
+ * @return 0 on success, error code on error.
+ */
int init_cpu_deps(void)
{
const char *sym = "cpu_maps_update_begin";
+/**
+ * @file parser/cpu_ctrl.h
+ * @author Vasiliy Ulyanov <v.ulyanov@samsung.com>
+ *
+ * @section 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * @section COPYRIGHT
+ *
+ * Copyright (C) Samsung Electronics, 2014
+ *
+ * @section DESCRIPTION
+ *
+ * CPU controls interface.
+ */
+
#ifndef _CPU_CTRL_H_
#define _CPU_CTRL_H_
-/*
- * SWAP Parser
- * modules/parser/features.c
+/**
+ * parser/features.c
+ * @author Vyacheslav Cherkashin
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Features control implementation.
*/
#include <sampler/swap_sampler_module.h>
#include <energy/energy.h>
+/**
+ * @enum features_list
+ * List of supported features.
+ */
enum features_list {
- syscall_file = (1 << 10), /* File operation syscalls tracing */
- syscall_ipc = (1 << 11), /* IPC syscall tracing */
- syscall_process = (1 << 12), /* Process syscalls tracing */
- syscall_signal = (1 << 13), /* Signal syscalls tracing */
- syscall_network = (1 << 14), /* Network syscalls tracing */
- syscall_desc = (1 << 15), /* Descriptor syscalls tracing */
- context_switch = (1 << 16), /* Context switch tracing */
- func_sampling = (1 << 19) /* Function sampling */
+ syscall_file = (1 << 10), /**< File operation syscalls tracing */
+ syscall_ipc = (1 << 11), /**< IPC syscall tracing */
+ syscall_process = (1 << 12), /**< Process syscalls tracing */
+ syscall_signal = (1 << 13), /**< Signal syscalls tracing */
+ syscall_network = (1 << 14), /**< Network syscalls tracing */
+ syscall_desc = (1 << 15), /**< Descriptor syscalls tracing */
+ context_switch = (1 << 16), /**< Context switch tracing */
+ func_sampling = (1 << 19) /**< Function sampling */
};
+/**
+ * @brief Start user-space instrumentation event handling.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return 0.
+ */
int set_us_inst(struct conf_data *conf)
{
set_quiet(QT_OFF);
return 0;
}
+/**
+ * @brief Stop user-space instrumentation event handling.
+ *
+ * @return 0.
+ */
int unset_us_inst(void)
{
set_quiet(QT_ON);
return 0;
}
+/**
+ * @brief Set syscall file feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_syscall_file(struct conf_data *conf)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall file feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_syscall_file(void)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall ipc feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_syscall_ipc(struct conf_data *conf)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall ipc feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_syscall_ipc(void)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall process feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_syscall_process(struct conf_data *conf)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall process feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_syscall_process(void)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall signal feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_syscall_signal(struct conf_data *conf)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall signal feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_syscall_signal(void)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall network feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_syscall_network(struct conf_data *conf)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall network feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_syscall_network(void)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall desc feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_syscall_desc(struct conf_data *conf)
{
int ret;
return ret;
}
+/**
+ * @brief Set syscall desc feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_syscall_desc(void)
{
int ret;
return ret;
}
+/**
+ * @brief Set context switch feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_context_switch(struct conf_data *conf)
{
int ret;
return ret;
}
-
+/**
+ * @brief Set context switch feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_context_switch(void)
{
int ret;
return ret;
}
+/**
+ * @brief Set sampling feature on.
+ *
+ * @param conf Pointer to conf_data config.
+ * @return set_feature results.
+ */
int set_func_sampling(struct conf_data *conf)
{
int ret;
return ret;
}
+/**
+ * @brief Set sampling feature off.
+ *
+ * @return unset_feature results.
+ */
int unset_func_sampling(void)
{
int ret;
return unset_energy();
}
+/**
+ * @struct feature_item
+ * @brief Struct that describes feature.
+ * @var feature_item::name
+ * Feature name.
+ * @var feature_item::set
+ * Set feature callback.
+ * @var feature_item::unset
+ * Unset feature callback.
+ */
struct feature_item {
char *name;
int (*set)(struct conf_data *conf);
/* 26 */ &feature_func_energy
};
+/**
+ * @brief SIZE_FEATURE_LIST definition.
+ */
enum {
SIZE_FEATURE_LIST = sizeof(feature_list) / sizeof(struct feature_item *),
};
static u64 feature_inst = 0;
static u64 feature_mask = 0;
+/**
+ * @brief Inits features list.
+ *
+ * @return 0.
+ */
int init_features(void)
{
int i;
return 0;
}
+/**
+ * @brief Uninits features list.
+ *
+ * @return Void.
+ */
void uninit_features(void)
{
}
static DEFINE_MUTEX(mutex_features);
+/**
+ * @brief Wrapper for do_set_features with locking.
+ *
+ * @param conf Pointer to the current config.
+ * @return do_set_features result.
+ */
int set_features(struct conf_data *conf)
{
int ret;
-/*
- * SWAP Parser
- * modules/parser/features.h
+/**
+ * @file parser/features.h
+ * @author Vyacheslav Cherkashin
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Features control interface declaration.
*/
-/*
- * SWAP Parser
- * modules/parser/msg_buf.c
+/**
+ * parser/msg_buf.c
+ * @author Vyacheslav Cherkashin
+ * @author Vitaliy Cherepanov
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin, Vitaliy Cherepanov: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Message buffer controls implementation.
*/
#include "msg_buf.h"
#include "parser_defs.h"
+/**
+ * @brief Initializes message buffer.
+ *
+ * @param mb Pointer to message buffer struct.
+ * @param size Size of the message buffer.
+ * @return 0 on success, negative error code on error.
+ */
int init_mb(struct msg_buf *mb, size_t size)
{
if (size) {
return 0;
}
+/**
+ * @brief Uninitializes message buffer.
+ *
+ * @param mb Pointer to message buffer struct.
+ * @return Void.
+ */
void uninit_mb(struct msg_buf *mb)
{
vfree(mb->begin);
}
+/**
+ * @brief Checks if current buffer data pointer is at the end.
+ *
+ * @param mb Pointer to the message buffer struct.
+ * @param size Size of the message buffer.
+ * @return 1 - buffer ptr is not at the end,
+ * 0 - buffer ptr is at the end,
+ * -1 - buffer ptr is invalid (far away of the end).
+ */
int cmp_mb(struct msg_buf *mb, size_t size)
{
char *tmp;
return 0;
}
+/**
+ * @brief Gets remainder part of message buffer.
+ *
+ * @param mb Pointer to the message buffer struct.
+ * @return Remainder part of message buffer.
+ */
size_t remained_mb(struct msg_buf *mb)
{
return mb->end - mb->ptr;
}
+/**
+ * @brief Checks whether we reached the end of the message buffer or not.
+ *
+ * @param mb Pointer to the message buffer struct.
+ * @return 1 - if message buffer end has been reached \n
+ * 0 - otherwise.
+ */
int is_end_mb(struct msg_buf *mb)
{
return mb->ptr == mb->end;
}
+/**
+ * @brief Reads 8 bits from message buffer and updates buffer's pointer.
+ *
+ * @param mb Pointer to the message buffer struct.
+ * @param val Pointer to the target variable where to put read value.
+ * @return 0 on success, negative error code on error.
+ */
int get_u8(struct msg_buf *mb, u8 *val)
{
if (cmp_mb(mb, sizeof(*val)) < 0)
return 0;
}
+/**
+ * @brief Reads 32 bits from message buffer and updates buffer's pointer.
+ *
+ * @param mb Pointer to the message buffer struct.
+ * @param val Pointer to the target variable where to put read value.
+ * @return 0 on success, negative error code on error.
+ */
int get_u32(struct msg_buf *mb, u32 *val)
{
if (cmp_mb(mb, sizeof(*val)) < 0)
return 0;
}
+/**
+ * @brief Reads 64 bits from message buffer and updates buffer's pointer.
+ *
+ * @param mb Pointer to the message buffer struct.
+ * @param val Pointer to the target variable where to put read value.
+ * @return 0 on success, negative error code on error.
+ */
int get_u64(struct msg_buf *mb, u64 *val)
{
if (cmp_mb(mb, sizeof(*val)) < 0)
return 0;
}
+/**
+ * @brief Reads null-terminated string from message buffer and updates
+ * buffer's pointer.
+ *
+ * @param mb Pointer to the message buffer struct.
+ * @param str Pointer to the target variable where to put read string.
+ * @return 0 on success, negative error code on error.
+ */
int get_string(struct msg_buf *mb, char **str)
{
size_t len, len_max;
return 0;
}
+/**
+ * @brief Releases string memory allocated in get_string.
+ *
+ * @param str Pointer to the target string.
+ * @return Void.
+ */
void put_string(char *str)
{
kfree(str);
-/*
- * SWAP Parser
- * modules/parser/msg_buf.c
+/**
+ * @file parser/msg_buf.h
+ * @author Vyacheslav Cherkashin
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Message buffer interface declaration.
*/
#include <linux/types.h>
+/**
+ * @struct msg_buf
+ * @brief Stores pointers to the message buffer.
+ */
struct msg_buf {
- char *begin;
- char *end;
- char *ptr;
+ char *begin; /**< Pointer to the beginning of the buffer. */
+ char *end; /**< Pointer to the end of the buffer. */
+ char *ptr; /**< Buffer iterator. */
};
int init_mb(struct msg_buf *mb, size_t size);
-/*
- * SWAP Parser
- * modules/parser/msg_cmd.c
+/**
+ * parser/msg_cmd.c
+ * @author Vyacheslav Cherkashin
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Module's messages parsing implementation.
*/
return ret;
}
+/**
+ * @brief Message "keep alive" handling.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return 0 on success, negative error code on error.
+ */
int msg_keep_alive(struct msg_buf *mb)
{
if (!is_end_mb(mb)) {
return 0;
}
+/**
+ * @brief Message "start" handling.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return 0 on success, negative error code on error.
+ */
int msg_start(struct msg_buf *mb)
{
int ret = 0;
return ret;
}
+/**
+ * @brief Message "stop" handling.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return 0 on success, negative error code on error.
+ */
int msg_stop(struct msg_buf *mb)
{
int ret = 0;
return ret;
}
+/**
+ * @brief Message "config" handling.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return 0 on success, negative error code on error.
+ */
int msg_config(struct msg_buf *mb)
{
int ret = 0;
return ret;
}
+/**
+ * @brief Message "swap inst add" handling.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return 0 on success, negative error code on error.
+ */
int msg_swap_inst_add(struct msg_buf *mb)
{
int ret = 0;
return ret;
}
+/**
+ * @brief Message "swap inst remove" handling.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return 0 on success, negative error code on error.
+ */
int msg_swap_inst_remove(struct msg_buf *mb)
{
int ret = 0;
return ret;
}
+/**
+ * @brief Initializes commands handling.
+ *
+ * @return Initialization results.
+ */
int init_cmd(void)
{
int ret;
return ret;
}
+/**
+ * @brief Uninitializes commands handling.
+ *
+ * @return Void.
+ */
void uninit_cmd(void)
{
uninit_features();
-/*
- * SWAP Parser
- * modules/parser/msg_cmd.c
+/**
+ * @file parser/msg_cmd.h
+ * @author Vyacheslav Cherkashin
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Module's message handling interface declaration.
*/
#ifndef _MSG_CMD_H
-/*
- * SWAP Parser
- * modules/parser/msg_parser.c
+/**
+ * parser/msg_parser.c
+ * @author Vyacheslav Cherkashin
+ * @author Vitaliy Cherepanov
+ *
+ * @sectionLICENSE
*
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin, Vitaliy Cherepanov: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Message parsing implementation.
*/
* == APP_INFO ==
* ============================================================================
*/
+
+/**
+ * @brief Creates and fills app_info_data struct.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return Pointer to the filled app_info_data struct on success;\n
+ * NULL on error.
+ */
struct app_info_data *create_app_info(struct msg_buf *mb)
{
int ret;
return NULL;
}
+/**
+ * @brief app_info_data cleanup.
+ *
+ * @param ai Pointer to the target app_info_data.
+ * @return Void.
+ */
void destroy_app_info(struct app_info_data *ai)
{
put_string(ai->exec_path);
* == CONFIG ==
* ============================================================================
*/
+
+/**
+ * @brief Creates and fills conf_data struct.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return Pointer to the filled conf_data struct on success;\n
+ * 0 on error.
+ */
struct conf_data *create_conf_data(struct msg_buf *mb)
{
struct conf_data *conf;
return conf;
}
+/**
+ * @brief conf_data cleanup.
+ *
+ * @param conf Pointer to the target conf_data.
+ * @return Void.
+ */
void destroy_conf_data(struct conf_data *conf)
{
kfree(conf);
}
static struct conf_data config;
+
+/**
+ * @brief Saves config to static config variable.
+ *
+ * @param conf Variable to save.
+ * @return Void.
+ */
void save_config(const struct conf_data *conf)
{
memcpy(&config, conf, sizeof(config));
}
+/**
+ * @brief Restores config from static config variable.
+ *
+ * @param conf Variable to restore.
+ * @return Void.
+ */
void restore_config(struct conf_data *conf)
{
memcpy(conf, &config, sizeof(*conf));
* == FUNC_INST ==
* ============================================================================
*/
+
+/**
+ * @brief Creates and fills func_inst_data struct.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return Pointer to the filled func_inst_data struct on success;\n
+ * 0 on error.
+ */
struct func_inst_data *create_func_inst_data(struct msg_buf *mb)
{
struct func_inst_data *fi;
return NULL;
}
+/**
+ * @brief func_inst_data cleanup.
+ *
+ * @param fi Pointer to the target func_inst_data.
+ * @return Void.
+ */
void destroy_func_inst_data(struct func_inst_data *fi)
{
put_string(fi->args);
* == LIB_INST ==
* ============================================================================
*/
+
+/**
+ * @brief Creates and fills lib_inst_data struct.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return Pointer to the filled lib_inst_data struct on success;\n
+ * 0 on error.
+ */
struct lib_inst_data *create_lib_inst_data(struct msg_buf *mb)
{
struct lib_inst_data *li;
return NULL;
}
+/**
+ * @brief lib_inst_data cleanup.
+ *
+ * @param li Pointer to the target lib_inst_data.
+ * @return Void.
+ */
void destroy_lib_inst_data(struct lib_inst_data *li)
{
int i;
* == APP_INST ==
* ============================================================================
*/
+
+/**
+ * @brief Creates and fills app_inst_data struct.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return Pointer to the filled app_inst_data struct on success;\n
+ * 0 on error.
+ */
struct app_inst_data *create_app_inst_data(struct msg_buf *mb)
{
struct app_inst_data *app_inst;
return NULL;
}
+/**
+ * @brief app_inst_data cleanup.
+ *
+ * @param ai Pointer to the target app_inst_data.
+ * @return Void.
+ */
void destroy_app_inst_data(struct app_inst_data *ai)
{
int i;
* == US_INST ==
* ============================================================================
*/
+
+/**
+ * @brief Creates and fills us_inst_data struct.
+ *
+ * @param mb Pointer to the message buffer.
+ * @return Pointer to the filled us_inst_data struct on success;\n
+ * 0 on error.
+ */
struct us_inst_data *create_us_inst_data(struct msg_buf *mb)
{
struct us_inst_data *ui;
return NULL;
}
+/**
+ * @brief us_inst_data cleanup.
+ *
+ * @param ui Pointer to the target us_inst_data.
+ * @return Void.
+ */
void destroy_us_inst_data(struct us_inst_data *ui)
{
int i;
-/*
- * SWAP Parser
- * modules/parser/msg_parser.h
+/**
+ * @file parser/msg_parser.h
+ * @author Vyacheslav Cherkashin
+ * @author Vitaliy Cherepanov
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin, Vitaliy Cherepanov: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Message parsing interface declaration.
*/
struct msg_buf;
+/**
+ * @enum APP_TYPE
+ * Supported application types.
+ */
enum APP_TYPE {
- AT_TIZEN_NATIVE_APP = 0x01,
- AT_PID = 0x02,
- AT_COMMON_EXEC = 0x03,
- AT_TIZEN_WEB_APP = 0x04
+ AT_TIZEN_NATIVE_APP = 0x01, /**< Tizen native application. */
+ AT_PID = 0x02, /**< App with specified PID. */
+ AT_COMMON_EXEC = 0x03, /**< Common application. */
+ AT_TIZEN_WEB_APP = 0x04 /**< Tizen web application. */
};
+/**
+ * @brief App type size defenition.
+ */
enum {
SIZE_APP_TYPE = 4
};
-/* Basic application information */
+/**
+ * @struct app_info_data
+ * @brief Basic application information.
+ */
struct app_info_data {
- enum APP_TYPE app_type;
- pid_t tgid;
- char *exec_path;
+ enum APP_TYPE app_type; /**< Application type. */
+ pid_t tgid; /**< Application PID. */
+ char *exec_path; /**< Application execution path. */
};
-/* Configuration struct */
+/**
+ * @struct conf_data
+ * @brief Configuration struct.
+ */
struct conf_data {
- u64 use_features0;
- u64 use_features1;
- u32 sys_trace_period;
- u32 data_msg_period;
+ u64 use_features0; /**< Feature flags. */
+ u64 use_features1; /**< Feature flags. */
+ u32 sys_trace_period; /**< Trace period. */
+ u32 data_msg_period; /**< Data message period. */
};
-/* Application and library functions to set probes */
+/**
+ * @struct func_inst_data
+ * @brief Application and library functions to set probes.
+ */
struct func_inst_data {
- u64 addr;
- char *args;
- char ret_type;
+ u64 addr; /**< Function address. */
+ char *args; /**< Function args format string. */
+ char ret_type; /**< Function return type. */
};
-/* Library struct */
+/**
+ * @struct lib_inst_data
+ * @brief Library struct.
+ */
struct lib_inst_data {
- char *path;
- u32 cnt_func;
- struct func_inst_data **func;
+ char *path; /**< Library path. */
+ u32 cnt_func; /**< Function probes count in this library. */
+ struct func_inst_data **func; /**< Pointer to the probes array. */
};
-/* Application struct */
+/**
+ * @struct app_inst_data
+ * @brief Application struct.
+ */
struct app_inst_data {
- struct app_info_data *app_info;
- u32 cnt_func;
- struct func_inst_data **func;
- u32 cnt_lib;
- struct lib_inst_data **lib;
+ struct app_info_data *app_info; /**< Pointer to app_info struct. */
+ u32 cnt_func; /**< Function probes count in app. */
+ struct func_inst_data **func; /**< Pointer to the probes array. */
+ u32 cnt_lib; /**< Libs count. */
+ struct lib_inst_data **lib; /**< Pointer to the libs array. */
};
-/* User space instrumentation struct */
+/**
+ * @struct us_inst_data
+ * @brief User space instrumentation struct.
+ */
struct us_inst_data {
- u32 cnt;
- struct app_inst_data **app_inst;
+ u32 cnt; /**< Apps count. */
+ struct app_inst_data **app_inst; /**< Pointer to the apps array. */
};
struct app_inst_data make_app_inst_data(void);
struct us_inst_data make_us_inst_data(void);
+/**
+ * @brief Constant defenitions.
+ */
enum {
MIN_SIZE_STRING = 1,
MIN_SIZE_FUNC_INST = sizeof(make_func_inst_data().addr) +
-/*
- * SWAP Parser
- * modules/parser/parser_defs.h
+/**
+ * @file modules/parser/parser_defs.h
+ * @author Alexander Aksenov <a.aksenov@samsung.com>
+ * @author Vitaliy Cherepanov:
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>, Vitaliy Cherepanov:
- * SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Parser defenitions.
*/
/* #define PARSE_DEBUG */
+/** Prints debug message. */
#define print_debug(msg, args...) \
printk(KERN_DEBUG "SWAP_PARSER DEBUG : " msg, ##args)
+/** Prints info message. */
#define print_msg(msg, args...) \
printk(KERN_INFO "SWAP_PARSER : " msg, ##args)
+/** Prints warning message. */
#define print_warn(msg, args...) \
printk(KERN_WARNING "SWAP_PARSER WARNING : " msg, ##args)
+/** Prints error message. */
#define print_err(msg, args...) \
printk(KERN_ERR "SWAP_PARSER ERROR : " msg, ##args)
+/** Prints critical error message. */
#define print_crit(msg, args...) \
printk(KERN_CRIT "SWAP_PARSER CRITICAL : " msg, ##args)
-/*
- * SWAP Parser
- * modules/parser/swap_msg_parser.c
+/**
+ * parser/swap_msg_parser.c
+ * @author Vyacheslav Cherkashin
+ * @author Vitaliy Cherepanov
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin, Vitaliy Cherepanov: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * Parser module interface implementation.
*/
#include <driver/driver_to_msg.h>
#include <driver/swap_ioctl.h>
+/**
+ * @enum MSG_ID
+ * @brief Message IDs.
+ */
enum MSG_ID {
- MSG_KEEP_ALIVE = 0x0001,
- MSG_START = 0x0002,
- MSG_STOP = 0x0003,
- MSG_CONFIG = 0x0004,
- MSG_SWAP_INST_ADD = 0x0008,
- MSG_SWAP_INST_REMOVE = 0x0009
+ MSG_KEEP_ALIVE = 0x0001, /**< Keep alive message. */
+ MSG_START = 0x0002, /**< Start message. */
+ MSG_STOP = 0x0003, /**< Stop message. */
+ MSG_CONFIG = 0x0004, /**< Config message. */
+ MSG_SWAP_INST_ADD = 0x0008, /**< Swap inst add message. */
+ MSG_SWAP_INST_REMOVE = 0x0009 /**< Swap inst remove message. */
};
+/**
+ * @struct basic_msg_fmt
+ * @brief Basic part of each message.
+ */
struct basic_msg_fmt {
- u32 msg_id;
- u32 len;
+ u32 msg_id; /**< Message ID. */
+ u32 len; /**< Message length. */
} __attribute__((packed));
static int msg_handler(void __user *msg)
-/*
- * SWAP Parser
- * modules/parser/us_inst.c
+/**
+ * parser/us_inst.c
+ * @author Vyacheslav Cherkashin
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * User-space instrumentation controls.
*/
return 0;
}
+/**
+ * @brief Registers probes.
+ *
+ * @param us_inst Pointer to the target us_inst_data struct.
+ * @param mt Modificator, indicates whether we install or remove probes.
+ * @return 0 on suceess, error code on error.
+ */
int mod_us_inst(struct us_inst_data *us_inst, enum MOD_TYPE mt)
{
u32 i;
-/*
- * SWAP Parser
- * modules/parser/us_inst.h
+/**
+ * @file parser/us_inst.h
+ * @author Vyacheslav Cherkashin
+ *
+ * @section 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Vyacheslav Cherkashin: SWAP Parser implement
+ * @section DESCRIPTION
*
+ * User-space instrumentation controls interface.
*/
#ifndef _US_INST_H
#define _US_INST_H
+/**
+ * @enum MOD_TYPE
+ * @brief Type of mod_us_inst behaviour. */
enum MOD_TYPE {
- MT_ADD,
- MT_DEL
+ MT_ADD, /**< Add probes. */
+ MT_DEL /**< Remove probes. */
};
struct us_inst_data;