driver receives wrong inode from kernal

From: dnewbold (dnewbold_at_generalstandards.com)
Date: 08/23/04


Date: Mon, 23 Aug 2004 09:16:06 -0500

I'm working with 2.4 (haven't moved to 2.6 yet).
I'm working on several device drivers.
The device major numbers are all assigned dynamically.
The /dev device nodes are created automatically (via scripts) when the
driver modules are loaded.
Yesterday, I loaded multiple drivers and everything went well.
Today, after rebooting and removing some devices, I load fewer drivers (via
their scripts).

But wait! The /dev directory now has the same major number being used by two
entirely different devices.
When my user space app calls open() on the device node created yesterday
(the one whose driver
wasn't loaded today) the kernel passes the request to the driver that is now
using that major number.
Ok. I understand that this is how things work. So ...

    What is the standard/recommended check that is appropriate for the
driver's open service?
    Rubini/Corbet don't address this. While I know I could examine the
device in question to see
    if it is one I deal with, I prefer not to do so as this check sometimes
requires reading other than
    PCI configuration registers. I would like to ask the kernel for the
string passed to the
    register_chrdev() call, but I don't even know if such a service exists.

Thanks for the help.

Please respond to dnewbold@generalstandards.com.

Don Newbold



Relevant Pages

  • Re: Areca Disk Adapter Question
    ... I can't figure out a way to do it as of yet - the 3Ware drivers ... I can create a new raid set and then use "camcontrol rescan" to pick it ... So far so good - the device nodes show up in FreeBSD and all ... I dismount the disk in FreeBSD - now what? ...
    (freebsd-stable)
  • Re: no device for new DVD-ROM
    ... Which device nodes appear depends on your hardware ... > and which drivers are loaded. ... If you want to have symbolic links ...
    (comp.os.linux.hardware)
  • Re: [patch 2.6.21-rc5-git 1/2] fix hotplug for legacy platform drivers
    ... On Monday 02 April 2007 1:10 pm, Dmitry Torokhov wrote: ... * memory allocated for the device allows drivers using such devices ... to be unloaded iwithout waiting for the last reference to the device ... I'll make it say "create sysfs device nodes" to ...
    (Linux-Kernel)
  • Re: can microsoft do this?
    ... > John> any case. ... > 'dd' and some appropriate device nodes and drivers. ... Running as "root" of course... ...
    (comp.os.linux.misc)
  • Re: ACPI Error under 2.6.26-rc*
    ... and attach the rsdp for all of the three cases (good, ACPI Error, ... could you please attach the dmesg output of a 2.6.25.10 kernel which has ... # IPVS transport protocol load balancing support ... # Device Drivers ...
    (Linux-Kernel)