Hi,

On Feb 11, 2008 11:41 AM, Thomas Petazzoni
<[EMAIL PROTECTED]> wrote:
> Le Mon, 11 Feb 2008 09:37:48 +0200,
> "Ian Brown" <[EMAIL PROTECTED]> a écrit :
>
> > Is there a way I can check from a kernel module if a device file
> > exists ?
>
> No.
>
> > For example, I want to check if a device file named :
> > "/dev/myDeviceFile" exist (this device file should represent a char
> > device).
>
> You probably don't want to do that, it's considered bad design. Can you
> tell us more about what you're trying to do, so that we could probably
> give you an idea on what to try ?
>
> For information, the device file in /dev must either be created
> manually, or are created automatically by udev [1]. Instead of trying
> to mess up with device files in the kernel, you should probably
> configure udev instead.

Every char or block device has a major and a minor number. The file
/dev/<any file> is just a special file pointing to those major and
minor numbers in order to access some device driver from userland. You
can have a driver running withtou any dev file accessing it or a dev
file pointing to no driver.

As Thomas said, you probably don't want to do that.

Br,

David cohen

>
> Sincerly,
>
> Thomas
>
> [1] http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
> --
> Thomas Petazzoni, Free Electrons
> Free Embedded Linux Training Materials
> on http://free-electrons.com/training
> (More than 1500 pages!)
>

Reply via email to