本文整理汇总了C++中create_proc_entry函数的典型用法代码示例。如果您正苦于以下问题:C++ create_proc_entry函数的具体用法?C++ create_proc_entry怎么用?C++ create_proc_entry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_proc_entry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zoran_proc_init
int
zoran_proc_init (struct zoran *zr)
{
#ifdef CONFIG_PROC_FS
char name[8];
snprintf(name, 7, "zoran%d", zr->id);
if ((zr->zoran_proc = create_proc_entry(name, 0, 0))) {
zr->zoran_proc->read_proc = zoran_read_proc;
zr->zoran_proc->write_proc = zoran_write_proc;
zr->zoran_proc->data = zr;
zr->zoran_proc->owner = THIS_MODULE;
dprintk(2,
KERN_INFO
"%s: procfs entry /proc/%s allocated. data=%p\n",
ZR_DEVNAME(zr), name, zr->zoran_proc->data);
} else {
dprintk(1, KERN_ERR "%s: Unable to initialise /proc/%s\n",
ZR_DEVNAME(zr), name);
return 1;
}
#endif
return 0;
}
示例2: fts_create_apk_debug_channel
/************************************************************************
* Name: fts_create_apk_debug_channel
* Brief: create apk debug channel
* Input: i2c info
* Output: no
* Return: success =0
***********************************************************************/
int fts_create_apk_debug_channel(struct i2c_client * client)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0))
fts_proc_entry = proc_create(PROC_NAME, 0777, NULL, &fts_proc_fops);
#else
fts_proc_entry = create_proc_entry(PROC_NAME, 0777, NULL);
#endif
if (NULL == fts_proc_entry)
{
dev_err(&client->dev, "Couldn't create proc entry!\n");
return -ENOMEM;
}
else
{
dev_info(&client->dev, "Create proc entry success!\n");
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
fts_proc_entry->write_proc = fts_debug_write;
fts_proc_entry->read_proc = fts_debug_read;
#endif
}
return 0;
}
示例3: init_ns_strlen_module
/* Initialize the module */
int init_ns_strlen_module(void) {
int ret = 0;
ns_buffer = (char *) vmalloc(NS_MAX_SIZE);
/* Return error if buffer initialization fails */
if (!ns_buffer) {
ret = -ENOMEM;
} else {
/* Initialize buffer 'ns_buffer' to 0 */
memset(ns_buffer, 0, NS_MAX_SIZE);
/* create 'ns_strlen' module */
ns_proc_entry = create_proc_entry("ns_strlen", 0644, NULL);
if (ns_proc_entry == NULL) {
ret = -ENOMEM;
vfree(ns_buffer);
printk(KERN_INFO "ns_strlen couldn't create proc entry.\n");
} else {
/* Initializing read and write procedures */
ns_proc_entry->read_proc = ns_strlen_read;
ns_proc_entry->write_proc = ns_strlen_write;
printk(KERN_INFO "ns_strlen module loaded.\n");
}
}
return ret;
}
示例4: TMP103_HW_i2c_init
static int __init TMP103_HW_i2c_init( void )
{
struct proc_dir_entry *prEntry;
i2c_register_board_info(TMP_I2C_BUSNUM, TMP103_HW_i2c_info, ARRAY_SIZE(TMP103_HW_i2c_info));
prEntry = create_proc_entry("TMP103", 0660, 0);
if (prEntry)
{
prEntry->read_proc = TMP103_HW_Read_Proc;
prEntry->write_proc = TMP103_HW_Write_Proc;
PK_DBG_FUNC("add /proc/TMP103 entry success \n");
}
else
{
PK_DBG_FUNC("add /proc/TMP103 entry fail \n");
}
mtktspcb1_register_thermal();
mtktspcb2_register_thermal();
return i2c_add_driver( &TMP103_HW_i2c_driver );
}
示例5: apanic_report_block_init
int __init apanic_report_block_init(void)
{
int result = 0;
memset(&drv_ctx, 0, sizeof(drv_ctx));
drv_ctx.apanic_trigger = create_proc_entry("apanic",
S_IFREG | S_IRUGO, NULL);
if (!drv_ctx.apanic_trigger)
printk(KERN_ERR "%s: failed creating procfile\n",
__func__);
else {
drv_ctx.apanic_trigger->read_proc = NULL;
drv_ctx.apanic_trigger->write_proc = apanic_trigger_check;
drv_ctx.apanic_trigger->size = 1;
drv_ctx.apanic_trigger->data = NULL;
drv_ctx.bounce = (void *)__get_free_page(GFP_KERNEL);
INIT_WORK(&proc_removal_work, apanic_remove_proc_work);
printk(KERN_INFO DRVNAME "kernel panic reporter initialized\n");
}
return result;
}
示例6: intel_fw_logging_init
static int __init intel_fw_logging_init(void)
{
int length = 0;
oshob_base = get_oshob_addr();
if (oshob_base == NULL)
return -EINVAL;
length = create_fwerr_log(log_buffer, oshob_base);
if (length != 0) {
#ifdef CONFIG_PROC_FS
ipanic_faberr = create_proc_entry("ipanic_fabric_err",
S_IFREG | S_IRUGO, NULL);
if (ipanic_faberr == 0) {
pr_err("Fail creating procfile ipanic_fabric_err\n");
return -ENOMEM;
}
ipanic_faberr->read_proc = intel_fw_logging_proc_read;
ipanic_faberr->write_proc = NULL;
ipanic_faberr->size = length;
#endif /* CONFIG_PROC_FS */
/* Dump log as error to console */
pr_err("%s", log_buffer);
/* Clear fabric error region inside OSHOB if neccessary */
intel_scu_ipc_simple_command(IPCMSG_CLEAR_FABERROR, 0);
}
iounmap(oshob_base);
return 0;
}
示例7: init_module
/*
* Module initialization and cleanup
*/
int init_module()
{
/* create the /proc file */
Our_Proc_File = create_proc_entry(PROC_ENTRY_FILENAME, 0644, NULL);
/* check if the /proc file was created successfuly */
if (Our_Proc_File == NULL){
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
PROC_ENTRY_FILENAME);
return -ENOMEM;
}
//Our_Proc_File->owner = THIS_MODULE;
Our_Proc_File->proc_iops = &Inode_Ops_4_Our_Proc_File;
Our_Proc_File->proc_fops = &File_Ops_4_Our_Proc_File;
Our_Proc_File->mode = S_IFREG | S_IRUGO | S_IWUSR;
Our_Proc_File->uid = 0;
Our_Proc_File->gid = 0;
Our_Proc_File->size = 80;
printk(KERN_INFO "/proc/%s created\n", PROC_ENTRY_FILENAME);
return 0; /* success */
}
示例8: init_my_module
int init_my_module( void )
{
int ret = 0;
cookie_pot = (char *)vmalloc( MAX_COOKIE_LENGTH );
if (!cookie_pot) {
ret = -ENOMEM;
} else {
memset( cookie_pot, 0, MAX_COOKIE_LENGTH );
proc_entry = create_proc_entry( MODULE_NAME, 0666, NULL );
if (proc_entry == NULL) {
ret = -ENOMEM;
vfree(cookie_pot);
printk(KERN_INFO "Couldn't create proc entry\n");
} else {
next_write_pos = 0;
next_read_pos = 0;
proc_entry->read_proc = procfs_read;
proc_entry->write_proc = procfs_write;
// proc_entry->owner = THIS_MODULE;
printk(KERN_INFO "Module loaded.\n");
}
}
return ret;
}
示例9: proc_register
int proc_register(const bcmsw_proc_t* node)
{
bcmsw_proc_node* i_node;
bcmsw_proc_dev_s* dev;
dev = get_bcmsw_dir();
if(strlen(node->name) >= PROC_NAME_L)
return -1;
// kmalloc
i_node = (bcmsw_proc_node*)kmalloc(sizeof(bcmsw_proc_node), GFP_KERNEL);
if(i_node == NULL) {
printk(KERN_ALERT "Error: Could not malloc \n");
return -ENOMEM;
}
// create proc file system
i_node->proc = create_proc_entry(node->name, node->mode, dev->dev_dir);
if(i_node->proc == NULL) {
remove_proc_entry(node->name, dev->dev_dir);
printk(KERN_ALERT "Error: Could not initialize ..\n");
return -ENOMEM;
}
memcpy(i_node->name, node->name, PROC_NAME_L);
i_node->proc->read_proc = node->read;
i_node->proc->mode = S_IFREG | S_IRUGO;
i_node->proc->uid = 0;
i_node->proc->gid = 0;
i_node->proc->size = 100; // ?? ..
// add to list
list_add_tail(&i_node->_list, &dev->list_head);
return 0;
}
示例10: wifi_proc_init
static int __init wifi_proc_init(void)
{
//kevin add,init wifi power to close
wifi_power_ctrl_comm(1,0);
wifi_power_ctrl_comm(0,0);
Our_Proc_File = create_proc_entry(procfs_name, 0644, NULL);
if (Our_Proc_File == NULL) {
remove_proc_entry(procfs_name, &proc_root);
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
procfs_name);
return -ENOMEM;
}
Our_Proc_File->read_proc = procfile_read;
//Our_Proc_File->owner = THIS_MODULE;
Our_Proc_File->mode = S_IFREG | S_IRUGO;
Our_Proc_File->uid = 0;
Our_Proc_File->gid = 0;
Our_Proc_File->size = 37;
return 0; /* everything is ok */
}
示例11: secwidevine_init
static int __init secwidevine_init(void)
{
#if 0
struct proc_dir_entry *secwidevine_proc;
secwidevine_proc = create_proc_entry("secwidevine0",
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH), NULL);
if (IS_ERR(secwidevine_proc))
{
goto error;
}
secwidevine_proc->proc_fops = &secwidevine_fops;
#else
proc_create("secwidevine0", (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH), NULL, &secwidevine_fops);
#endif
return 0;
#if 0
error:
return -1;
#endif
}
示例12: alog_ram_console_late_init
static int __init alog_ram_console_late_init(void)
{
struct proc_dir_entry *entry;
int i;
// create a proc file to read old log for alog ram console
for (i=0; i<LOG_TYPE_NUM; i++)
if (alog_ram_console_old_log[i] != NULL)
{
entry = create_proc_entry(alog_ram_console_proc_fn[i], S_IFREG | S_IRUGO, NULL);
if (!entry)
{
printk(KERN_ERR "[LastAlog] late_init: failed to create proc entry - /proc/%s\n", alog_ram_console_proc_fn[i]);
kfree(alog_ram_console_old_log[i]);
alog_ram_console_old_log[i] = NULL;
return -EFAULT;
}
entry->proc_fops = &alog_ram_console_file_ops[i];
entry->size = alog_ram_console_old_log_size[i];
}
return 0;
}
示例13: tfswitch_init_module
static int __init tfswitch_init_module(void)
{
printk("Loading TF7700 switch driver\n");
/* create a proc entry and set the read function */
pEntry = create_proc_entry(PROC_ENTRY_NAME, 0, NULL);
if(pEntry == NULL)
{
printk("TF7700 switch driver: cannot allocate proc entry\n");
return 1;
}
pEntry->read_proc = tfswitch_read_proc;
/* allocate the I/O pin */
pPin = stpio_request_pin(4, 4, "rear switch", STPIO_IN);
if(pEntry == NULL)
{
printk("TF7700 switch driver: cannot allocate pin\n");
remove_proc_entry(PROC_ENTRY_NAME, pEntry->parent);
return 1;
}
return 0;
}
示例14: iet_procfs_init
int iet_procfs_init(void)
{
int i;
struct proc_dir_entry *ent;
if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
goto err;
for (i = 0; i < ARRAY_SIZE(iet_proc_entries); i++) {
ent = create_proc_entry(iet_proc_entries[i].name, 0, proc_iet_dir);
if (ent)
ent->proc_fops = iet_proc_entries[i].fops;
else
goto err;
}
return 0;
err:
if (proc_iet_dir)
iet_procfs_exit();
return -ENOMEM;
}
示例15: init_module
/**
*This function is called when the module is loaded
*
*/
int init_module()
{
/* create the /proc file */
Our_Proc_File = create_proc_entry(PROCFS_NAME, 0644, NULL);
if (Our_Proc_File == NULL) {
remove_proc_entry(PROCFS_NAME, NULL);
// WH remove_proc_entry(PROCFS_NAME, &proc_root);
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
PROCFS_NAME);
return -ENOMEM;
}
Our_Proc_File->read_proc = procfile_read;
Our_Proc_File->write_proc = procfile_write;
// WH Our_Proc_File->owner = THIS_MODULE;
Our_Proc_File->mode = S_IFREG | S_IRUGO;
Our_Proc_File->uid = 0;
Our_Proc_File->gid = 0;
Our_Proc_File->size = 37;
printk(KERN_INFO "/proc/%s created\n", PROCFS_NAME);
return 0; /* everything is ok */
}