コード例 #1
0
static void ida_procinit(int i)
{
	struct proc_dir_entry *pd;

	if (proc_array == NULL) {
		proc_array = kmalloc(sizeof(struct proc_dir_entry), GFP_KERNEL);
		if (!proc_array) return;
		memset(proc_array, 0, sizeof(struct proc_dir_entry));
		proc_array->namelen = 5;
		proc_array->name = "array";
		proc_array->mode = S_IFDIR | S_IRUGO | S_IXUGO;
		proc_array->nlink = 2;
		proc_array->uid = 0;
		proc_array->gid = 0;
		proc_array->size = 0;
		proc_array->ops = &proc_dir_inode_operations;
		proc_register_dynamic(&proc_root, proc_array);
	}

	pd = kmalloc(sizeof(struct proc_dir_entry), GFP_KERNEL);
	if (!pd) return;
	memset(pd, 0, sizeof(struct proc_dir_entry));
	pd->namelen = 4;
	pd->name = hba[i]->devname;
	pd->mode = S_IFREG | S_IRUGO;
	pd->nlink = 1;
	pd->uid = 0;
	pd->gid = 0;
	pd->size = 0;
	pd->ops = &proc_diskarray_inode_operations;
	pd->get_info = ida_proc_get_info;
	
	hba[i]->proc = (int)pd;
	proc_register_dynamic(proc_array, pd);
}
コード例 #2
0
ファイル: jiq.c プロジェクト: crond/dd
int jiq_init(void)
{
    /* these lines are in jiq_init() */
    jiq_task.routine = jiq_print_tq;
    jiq_task.data = (void *)&jiq_data;

#ifdef USE_PROC_REGISTER
    proc_register_dynamic(&proc_root, &jiq_proc_sched);
    proc_register_dynamic(&proc_root, &jiq_proc_timer);
    proc_register_dynamic(&proc_root, &jiq_proc_immed);
    proc_register_dynamic(&proc_root, &jiq_proc_run_timer);
#else
    create_proc_read_entry("jiqsched", 0, NULL, jiq_read_sched, NULL);
    create_proc_read_entry("jiqtimer", 0, NULL, jiq_read_timer, NULL);
    create_proc_read_entry("jiqimmed", 0, NULL, jiq_read_immed, NULL);
    create_proc_read_entry("jitimer", 0, NULL, jiq_read_run_timer, NULL);
#ifdef HAVE_TASKLETS
    create_proc_read_entry("jiqtasklet", 0, NULL, jiq_read_tasklet, NULL);
#endif
#endif



#ifndef JIT_DEBUG
    EXPORT_NO_SYMBOLS;
#endif
    return 0; /* succeed */
}
コード例 #3
0
ファイル: jit.c プロジェクト: dot-Sean/linux_drivers
int init_module(void)
{
    proc_register_dynamic(&proc_root, &jit_proc_busy);
    proc_register_dynamic(&proc_root, &jit_proc_sched);
    proc_register_dynamic(&proc_root, &jit_proc_queue);
    proc_register_dynamic(&proc_root, &jit_proc_self);
    proc_register_dynamic(&proc_root, &jit_proc_current);
#ifndef JIT_DEBUG
    register_symtab(NULL); /* hide symbols */
#endif
    return 0; /* succeed */
}
コード例 #4
0
ファイル: pciregions.c プロジェクト: SPLURGE831/practice
int init_module(void)
{
#ifdef USE_PROC_REGISTER
    proc_register_dynamic(&proc_root, &pciregions_proc_entry);
#else
    create_proc_read_entry("pciregions", 0, NULL, pciregions_read_proc, NULL);
#endif
    return 0;
}
コード例 #5
0
ファイル: main.c プロジェクト: dot-Sean/linux_drivers
int init_module(void)
{
    int result, i;

    /*
     * Register your major, and accept a dynamic number
     */
    result = register_chrdev(scull_major, "scull", &scull_fops);
    if (result < 0) {
        printk(KERN_WARNING "scull: can't get major %d\n",scull_major);
        return result;
    }
    if (scull_major == 0) scull_major = result; /* dynamic */

    /* 
     * allocate the devices -- we can't have them static, as the number
     * can be specified at load time
     */
    scull_devices = kmalloc(scull_nr_devs * sizeof (Scull_Dev), GFP_KERNEL);
    if (!scull_devices) {
        result = -ENOMEM;
        goto fail_malloc;
    }
    memset(scull_devices, 0, scull_nr_devs * sizeof (Scull_Dev));
    for (i=0; i < scull_nr_devs; i++) {
        scull_devices[i].quantum = scull_quantum;
        scull_devices[i].qset = scull_qset;
    }

    /* At this point call the init function for any friend device */
    if ( (result = scull_p_init()) )
        goto fail_pipe;
    if ( (result = scull_access_init()) )
        goto fail_access;
    /* ... */

#ifndef SCULL_DEBUG
    REGISTER_SYMTAB(NULL); /* otherwise, leave global symbols visible */
#endif

#ifdef SCULL_USE_PROC /* only when available */
    /* this is the last line in init_module */
    proc_register_dynamic(&proc_root, &scull_proc_entry);
#endif

    return 0; /* succeed */

  fail_access: scull_p_cleanup();
  fail_pipe:   kfree(scull_devices);
  fail_malloc: unregister_chrdev(scull_major, "scull");
    return result;
}
コード例 #6
0
ファイル: sleep.c プロジェクト: ilusion-linux/LuCAS
/* Inicializa el módulo - registra el fichero proc */
int init_module()
{
  /* Tiene éxito si proc_register_dynamic tiene éxito,
   * falla en otro caso */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
  return proc_register(&proc_root, &Our_Proc_File);
#else
  return proc_register_dynamic(&proc_root, &Our_Proc_File);
#endif 

  /* proc_root es el directorio raiz para el sistema de
   * ficheros proc (/proc). Es decir, donde queremos que sea
   * localizado nuestro fichero. */
}
コード例 #7
0
ファイル: main.c プロジェクト: dot-Sean/linux_drivers
int init_module(void)
{
    int result, i;

    /*
     * Register your major, and accept a dynamic number
     */
    result = register_chrdev(scullv_major, "scullv", &scullv_fops);
    if (result < 0) return result;
    if (scullv_major == 0) scullv_major = result; /* dynamic */

    /* 
     * allocate the devices -- we can't have them static, as the number
     * can be specified at load time
     */
    scullv_devices = kmalloc(scullv_devs * sizeof (ScullV_Dev), GFP_KERNEL);
    if (!scullv_devices) {
        result = -ENOMEM;
        goto fail_malloc;
    }
    memset(scullv_devices, 0, scullv_devs * sizeof (ScullV_Dev));
    for (i=0; i < scullv_devs; i++) {
        scullv_devices[i].order = scullv_order;
        scullv_devices[i].qset = scullv_qset;
    }

#ifdef SCULLV_USE_PROC /* only when available */
    /* this is the last line in init_module */
    proc_register_dynamic(&proc_root, &scullv_proc_entry);
#endif

    return 0; /* succeed */

  fail_malloc: unregister_chrdev(scullv_major, "scullv");
    return result;
}
コード例 #8
0
ファイル: pcidata.c プロジェクト: dot-Sean/linux_drivers
int init_module(void)
{
    proc_register_dynamic(&proc_root, &pcimod_proc_entry);
    return 0;
}
コード例 #9
0
ファイル: main.c プロジェクト: crond/dd
static inline void create_proc_read_entry (const char *name, mode_t mode,
                struct proc_dir_entry *base, void *read_func, void *data)
{
    proc_register_dynamic (&proc_root, &scullp_proc_entry);
}
コード例 #10
0
ファイル: main.c プロジェクト: dot-Sean/linux_drivers
static void scull_create_proc()
{
    proc_register_dynamic(&proc_root, &scull_proc_entry);
}