本文整理汇总了C++中proc_mkdir函数的典型用法代码示例。如果您正苦于以下问题:C++ proc_mkdir函数的具体用法?C++ proc_mkdir怎么用?C++ proc_mkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proc_mkdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pn544_mmi_init
int pn544_mmi_init(void)
{
struct proc_dir_entry *pn544_dir;
struct proc_dir_entry *pn544_mmi;
PN544_MMI_DEBUG("%s:entered and ready to create proc node to support MMI test\n",__func__);
pn544_dir=proc_mkdir("pn544",NULL);
if(NULL==pn544_dir)
{
printk("Can not create folder pn544 in proc system.\n");
return -EIO;
}
pn544_mmi=proc_create("pn544_mmi", S_IRUGO, pn544_dir, &pn544_mmi_fops);
if(NULL==pn544_mmi)
{
printk("Can not create folder pn544 in proc system.\n");
return -EIO;
}
return 0;
}
示例2: configure_procfs
static int
configure_procfs ( void )
{
/* create directory */
dir_pfs = proc_mkdir ( PROBE_PROCFS_DIR_NAME, NULL );
if ( dir_pfs == NULL )
{
remove_proc_entry ( PROBE_PROCFS_DIR_NAME, NULL );
log_infok( "error: Could not initialize /proc/%s\n", PROBE_PROCFS_DIR_NAME );
return -ENOMEM;
}
dir_pfs->owner = THIS_MODULE;
if ( !configure_proc_entry ( ivhs_feedback_pfs, &ivhs_feedback_fops, PROBE_PROCFS_FEEDBACK ) )
goto out_trigger;
return true_b;
out_trigger:
remove_proc_entry ( PROBE_PROCFS_FEEDBACK, dir_pfs );
remove_proc_entry ( PROBE_PROCFS_DIR_NAME, NULL );
return false_b;
}
示例3: scsi_init_procfs
int __init scsi_init_procfs(void)
{
struct proc_dir_entry *pde;
proc_scsi = proc_mkdir("scsi", NULL);
if (!proc_scsi)
goto err1;
pde = create_proc_entry("scsi/scsi", 0, NULL);
if (!pde)
goto err2;
pde->proc_fops = &proc_scsi_operations;
return 0;
err2:
remove_proc_entry("scsi", NULL);
err1:
return -ENOMEM;
}
示例4: cachefiles_proc_init
/*
* initialise the /proc/fs/cachefiles/ directory
*/
int __init cachefiles_proc_init(void)
{
_enter("");
if (!proc_mkdir("fs/cachefiles", NULL))
goto error_dir;
if (!proc_create("fs/cachefiles/histogram", S_IFREG | 0444, NULL,
&cachefiles_histogram_fops))
goto error_histogram;
_leave(" = 0");
return 0;
error_histogram:
remove_proc_entry("fs/cachefiles", NULL);
error_dir:
_leave(" = -ENOMEM");
return -ENOMEM;
}
示例5: alignment_init
/*
* This needs to be done after sysctl_init, otherwise sys/ will be
* overwritten. Actually, this shouldn't be in sys/ at all since
* it isn't a sysctl, and it doesn't contain sysctl information.
* We now locate it in /proc/cpu/alignment instead.
*/
static int __init alignment_init(void)
{
struct proc_dir_entry *dir, *res;
dir = proc_mkdir("cpu", NULL);
if (!dir)
return -ENOMEM;
res = proc_create_data("alignment", S_IWUSR | S_IRUGO, dir,
&alignment_proc_fops, &se_usermode);
if (!res)
return -ENOMEM;
res = proc_create_data("kernel_alignment", S_IWUSR | S_IRUGO, dir,
&alignment_proc_fops, &se_kernmode_warn);
if (!res)
return -ENOMEM;
return 0;
}
示例6: acpi_battery_init
static int __init
acpi_battery_init (void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_battery_init");
acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
if (!acpi_battery_dir)
return_VALUE(-ENODEV);
acpi_battery_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_battery_driver);
if (result < 0) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
return_VALUE(0);
}
示例7: divert_dev_init
int
divert_dev_init(void)
{
init_waitqueue_head(&rd_queue);
#ifdef CONFIG_PROC_FS
isdn_proc_entry = proc_mkdir("isdn", init_net.proc_net);
if (!isdn_proc_entry)
return (-1);
isdn_divert_entry = proc_create("divert", S_IFREG | S_IRUGO,
isdn_proc_entry, &isdn_fops);
if (!isdn_divert_entry) {
remove_proc_entry("isdn", init_net.proc_net);
return (-1);
}
#endif /* CONFIG_PROC_FS */
return (0);
} /* divert_dev_init */
示例8: rtas_init
static void __init rtas_init(void)
{
struct proc_dir_entry *rtas_dir, *entry;
rtas_dir = proc_mkdir("rtas", 0);
if (!rtas_dir) {
printk(KERN_ERR "Failed to create rtas proc directory\n");
} else {
entry = create_proc_entry("error_log", S_IRUSR, rtas_dir);
if (entry)
entry->proc_fops = &proc_rtas_log_operations;
else
printk(KERN_ERR "Failed to create rtas/error_log proc entry\n");
}
if (kernel_thread(rtasd, 0, CLONE_FS) < 0)
printk(KERN_ERR "Failed to start RTAS daemon\n");
printk(KERN_ERR "RTAS daemon started\n");
}
示例9: proc_root_init
void __init proc_root_init(void)
{
int err;
proc_init_inodecache();
err = register_filesystem(&proc_fs_type);
if (err)
return;
proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
err = PTR_ERR(proc_mnt);
if (IS_ERR(proc_mnt)) {
unregister_filesystem(&proc_fs_type);
return;
}
proc_symlink("mounts", NULL, "self/mounts");
proc_net_init();
#ifdef CONFIG_SYSVIPC
proc_mkdir("sysvipc", NULL);
#endif
proc_mkdir("fs", NULL);
proc_mkdir("driver", NULL);
proc_mkdir("fs/nfsd", NULL); /* somewhere for the nfsd filesystem to be mounted */
#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)
/* just give it a mountpoint */
proc_mkdir("openprom", NULL);
#endif
proc_tty_init();
#ifdef CONFIG_PROC_DEVICETREE
proc_device_tree_init();
#endif
proc_mkdir("bus", NULL);
#if defined(CONFIG_MIPS_BRCM)
proc_brcm = proc_mkdir("brcm", NULL);
proc_brcm_init(proc_brcm);
#endif
proc_sys_init();
}
示例10: my_init
static int my_init (void) {
proc_mydev = proc_mkdir(MYDEV,0);
proc_hello = create_proc_entry(HELLO,0,proc_mydev);
proc_hello->read_proc = read_hello;
proc_hello->write_proc = write_hello;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,29)
proc_hello->owner = THIS_MODULE;
#endif
hello_data.proc_hello_value=kmalloc(PROC_HELLO_BUFLEN,GFP_KERNEL);
hello_data.proc_hello_flag=0;
hello_data.proc_hello_bitpos=0;
// module init message
printk(KERN_ALERT "2470:5.6: main initialized!\n");
return 0;
}
示例11: proc_demo_init
int __init proc_demo_init(void){
printk("------------module init--------------------\n");
proc_entry_base = proc_mkdir(PROC_DIR_NAME, NULL);
proc_bin2dec_entry = proc_create(PROC_BIN2DEC_NAME, 0666, proc_entry_base, &proc_bin2dec_ops);
proc_readonly_entry = proc_create(PROC_READONLY_NAME, 0444, proc_entry_base, &proc_readonly_ops);
if(!(proc_entry_base || proc_bin2dec_entry || proc_readonly_entry)){
return -1;
}
printk("------------module init finish--------------------\n");
return 0;
}
示例12: psf_init
static int __init psf_init(void)
{
int i;
struct psf_entry *p;
int rc;
for (i = 0; i < ARRAY_SIZE(psf_table); i++) {
p = &psf_table[i];
if (p->size == -1) {
p->data = proc_mkdir(p->name, psf_parent(p));
BUG_ON(p->data == NULL);
} else {
rc = psf_create_file(p);
if (rc < 0)
return rc;
}
}
return 0;
}
示例13: proc_xm_init
static int __init proc_xm_init(void)
{
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *res;
struct proc_dir_entry *proc_xm_dir = NULL;
proc_xm_dir = proc_mkdir("xiaoqiang", NULL);
res = proc_create("model", 0444, proc_xm_dir,
&model_proc_fops);
if (!res)
return -ENOMEM;
res = proc_create("reset", 0444, proc_xm_dir,
&reset_proc_fops);
if (!res)
return -ENOMEM;
#endif
return 0;
}
示例14: ipv6_proc_init_net
static int __net_init ipv6_proc_init_net(struct net *net)
{
if (!proc_create("sockstat6", S_IRUGO, net->proc_net,
&sockstat6_seq_fops))
return -ENOMEM;
if (!proc_create("snmp6", S_IRUGO, net->proc_net, &snmp6_seq_fops))
goto proc_snmp6_fail;
net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net);
if (!net->mib.proc_net_devsnmp6)
goto proc_dev_snmp6_fail;
return 0;
proc_dev_snmp6_fail:
remove_proc_entry("snmp6", net->proc_net);
proc_snmp6_fail:
remove_proc_entry("sockstat6", net->proc_net);
return -ENOMEM;
}
示例15: ide_proc_port_register_devices
void ide_proc_port_register_devices(ide_hwif_t *hwif)
{
struct proc_dir_entry *ent;
struct proc_dir_entry *parent = hwif->proc;
ide_drive_t *drive;
char name[64];
int i;
ide_port_for_each_dev(i, drive, hwif) {
if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0)
continue;
drive->proc = proc_mkdir(drive->name, parent);
if (drive->proc)
ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name);
ent = proc_symlink(drive->name, proc_ide_root, name);
if (!ent) return;
}
}