本文整理汇总了C++中create_proc_entry函数的典型用法代码示例。如果您正苦于以下问题:C++ create_proc_entry函数的具体用法?C++ create_proc_entry怎么用?C++ create_proc_entry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_proc_entry函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:xricson,项目名称:knoppix,代码行数:24,代码来源:zoran_procfs.c
示例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;
}
开发者ID:EvlisChen,项目名称:git_test,代码行数:31,代码来源:focaltech_ex_fun.c
示例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;
}
开发者ID:nishmi,项目名称:OS-Modules,代码行数:25,代码来源:ns_strlen.c
示例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 );
}
开发者ID:CobraJet93,项目名称:kernel-3.10.54,代码行数:24,代码来源:mtk_ts_pcb.c
示例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;
}
开发者ID:Shabbypenguin,项目名称:Photon-Kernel,代码行数:24,代码来源:apanic_report_block.c
示例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;
}
开发者ID:ddalex,项目名称:XT890-Kernel-Gamma,代码行数:36,代码来源:intel_fw_logging.c
示例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 */
}
开发者ID:MartinoMensio,项目名称:SDP-Labs,代码行数:27,代码来源:procfs-3.c
示例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;
}
开发者ID:menghsu,项目名称:bs,代码行数:24,代码来源:transform.c
示例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;
}
开发者ID:Reedgarden,项目名称:bcmsw_igmp,代码行数:36,代码来源:bcmsw_proc.c
示例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 */
}
开发者ID:manishj-patel,项目名称:netbook_kernel_3.4.5,代码行数:24,代码来源:wifi_proc.c
示例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
}
开发者ID:John677,项目名称:Kernal_k3note,代码行数:24,代码来源:secwidevine.c
示例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;
}
开发者ID:chen2011521,项目名称:xt560_kernel,代码行数:24,代码来源:alog_ram_console.c
示例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;
}
开发者ID:Audioniek,项目名称:driver,代码行数:24,代码来源:tfswitch.c
示例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;
}
开发者ID:OESF,项目名称:linux-linaro-natty,代码行数:24,代码来源:config.c
示例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 */
}
开发者ID:wadester,项目名称:wh_test_kernel,代码行数:28,代码来源:proc_fs-old.c
示例16: hdpu_cpustate_probe
static int hdpu_cpustate_probe(struct platform_device *pdev)
{
struct resource *res;
struct proc_dir_entry *proc_de;
int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
printk(KERN_ERR "sky_cpustate: "
"Invalid memory resource.\n");
return -EINVAL;
}
cpustate.set_addr = (unsigned long *)res->start;
cpustate.clr_addr = (unsigned long *)res->end - 1;
ret = misc_register(&cpustate_dev);
if (ret) {
printk(KERN_WARNING "sky_cpustate: "
"Unable to register misc device.\n");
cpustate.set_addr = NULL;
cpustate.clr_addr = NULL;
return ret;
}
proc_de = create_proc_entry("sky_cpustate", 0666, &proc_root);
if (!proc_de) {
printk(KERN_WARNING "sky_cpustate: "
"Unable to create proc entry\n");
} else {
proc_de->proc_fops = &proc_cpustate;
proc_de->owner = THIS_MODULE;
}
printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
return 0;
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:36,代码来源:hdpu_cpustate.c
示例17: rtas_init
static int __init rtas_init(void)
{
struct proc_dir_entry *entry;
if (!machine_is(pseries))
return 0;
/* No RTAS */
if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) {
printk(KERN_DEBUG "rtasd: no event-scan on system\n");
return -ENODEV;
}
entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL);
if (entry)
entry->proc_fops = &proc_rtas_log_operations;
else
printk(KERN_ERR "Failed to create error_log proc entry\n");
if (kernel_thread(rtasd, NULL, CLONE_FS) < 0)
printk(KERN_ERR "Failed to start RTAS daemon\n");
return 0;
}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:24,代码来源:rtasd.c
示例18: gpioed_init
/*** init&exit ***/
static int __init gpioed_init(void)
{
my_workqueue = create_workqueue(MY_WORK_QUEUE_NAME);
proc_intf = create_proc_entry(procfs_name, 0644, NULL);
if (proc_intf == NULL) {
remove_proc_entry(procfs_name, &proc_root);
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
procfs_name);
return -ENOMEM;
}
proc_intf->read_proc = procfile_read;
proc_intf->write_proc = procfile_write;
proc_intf->owner = THIS_MODULE;
proc_intf->mode = S_IFREG | S_IRUGO;
proc_intf->uid = 0;
proc_intf->gid = 0;
proc_intf->size = 37;
printk(KERN_INFO "/proc/%s created\n", procfs_name);
return 0;
}
开发者ID:fourks,项目名称:tools,代码行数:25,代码来源:gpioed.c
示例19: lenovo_sl_procfs_init
static int lenovo_sl_procfs_init(void)
{
struct proc_dir_entry *proc_ec;
proc_dir = proc_mkdir(LENSL_PROC_DIRNAME, acpi_root_dir);
if (!proc_dir) {
vdbg_printk(LENSL_ERR,
"Failed to create proc dir acpi/%s/\n", LENSL_PROC_DIRNAME);
return -ENOENT;
}
proc_dir->owner = THIS_MODULE;
proc_ec = create_proc_entry(LENSL_PROC_EC, 0600, proc_dir);
if (!proc_ec) {
vdbg_printk(LENSL_ERR,
"Failed to create proc entry acpi/%s/%s\n",
LENSL_PROC_DIRNAME, LENSL_PROC_EC);
return -ENOENT;
}
proc_ec->read_proc = lensl_ec_read_procmem;
proc_ec->write_proc = lensl_ec_write_procmem;
vdbg_printk(LENSL_DEBUG, "Initialized procfs debugging interface\n");
return 0;
}
开发者ID:bozhidar,项目名称:lenovo-sl-laptop,代码行数:24,代码来源:lenovo-sl-laptop.c
示例20: proc_init
static int __init proc_init( void ) {
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 9, 0))
ERR( "it's work only for kernel LE 3.9\n" );
return -ECANCELED;
#else
int ret;
struct proc_dir_entry *own_proc_node;
own_proc_node = create_proc_entry( NAME_NODE, S_IFREG | S_IRUGO | S_IWUGO, NULL );
if( NULL == own_proc_node ) {
ret = -ENOENT;
ERR( "can't create /proc/%s\n", NAME_NODE );
goto err_node;
}
own_proc_node->uid = own_proc_node->gid = 0;
if( mode !=1 )
own_proc_node->read_proc = proc_node_read;
if( mode !=2 )
own_proc_node->proc_fops = &node_fops;
LOG( "/proc/%s installed\n", NAME_NODE );
return 0;
err_node:
return ret;
#endif
}
开发者ID:starius,项目名称:mylinuxprog,代码行数:24,代码来源:mod_2.c
注:本文中的create_proc_entry函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论