From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261537AbVEIWFI (ORCPT ); Mon, 9 May 2005 18:05:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261538AbVEIWFI (ORCPT ); Mon, 9 May 2005 18:05:08 -0400 Received: from atpro.com ([12.161.0.3]:19728 "EHLO atpro.com") by vger.kernel.org with ESMTP id S261537AbVEIWFA (ORCPT ); Mon, 9 May 2005 18:05:00 -0400 Date: Mon, 9 May 2005 18:04:12 -0400 From: Jim Crilly To: KC Cc: Erik Mouw , linux-kernel@vger.kernel.org Subject: Re: proc_mknod() replacement Message-ID: <20050509220411.GA15932@mail> Mail-Followup-To: KC , Erik Mouw , linux-kernel@vger.kernel.org References: <5eb4b06505050904172655477c@mail.gmail.com> <20050509154147.GC5799@harddisk-recovery.com> <5eb4b065050509100638bd7970@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5eb4b065050509100638bd7970@mail.gmail.com> User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On 05/10/05 01:06:08AM +0800, KC wrote: > Hi, > > Thanks for reply. > > On 5/9/05, Erik Mouw wrote: > > On Mon, May 09, 2005 at 07:17:44PM +0800, KC wrote: > > > I found that proc_mknod() had been removed from kernel 2.6.x. > > > Any replacement ? > > > > > > Or how can I create file, device node or dir from device driver ? > > > > You don't do that from a device driver in the first place. Have a look > > at udev, it will do what you want from userspace. > > For regular file, I do agree with you. But for device node, I don't see > anything wrong by create it directly from kernel space. > In fact, I do not understand why proc_mknod() is removed from > 2.6.x ... I will be happy if someone can tell me why. Because naming of devices is a policy that shouldn't be defined in the kernel. > > Why I want to use proc_mknod() in driver ? I write a small package, ovi-dev, > which can be downloaded from > http://www.sourceforge.net/projects/ovi > The ovi-dev will scan the PCI bus and if it found, eg, 3 PCI devices, it > will create 3 device entries (nodes) automatically at module load time. > So number of device entries (nodes) will match number of devices > of the system ... well, UNIX/Linux doesn't work that way ... there are a lot > of device entries ... but no corresponding hardware existed. You must have not have converted to udev, it's sort of like devfs in that device nodes are created dynamicly but it's a userspace daemon that adds/removes device nodes in response to hotplug events generated by the kernel. > > The proc_mknod() can fix the problems ... but it was removed from 2.6.x ... > too bad ... at least for me. So I'm looking for an alternative way to create > device entry under /dev from drivers instead of /proc ... but still don't know > how. Anyone know how to do that ? It should be done at module_init() > and the entry should be removed at module_exit(). I believe if you use the driver core class stuff (i.e. class_simple_device_add) it should add device nodes in sysfs and generate hotplug events for udev. > > > Thanks > KC > Jim.