62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
#ifdef __KERNEL__
|
|
#include <linux/init.h>
|
|
#include <linux/module.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/gfp.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/device.h>
|
|
#include <linux/in.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
|
|
#include "../proc_api/proc_api.h"
|
|
#include "shm_dev.h"
|
|
|
|
static int shm_dev_proc_show(struct seq_file *seq, void *token)
|
|
{
|
|
seq_printf(seq, "Vserion: %s\n", SHMDEV_VERSION);
|
|
seq_printf(seq, "Total Share Memory Size: %u(KB)\n", (PAGE_ALIGN(SHM_MEM_SIZE)) / 1024);
|
|
return 0;
|
|
}
|
|
|
|
static int shm_dev_proc_ioctl(struct seq_file *seq, void *token)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static int shm_dev_proc_help(struct seq_file *seq, void *token)
|
|
{
|
|
PDBGFS_PRIV priv = (PDBGFS_PRIV)(seq->private);
|
|
seq_puts(seq, "==============Options Helps=============\n");
|
|
seq_printf(seq, "usage: echo \"<params>\" > /proc/%s/%s/%s\n",
|
|
PROC_API_DIR_NAME, SHM_DEV_DBG_DIR, priv->name);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static DBGFS_PRIV g_ProcConfig[] = {
|
|
{
|
|
"shm_dev", 0, 0L, NULL, NULL,
|
|
shm_dev_proc_show, shm_dev_proc_ioctl, shm_dev_proc_help
|
|
},
|
|
};
|
|
|
|
static PROC_API g_shmdev_dbg = {
|
|
SHM_DEV_DBG_DIR, g_ProcConfig, sizeof(g_ProcConfig) / sizeof(g_ProcConfig[0]),
|
|
};
|
|
|
|
int shm_dev_proc_init(void)
|
|
{
|
|
if(proc_api_register(&g_shmdev_dbg) != ERR_DBGFS_NO_ERROR) {
|
|
printk(KERN_ERR "Regisetr %s Error\n", g_shmdev_dbg.dir_name);
|
|
return -EINVAL;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int shm_dev_proc_uninit(void)
|
|
{
|
|
return proc_api_unregister(&g_shmdev_dbg);
|
|
}
|
|
#endif |