[pso] O mica eroare in exemplul de pe site, de la lab-ul 3

pso@cursuri.cs.pub.ro pso@cursuri.cs.pub.ro
Mon, 21 Mar 2005 21:49:11 +0200


in fct init_module pe care o aveti listata mai jos ca pe site:

int init_module(void)
{

        int i, err;

 if ((err=register_chrdev_region(MKDEV(CASE_MAJOR, 0), CASE_MAX_MINORS,
"case")))
  return err;

        for(i=0; i<CASE_MAX_MINORS; i++) {
                init_waitqueue_head(&devs[i].wq_reads);
                init_waitqueue_head(&devs[i].wq_writes);
  cdev_init(&devs[i].cdev, &case_fops);
  cdev_add(&devs[i].cdev, MKDEV(CASE_MAJOR, i), 1);
        }

        if (register_chrdev(CASE_MAJOR, "case-formater", &case_fops)) {
                printk(KERN_ERR"case: unable to register character device with
major %d\n", CASE_MAJOR);
                return -1;
        }

        if (up_case)
                printk(KERN_INFO"case: using upper case format\n");
        else
                printk(KERN_INFO"case: using lower case format\n");

        return 0;
}



s-a strecurat o greseala si anume:
        if (register_chrdev(CASE_MAJOR, "case-formater", &case_fops)) {
                printk(KERN_ERR"case: unable to register character device with
major %d\n", CASE_MAJOR);
                return -1;
        }

Acest apel al lui register_chrdev trebuie sters! Inianitea lui a fost executat
oricum register_chrdev_region.

Mihaela