-/*
- * SWAP device driver
- * modules/driver/app_manage.h
+/**
+ * @file driver/app_manage.h
+ * @author Alexander Aksenov <a.aksenov@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
* 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
*
- * 2014 Alexander Aksenov <a.aksenov@samsung.com>: Driver user<-> kernel
- * connect implement
+ * @section DESCRIPTION
*
+ * Driver user <-> kernel connect implement.
*/
#ifndef __APP_MANAGE_H__
#include "us_interaction.h"
#include "us_interaction_msg.h"
+/**
+ * @brief Sends pause message to kernel.
+ *
+ * @return us_interaction_send_msg result.
+ */
static inline int app_manage_pause_apps(void)
{
enum us_interaction_k2u_msg_t us_int_msg = US_INT_PAUSE_APPS;
return us_interaction_send_msg(&us_int_msg, sizeof(us_int_msg));
}
+/**
+ * @brief Sends continue message to kernel.
+ *
+ * @return us_interaction_send_msg result.
+ */
static inline int app_manage_cont_apps(void)
{
enum us_interaction_k2u_msg_t us_int_msg = US_INT_CONT_APPS;
-/*
- * SWAP device driver
- * modules/driver/device_driver.c
+/**
+ * driver/device_driver.c
+ * @author Alexander Aksenov <a.aksenov@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
* 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>: SWAP device driver implement
+ * @section DESCRIPTION
*
+ * Provides SWAP device.
*/
#include <linux/types.h>
#include "driver_to_buffer.h"
#include "driver_to_msg.h"
+/** SWAP device name as it is in /dev/. */
#define SWAP_DEVICE_NAME "swap_device"
+/** Maximum subbuffer size. Used for sanitization checks. */
#define MAXIMUM_SUBBUFFER_SIZE (64 * 1024)
/* swap_device driver routines */
struct pipe_inode_info *pipe, size_t len,
unsigned int flags);
-/* File operations structure */
+/**
+ * @var swap_device_fops
+ * @brief SWAP device file operations.
+ */
const struct file_operations swap_device_fops = {
.owner = THIS_MODULE,
.read = swap_device_read,
};
/* Typedefs for splice_* funcs. Prototypes are for linux-3.8.6 */
+/** Splice to pipe pointer type. */
typedef ssize_t(*splice_to_pipe_p_t)(struct pipe_inode_info *pipe,
struct splice_pipe_desc *spd);
+/** Splice grow spd pointer type. */
typedef int(*splice_grow_spd_p_t)(const struct pipe_inode_info *pipe,
struct splice_pipe_desc *spd);
}
-/* We need this realization of splice_shrink_spd() because of the its desing
- * frequent changes that I have encountered in custom kernels */
+/**
+ * @brief We need this realization of splice_shrink_spd() because its desing
+ * frequently changes in custom kernels.
+ *
+ * @param pipe Pointer to the pipe whereto splice data.
+ * @param spd Pointer to the splice_pipe_desc structure.
+ * @return Void.
+ */
void swap_device_splice_shrink_spd(struct pipe_inode_info *pipe,
struct splice_pipe_desc *spd)
{
}
-/* Register device TODO Think of permanent major */
-int swap_device_init(void)
+/* TODO Think of permanent major */
+
+/**
+ * @brief Register device.
+ *
+ * @return 0 on success, negative error code otherwise.
+ */
+ int swap_device_init(void)
{
int result;
return result;
}
-/* Unregister device TODO Check wether driver is registered */
+/* TODO Check wether driver is registered */
+
+/**
+ * @brief Unregister device.
+ *
+ * @return Void.
+ */
void swap_device_exit(void)
{
exit_w_wake_up();
return result;
}
+/**
+ * @brief Wakes up daemon that splicing data from driver.
+ *
+ * @return Void.
+ */
void swap_device_wake_up_process(void)
{
if (atomic_read(&flag_wake_up) == 0) {
}
}
+/**
+ * @brief Registers received message handler.
+ *
+ * @param mh Pointer to message handler.
+ * @return Void.
+ */
void set_msg_handler(msg_handler_t mh)
{
msg_handler = mh;
-/*
- * SWAP driver
- * modules/driver/device_driver.h
+/**
+ * @file driver/device_driver.h
+ * @author Alexander Aksenov <a.aksenov@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
* 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>: SWAP device driver implement
+ * @section DESCRIPTION
*
+ * SWAP device driver interface declaration.
*/
#ifndef __SWAP_DRIVER_DEVICE_DRIVER_H__
-/*
- * SWAP driver
- * modules/driver_new/device_driver_to_driver_to_buffer.h
+/**
+ * @file device_driver_to_driver_to_buffer.h
+ * @author Alexander Aksenov <a.aksenov@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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Copyright (C) Samsung Electronics, 2013
+ * @section COPYRIGHT
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: SWAP device driver implement
+ * Copyright (C) Samsung Electronics, 2013
*
+ * @section DESCRIPTION
+ * SWAP device interface for driver_to_buffer.
*/
-/* SWAP device interface for driver_to_buffer */
#ifndef __DEVICE_DRIVER_TO_DRIVER_TO_BUFFER_H__
#define __DEVICE_DRIVER_TO_DRIVER_TO_BUFFER_H__
-/*
- * SWAP device driver
- * modules/driver/driver_defs.h
+/**
+ * @file driver/driver_defs.h
+ * @author Alexander Aksenov <a.aksenov@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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Copyright (C) Samsung Electronics, 2013
+ * @section COPYRIGHT
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: SWAP device driver implement
+ * Copyright (C) Samsung Electronics, 2013
*
+ * @section DESCRIPTION
+ * Device driver defs.
*/
#ifndef __SWAP_DRIVER_DEVICE_DEFS_H__
#include <linux/kernel.h>
+/** Prints debug message.*/
#define print_debug(msg, args...) \
printk(KERN_DEBUG "SWAP_DRIVER DEBUG : " msg, ##args)
+/** Prints info message.*/
#define print_msg(msg, args...) \
printk(KERN_INFO "SWAP_DRIVER : " msg, ##args)
+/** Prints warning message.*/
#define print_warn(msg, args...) \
printk(KERN_WARNING "SWAP_DRIVER WARNING : " msg, ##args)
+/** Prints error message.*/
#define print_err(msg, args...) \
printk(KERN_ERR "SWAP_DRIVER ERROR : " msg, ##args)
+/** Prints critical error message.*/
#define print_crit(msg, args...) \
printk(KERN_CRIT "SWAP_DRIVER CRITICAL : " msg, ##args)
-/*
- * SWAP driver
- * modules/driver/driver_to_buffer.c
+/**
+ * driver/driver_to_buffer.c
+ * @author Alexander Aksenov <a.aksenov@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
* 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>: SWAP device driver implement
+ * @section DESCRIPTION
*
+ * Driver and buffer interaction interface implementation.
*/
#include <linux/string.h>
return E_SD_SUCCESS;
}
-/* Buffers callback function */
+/**
+ * @brief Buffers callback function
+ *
+ * @return 0
+ */
int driver_to_buffer_callback(void)
{
/* Increment buffers_to_read counter */
return E_SD_SUCCESS;
}
-/* Read buffers */
+/**
+ * @brief Copies data from subbuffer to userspace.
+ *
+ * @param[out] buf Pointer to userspace memory area whereto copy data from
+ * subbuffer.
+ * @param count Size of data to be read.
+ * @return Read data size on success, negative error code on error.
+ */
ssize_t driver_to_buffer_read(char __user *buf, size_t count)
{
size_t bytes_to_copy;
return bytes_to_read;
}
-/* Flush swap_buffer */
+/**
+ * @brief Flushes SWAP buffer.
+ *
+ * @return 0.
+ */
int driver_to_buffer_flush(void)
{
unsigned int flushed;
return E_SD_SUCCESS;
}
-/* Fills spd structure */
+/**
+ * @brief Fills spd structure.
+ *
+ * @param[out] spd Pointer to the splice_pipe_desc struct that should be filled.
+ * @return 0 on success, negative error code on error.
+ */
int driver_to_buffer_fill_spd(struct splice_pipe_desc *spd)
{
size_t data_to_splice = busy_buffer->full_buffer_part;
return 0;
}
-/* Check for subbuffers ready to be read */
+/**
+ * @brief Check for subbuffer ready to be read.
+ *
+ * @return 1 if there is subbuffer to be read, 0 - if there isn't.
+ */
int driver_to_buffer_buffer_to_read(void)
{
return busy_buffer ? 1 : 0;
}
-/* Set buffers size and count */
+/**
+ * @brief Initializes SWAP buffer.
+ *
+ * @param size Size of one subbuffer.
+ * @param count Count of subbuffers.
+ * @return 0 on success, negative error code on error.
+ */
int driver_to_buffer_initialize(size_t size, unsigned int count)
{
int result;
return E_SD_SUCCESS;
}
-/* Uninitialize buffer */
+/**
+ * @brief Uninitializes buffer.
+ *
+ * @return 0 on success, negative error code on error.
+ */
int driver_to_buffer_uninitialize(void)
{
int result;
return result;
}
-/* Get next buffer to read */
+/**
+ * @brief Get next buffer to read.
+ *
+ * @return 0 on success, negative error code on error, E_SD_NO_DATA_TO_READ if
+ * there is nothing to be read.
+ */
int driver_to_buffer_next_buffer_to_read(void)
{
int result;
return E_SD_SUCCESS;
}
-
-/*
- * SWAP driver
- * modules/driver/driver_to_buffer.h
+/**
+ * @file driver/driver_to_buffer.h
+ * @author Alexander Aksenov <a.aksenov@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
* 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>: SWAP device driver implement
+ * @section DESCRIPTION
*
+ * Driver and buffer interaction interface declaration.
*/
#ifndef __SWAP_DRIVER_DRIVER_TO_BUFFER__
-/*
- * SWAP device driver
- * modules/driver/driver_to_msg.h
+/**
+ * @file driver/driver_to_msg.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 driver to parser implement
+ * @section DESCRIPTION
*
+ * Driver and parser interaction interface declaration.
*/
#ifndef __SWAP_DRIVER_DRIVER_TO_MSG__
#define __SWAP_DRIVER_DRIVER_TO_MSG__
-
+/** Defines type for message handler's pointer. */
typedef int (*msg_handler_t)(void __user *data);
/* Set the message handler */
-/*
- * SWAP kernel features
- * driver/swap_debugfs.c
+/**
+ * driver/swap_debugfs.c
+ * @author Vyacheslav Cherkashin <v.cherkashin@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
* 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 <v.cherkashin@samsung.com>
+ * @section DESCRIPTION
*
+ * Initializes root debugfs for all SWAP modules
*/
static struct dentry *swap_dir = NULL;
-
+/**
+ * @brief Get debugfs dir.
+ *
+ * @return Pointer to dentry stuct.
+ */
struct dentry *get_swap_debugfs_dir(void)
{
return swap_dir;
}
EXPORT_SYMBOL_GPL(get_swap_debugfs_dir);
+/**
+ * @brief Initializes SWAP debugfs.
+ *
+ * @return 0 on success, negative error code on error.
+ */
int swap_debugfs_init(void)
{
swap_dir = debugfs_create_dir("swap", NULL);
return 0;
}
+/**
+ * @brief Deinitializes SWAP debugfs and recursively removes all its files.
+ *
+ * @return Void.
+ */
void swap_debugfs_exit(void)
{
struct dentry *dir = swap_dir;
-#ifndef _SWAP_DEBUG_FS_H
-#define _SWAP_DEBUG_FS_H
-
-/*
- * SWAP kernel features
- * driver/swap_debugfs.h
+/**
+ * @file driver/swap_debugfs.h
+ * @author Vyacheslav Cherkashin <v.cherkashin@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
* 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 <v.cherkashin@samsung.com>
+ * @section DESCRIPTION
*
+ * SWAP debugfs interface definition.
*/
+#ifndef _SWAP_DEBUG_FS_H
+#define _SWAP_DEBUG_FS_H
+
struct dentry;
-/*
- * SWAP Driver Module
- * modules/buffer/swap_driver_errors.h
+/**
+ * @file driver/swap_driver_errors.h
+ * @author Alexander Aksenov <a.aksenov@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
* 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>: SWAP Driver implement
+ * @section DESCRIPTION
*
+ * SWAP driver error codes.
*/
#ifndef __SWAP_DRIVER_ERRORS_H__
#define __SWAP_DRIVER_ERRORS_H__
-/* SWAP Driver error codes enumeration */
+/**
+ * @enum _swap_driver_errors
+ * @brief SWAP driver errors enumeration.
+ */
enum _swap_driver_errors {
- E_SD_SUCCESS = 0, /* Success */
- E_SD_ALLOC_CHRDEV_FAIL = 1, /* alloc_chrdev_region failed */
- E_SD_CDEV_ALLOC_FAIL = 2, /* cdev_alloc failed */
- E_SD_CDEV_ADD_FAIL = 3, /* cdev_add failed */
- E_SD_CLASS_CREATE_FAIL = 4, /* class_create failed */
- E_SD_DEVICE_CREATE_FAIL = 5, /* device_create failed */
- E_SD_NO_SPLICE_FUNCS = 6, /* splice_* funcs not found */
- E_SD_NO_DATA_TO_READ = 7, /* swap_buffer_get tells us that there is no
- readable subbuffers */
- E_SD_NO_BUSY_SUBBUFFER = 8, /* No busy subbuffer */
- E_SD_WRONG_SUBBUFFER_PTR = 9, /* Wrong subbuffer pointer passed to
- swap_buffer module */
- E_SD_BUFFER_ERROR = 10, /* Unhandled swap_buffer error */
- E_SD_WRITE_ERROR = 11, /* Write to subbuffer error */
- E_SD_WRONG_ARGS = 12, /* Arguments, passed to the func, doesn't
- pass sanity check */
- E_SD_NO_MEMORY = 13, /* No memory to allocate */
- E_SD_UNINIT_ERROR = 14, /* swap_buffer uninitialization error */
- E_SD_NL_INIT_ERR = 15, /* Netlink init error */
- E_SD_NL_MSG_ERR = 16, /* Netlink message send error */
- E_SD_NO_DAEMON_PID = 17 /* No daemon pid in us_interaction */
+ /**
+ * @brief Success.
+ */
+ E_SD_SUCCESS = 0,
+ /**
+ * @brief Alloc_chrdev_region failed.
+ */
+ E_SD_ALLOC_CHRDEV_FAIL = 1,
+ /**
+ * @brief cdev_alloc failed.
+ */
+ E_SD_CDEV_ALLOC_FAIL = 2,
+ /**
+ * @brief cdev_add failed.
+ */
+ E_SD_CDEV_ADD_FAIL = 3,
+ /**
+ * @brief class_create failed.
+ */
+ E_SD_CLASS_CREATE_FAIL = 4,
+ /**
+ * @brief device_create failed.
+ */
+ E_SD_DEVICE_CREATE_FAIL = 5,
+ /**
+ * @brief splice_* funcs not found.
+ */
+ E_SD_NO_SPLICE_FUNCS = 6,
+ /**
+ * @brief swap_buffer_get tells us that there is no readable subbuffers.
+ */
+ E_SD_NO_DATA_TO_READ = 7,
+ /**
+ * @brief No busy subbuffer.
+ */
+ E_SD_NO_BUSY_SUBBUFFER = 8,
+ /**
+ * @brief Wrong subbuffer pointer passed to swap_buffer module.
+ */
+ E_SD_WRONG_SUBBUFFER_PTR = 9,
+ /**
+ * @brief Unhandled swap_buffer error.
+ */
+ E_SD_BUFFER_ERROR = 10,
+ /**
+ * @brief Write to subbuffer error.
+ */
+ E_SD_WRITE_ERROR = 11,
+ /**
+ * @brief Arguments, been passed to the func, doesn't pass sanity check.
+ */
+ E_SD_WRONG_ARGS = 12,
+ /**
+ * @brief No memory to allocate.
+ */
+ E_SD_NO_MEMORY = 13,
+ /**
+ * @brief swap_buffer uninitialization error.
+ */
+ E_SD_UNINIT_ERROR = 14,
+ /**
+ * @brief Netlink init error.
+ */
+ E_SD_NL_INIT_ERR = 15,
+ /**
+ * @brief Netlink message send error.
+ */
+ E_SD_NL_MSG_ERR = 16,
+ /**
+ * @brief No daemon pid in us_interaction.
+ */
+ E_SD_NO_DAEMON_PID = 17
};
#endif /* __SWAP_DRIVER_ERRORS_H__ */
-/*
- * SWAP Driver
- * modules/driver/swap_driver_module.c
+/**
+ * driver/swap_driver_module.c
+ * @author Alexander Aksenov <a.aksenov@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
* 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>: SWAP device driver implement
+ * @section DESCRIPTION
*
+ * SWAP drive module interface implementation.
*/
#include <linux/module.h>
-/*
- * SWAP driver
- * modules/driver/swap_ioctl.h
+/**
+ * @file driver/swap_ioctl.h
+ * @author Alexander Aksenov <a.aksenov@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
* 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>: SWAP device driver implement
+ * @section DESCRIPTION
*
+ * Provides ioctl commands and recources for SWAP driver.
*/
#ifndef __SWAP_IOCTL_H__
#include <linux/ioctl.h>
+/** SWAP device magic number. */
#define SWAP_DRIVER_IOC_MAGIC 0xAF
+/**
+ * @struct buffer_initialize
+ * @brief SWAP buffer initialization struct.
+ * @var buffer_initialize::size
+ * Size of one subbuffer.
+ * @var buffer_initialize::count
+ * Count of subbuffers in the buffer.
+ */
struct buffer_initialize {
size_t size;
unsigned int count;
/* SWAP Device ioctl commands */
+/** Initialize buffer message. */
#define SWAP_DRIVER_BUFFER_INITIALIZE _IOW(SWAP_DRIVER_IOC_MAGIC, 1, \
struct buffer_initialize *)
+/** Uninitialize buffer message. */
#define SWAP_DRIVER_BUFFER_UNINITIALIZE _IO(SWAP_DRIVER_IOC_MAGIC, 2)
+/** Set next buffer to read. */
#define SWAP_DRIVER_NEXT_BUFFER_TO_READ _IO(SWAP_DRIVER_IOC_MAGIC, 3)
+/** Flush buffers. */
#define SWAP_DRIVER_FLUSH_BUFFER _IO(SWAP_DRIVER_IOC_MAGIC, 4)
+/** Custom message. */
#define SWAP_DRIVER_MSG _IOW(SWAP_DRIVER_IOC_MAGIC, 5, \
void *)
+/** Force wake up daemon. */
#define SWAP_DRIVER_WAKE_UP _IO(SWAP_DRIVER_IOC_MAGIC, 6)
#endif /* __SWAP_IOCTL_H__ */
-/*
- * SWAP device driver
- * modules/driver/us_interaction.c
+/**
+ * driver/us_interaction.c
+ * @author Alexander Aksenov <a.aksenov@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
* 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
*
- * 2014 Alexander Aksenov <a.aksenov@samsung.com>: Driver user<-> kernel
- * connect implement
+ * @section DESCRIPTION
*
+ * Kernel-to-user interface implementation.
*/
/* Send messages counter */
static u32 msg_counter = 0;
-
+/**
+ * @brief Sends message to userspace via netlink.
+ *
+ * @param data Pointer to the data to be send.
+ * @param size Size of the data to be send.
+ * @return 0 on success, error code on error.
+ */
int us_interaction_send_msg(const void *data, size_t size)
{
struct cn_msg *msg;
{
}
+/**
+ * @brief Creates netlink connection.
+ *
+ * @return 0 on success, error code on error.
+ */
int us_interaction_create(void)
{
int res;
return E_SD_SUCCESS;
}
+/**
+ * @brief Destroy netlink connection.
+ *
+ * @return Void.
+ */
void us_interaction_destroy(void)
{
cn_del_callback(&cn_swap_id);
-/*
- * SWAP device driver
- * modules/driver/us_interaction.h
+/**
+ * @file driver/us_interaction.h
+ * @author Alexander Aksenov <a.aksenov@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
* 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
*
- * 2014 Alexander Aksenov <a.aksenov@samsung.com>: Driver user<-> kernel
- * connect implement
+ * @section DESCRIPTION
*
+ * Kernel-to-user interface definition.
*/
#ifndef __US_INTERACTION_H__
-/*
- * SWAP device driver
- * modules/driver/us_interaction_msg.h
+/**
+ * @file driver/us_interaction_msg.h
+ * @author Alexander Aksenov <a.aksenov@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
* 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
*
- * 2014 Alexander Aksenov <a.aksenov@samsung.com>: Driver user<-> kernel
- * connect implement
+ * @section DESCRIPTION
*
+ * Netlink messages declaration.
*/
#ifndef __US_INTERACTION_MSG_H__
#define __US_INTERACTION_MSG_H__
-#define CN_SWAP_IDX 0x22 /* Should be unique throughout the system */
-#define CN_SWAP_VAL 0x1 /* Just the same in kernel and user */
-#define CN_DAEMON_GROUP 0x1 /* Listener group. Connector works a bit faster
+#define CN_SWAP_IDX 0x22 /**< Should be unique throughout the system */
+#define CN_SWAP_VAL 0x1 /**< Just the same in kernel and user */
+#define CN_DAEMON_GROUP 0x1 /**< Listener group. Connector works a bit faster
* when using one */
+/**
+ * @enum us_interaction_k2u_msg_t
+ * @brief Kernel-to-user netlink messages headers.
+ */
enum us_interaction_k2u_msg_t {
- US_INT_PAUSE_APPS = 1, /* Make daemon pause apps */
- US_INT_CONT_APPS = 2 /* Make daemon continue apps */
+ /**
+ * @brief Make daemon pause apps.
+ */
+ US_INT_PAUSE_APPS = 1,
+ /**
+ * @brief Make daemon continue apps.
+ */
+ US_INT_CONT_APPS = 2
};
#endif /* __US_INTERACTION_MSG_H__ */