unresolved symbols.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  Hi friends.

  I get this output when i do insmod with a module that 
try to make a character device:

unresolved symbol module_unregister_chrdev
unresolved symbol module_register_chrdev

  The code compile okey but with many warnings. This
is the module:

---------------------------------------------------------
/*
 * chardev.c
 * Copyright (C) 1998-1999 by Ori Pomerantz.
 * Crea un dispositivo de carÃcter.
 */

#define __KERNEL__
#define MODULE

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/modversions.h>
#include <linux/fs.h>
#include <linux/wrapper.h>
#include <asm/uaccess.h>

#define SUCCESS 0
#define DEVICE_NAME "char_dev"
#define BUF_LEN 80
#define _LOOSE_KERNEL_NAMES

MODULE_LICENSE("GPL");

static int Device_Open = 0;
static char Message[BUF_LEN];
static char *Message_Ptr;
static int device_open(struct inode *inode, struct file *file)
{
  static int counter = 0;
  printk("Device: %d.%d\n", inode->i_rdev >> 8, inode->i_rdev & 0xFF);
  if (Device_Open)
    return -EBUSY;
  Device_Open++;
  sprintf(Message, "Si te lo dije una vez, te lo digo %d veces - %s",        counter++, "Hola, mundo\n");
  Message_Ptr = Message;
  MOD_INC_USE_COUNT;
  return SUCCESS;
}

static int device_release(struct inode *inode,  struct file *file)
{
  Device_Open --;
  MOD_DEC_USE_COUNT;
  return 0;
}

static ssize_t device_read(struct file *file, char *buffer, size_t length, loff_t *offset)
{
  int bytes_read = 0;
  if (*Message_Ptr == 0)
    return 0;
  while (length && *Message_Ptr)
  {
    put_user(*(Message_Ptr++), buffer++);
    length --;
    bytes_read ++;
  }
  return bytes_read;
}

static ssize_t device_write(struct file *file, const char *buffer, size_t length, loff_t *offset)
{
  return -EINVAL;
}

static int Major;

struct file_operations Fops = { NULL, device_read, device_write, NULL, NULL, NULL, NULL, device_open, NULL, device_release };

int init_module()
{
  Major = module_register_chrdev(0, DEVICE_NAME, &Fops);
  if (Major < 0)
  {
    printk ("dispositivo %s fallà con %d\n", "Lo siento, registrando el carÃcter", Major);
    return Major;
  }
  printk ("%s El nÃmero mayor del dispositivo es %d.\n", "El registro es un Ãxito.", Major);
  printk ("si quieres hablar con el controlador del dispositivo,\n");
  printk ("tendrÃs que crear un archivo de dispositivo. \n");
  printk ("Te sugerimos que uses:\n");
  printk ("mknod <nombre> c %d <menor>\n", Major);
  printk ("Puedes probar diferentes nÃmeros menores %s", "y ver que pasa.\n");
  return 0;
}

void cleanup_module()
{
  int ret;
  ret = module_unregister_chrdev(Major, DEVICE_NAME);
  if (ret < 0)
    printk("Error en unregister_chrdev: %d\n", ret);
}
-------------------------------------------------------------

  ÂWhat is a "unresolved symbol"?

  As ever, Thank you very much, in advance.

  Regards.

  Jose.
 

http://linuxespana.scripterz.org

FreeBSD RELEASE 4.8.
Mandrake Linux 9.1 Kernel 2.4.21 XFS.
Registered Linux User #213309.
Memories..... You are talking about memories.
Rick Deckard. Blade Runner.

_____________________________________________________________
Get your own free tiggerfan.com email address!!
DisneySites!! - http://www.disneysites.com/webmail/tiggerfan

_____________________________________________________________
Select your own custom email address for FREE! Get you@yourchoice.com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux