2003-07-17 12:24:51 +04:00
/*
2005-03-13 00:36:32 +03:00
* udev_rules . h
2003-07-17 12:24:51 +04:00
*
* Userspace devfs
*
2004-01-27 06:21:58 +03:00
* Copyright ( C ) 2003 , 2004 Greg Kroah - Hartman < greg @ kroah . com >
2003-07-17 12:24:51 +04:00
*
* This program is free software ; you can redistribute it and / or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License .
*
* This program is distributed in the hope that it will be useful , but
* WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* General Public License for more details .
*
* You should have received a copy of the GNU General Public License along
* with this program ; if not , write to the Free Software Foundation , Inc . ,
* 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*
*/
# ifndef NAMEDEV_H
# define NAMEDEV_H
2005-03-13 00:36:32 +03:00
# include "libsysfs/sysfs/libsysfs.h"
2003-08-06 10:57:23 +04:00
# include "udev.h"
2003-07-24 02:56:56 +04:00
# include "list.h"
2003-07-19 16:06:55 +04:00
2005-02-21 16:48:12 +03:00
# define FIELD_KERNEL "KERNEL"
# define FIELD_SUBSYSTEM "SUBSYSTEM"
2004-02-17 08:44:28 +03:00
# define FIELD_BUS "BUS"
# define FIELD_SYSFS "SYSFS"
# define FIELD_ID "ID"
# define FIELD_PROGRAM "PROGRAM"
# define FIELD_RESULT "RESULT"
2004-11-13 07:21:12 +03:00
# define FIELD_DRIVER "DRIVER"
2004-02-17 08:44:28 +03:00
# define FIELD_NAME "NAME"
# define FIELD_SYMLINK "SYMLINK"
2004-03-11 09:35:37 +03:00
# define FIELD_OWNER "OWNER"
# define FIELD_GROUP "GROUP"
# define FIELD_MODE "MODE"
2005-02-14 08:03:06 +03:00
# define FIELD_OPTIONS "OPTIONS"
2004-02-17 08:44:28 +03:00
2005-03-13 00:55:08 +03:00
# define OPTION_LAST_RULE "last_rule"
2005-03-04 23:00:43 +03:00
# define OPTION_IGNORE_DEVICE "ignore_device"
# define OPTION_IGNORE_REMOVE "ignore_remove"
# define OPTION_PARTITIONS "all_partitions"
2004-02-17 08:44:28 +03:00
# define MAX_SYSFS_PAIRS 5
2003-12-23 09:31:35 +03:00
2004-03-27 12:21:46 +03:00
# define RULEFILE_SUFFIX ".rules"
2004-02-24 06:31:14 +03:00
2003-12-23 09:31:35 +03:00
struct sysfs_pair {
2005-03-07 06:29:43 +03:00
char file [ PATH_SIZE ] ;
2003-12-23 09:31:35 +03:00
char value [ VALUE_SIZE ] ;
} ;
2003-07-24 02:56:56 +04:00
2005-03-13 00:36:32 +03:00
struct udev_rule {
2003-07-24 02:56:56 +04:00
struct list_head node ;
2005-02-21 16:01:23 +03:00
char kernel [ NAME_SIZE ] ;
2005-03-07 06:29:43 +03:00
char subsystem [ NAME_SIZE ] ;
char bus [ NAME_SIZE ] ;
char id [ NAME_SIZE ] ;
2005-02-21 16:01:23 +03:00
struct sysfs_pair sysfs_pair [ MAX_SYSFS_PAIRS ] ;
2005-03-07 06:29:43 +03:00
char program [ PATH_SIZE ] ;
char result [ PATH_SIZE ] ;
char driver [ NAME_SIZE ] ;
char name [ PATH_SIZE ] ;
char symlink [ PATH_SIZE ] ;
2005-02-14 08:03:06 +03:00
2004-11-29 15:44:01 +03:00
char owner [ USER_SIZE ] ;
char group [ USER_SIZE ] ;
mode_t mode ;
2005-02-14 08:03:06 +03:00
2005-03-13 00:55:08 +03:00
int last_rule ;
2005-02-14 08:03:06 +03:00
int ignore_device ;
2004-11-13 16:43:24 +03:00
int ignore_remove ;
2005-03-13 00:55:08 +03:00
int partitions ;
2005-02-14 08:03:06 +03:00
2005-03-07 06:29:43 +03:00
char config_file [ PATH_SIZE ] ;
[PATCH] add udev logging to info log
On Thu, Jan 15, 2004 at 05:14:16AM +0100, Kay Sievers wrote:
> On Wed, Jan 14, 2004 at 01:10:43PM -0800, Greg KH wrote:
> > On Wed, Jan 14, 2004 at 02:34:26PM -0600, Clay Haapala wrote:
> > > On Wed, 14 Jan 2004, Chris Friesen spake thusly:
> > > >
> > > > Maybe for ones with a matching rule, you could print something like:
> > > >
> > > >
> > > Is the act of printing/syslogging a rule in an of itself?
> >
> > No, as currently the only way stuff ends up in the syslog is if
> > DEBUG=true is used on the build line.
> >
> > But it's sounding like we might want to change that... :)
>
> How about this in the syslog after connect/disconnect?
>
> Jan 15 05:07:45 pim udev[28007]: configured rule in '/etc/udev/udev.rules' at line 17 applied, 'video*' becomes 'video/webcam%n'
> Jan 15 05:07:45 pim udev[28007]: creating device node '/udev/video/webcam0'
> Jan 15 05:07:47 pim udev[28015]: removing device node '/udev/video/webcam0'
Here is a slightly better version. I've created a logging.h file and
moved the debug macros from udev.h in there.
If you type:
'make' - you will get a binary that prints one or two lines to syslog
if a device node is created or deleted
'make LOG=false' - you get a binary that prints asolutely nothing
'make DEBUG=true' - the same as today, it will print all debug lines
2004-01-16 08:53:20 +03:00
int config_line ;
2003-12-04 05:33:58 +03:00
} ;
2005-03-13 00:36:32 +03:00
extern struct list_head udev_rule_list ;
2003-07-24 02:56:56 +04:00
2005-03-13 00:36:32 +03:00
extern int udev_rules_init ( void ) ;
extern int udev_rules_get_name ( struct udevice * udev , struct sysfs_class_device * class_dev ) ;
extern void udev_rules_close ( void ) ;
2003-12-03 05:38:30 +03:00
2005-03-13 00:36:32 +03:00
extern void udev_rule_dump ( struct udev_rule * rule ) ;
extern void udev_rule_list_dump ( void ) ;
2003-07-17 12:24:51 +04:00
# endif