2005-04-27 07:59:47 +04:00
/*
* udev . h
*
* Copyright ( C ) 2003 Greg Kroah - Hartman < greg @ kroah . com >
2005-03-04 23:33:57 +03:00
* Copyright ( C ) 2003 - 2005 Kay Sievers < kay . sievers @ vrfy . org >
2005-04-27 07:59:47 +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 .
*
*/
2004-03-23 09:22:20 +03:00
# ifndef _UDEV_H_
# define _UDEV_H_
2005-04-27 07:59:47 +04:00
2005-02-09 06:37:32 +03:00
# include <sys/types.h>
2003-12-02 11:26:46 +03:00
# include <sys/param.h>
2004-03-23 09:22:20 +03:00
# include "libsysfs/sysfs/libsysfs.h"
2005-02-21 16:48:12 +03:00
# include "list.h"
2005-04-27 07:59:47 +04:00
2003-12-03 12:08:46 +03:00
# define COMMENT_CHARACTER '#'
2005-03-04 23:13:18 +03:00
# define LINE_SIZE 512
2005-03-07 06:29:43 +03:00
# define NAME_SIZE 128
# define PATH_SIZE 256
2004-11-29 15:44:01 +03:00
# define USER_SIZE 32
2004-09-05 20:05:29 +04:00
# define SEQNUM_SIZE 32
2005-03-07 06:29:43 +03:00
# define VALUE_SIZE 128
2004-02-27 06:40:32 +03:00
2005-02-09 10:43:18 +03:00
# define DEFAULT_PARTITIONS_COUNT 15
2005-07-06 16:42:26 +04:00
# define UDEV_ALARM_TIMEOUT 120
2005-02-09 10:43:18 +03:00
2005-07-22 20:35:58 +04:00
struct udev_rules ;
2005-02-21 15:45:04 +03:00
enum device_type {
2005-03-12 23:41:57 +03:00
DEV_UNKNOWN ,
DEV_CLASS ,
DEV_BLOCK ,
DEV_NET ,
DEV_DEVICE ,
2005-02-21 15:45:04 +03:00
} ;
2003-10-21 09:48:44 +04:00
struct udevice {
2005-03-07 06:29:43 +03:00
char devpath [ PATH_SIZE ] ;
char subsystem [ NAME_SIZE ] ;
2005-04-02 19:45:35 +04:00
char action [ NAME_SIZE ] ;
2004-11-29 04:15:55 +03:00
2005-03-12 23:41:57 +03:00
enum device_type type ;
2005-03-07 06:29:43 +03:00
char name [ PATH_SIZE ] ;
char devname [ PATH_SIZE ] ;
2005-03-05 07:35:31 +03:00
struct list_head symlink_list ;
2005-06-05 06:57:03 +04:00
int symlink_final ;
2004-11-29 15:44:01 +03:00
char owner [ USER_SIZE ] ;
2005-06-05 06:57:03 +04:00
int owner_final ;
2004-11-29 15:44:01 +03:00
char group [ USER_SIZE ] ;
2005-06-05 06:57:03 +04:00
int group_final ;
2004-11-29 04:15:55 +03:00
mode_t mode ;
2005-06-05 06:57:03 +04:00
int mode_final ;
2005-02-21 15:44:39 +03:00
dev_t devt ;
2005-04-02 19:45:35 +04:00
struct list_head run_list ;
2005-06-05 06:57:03 +04:00
int run_final ;
2005-06-26 20:55:24 +04:00
struct list_head env_list ;
2004-11-29 04:15:55 +03:00
2005-03-07 06:29:43 +03:00
char tmp_node [ PATH_SIZE ] ;
2004-02-17 08:44:28 +03:00
int partitions ;
2005-04-02 19:45:35 +04:00
int ignore_device ;
2004-11-13 16:43:24 +03:00
int ignore_remove ;
[PATCH] first stupid try for a rule compose gui
On Mon, Mar 15, 2004 at 09:28:17PM +0100, Kay Sievers wrote:
> Here is a first simple and pretty stupid try to make a simple tool for
> composing of a udev rule.
>
> It reads the udevdb to get all currently handled devices and presents a
> list, where you can choose the device to compose the rule for.
>
> The composed rule is just printed out in a window, nothing else by now.
>
> Do we want something like this?
> Nevermind, I always wanted to know, how this newt thing works :)
Here is the next step, I still can't sleep and there are to many patches
pending to make something useful :)
Cause nobody wanted to play with me, I've made a screenshot.
The device list is sorted in alphabetical order now and if there are only
a few recently discovered devices, they are placed on top of the list.
For those who want to have a look:
http://vrfy.org/projects/udev/udevruler.png
The patch applies on top of today's mmap() patch. The db format is
changed to have the file and line number of the applied rule. So it
should be easy to edit the matching rule with this beast. It compiles
with "make all udevruler".
2004-03-24 05:24:25 +03:00
int config_line ;
2005-03-07 06:29:43 +03:00
char config_file [ PATH_SIZE ] ;
char bus_id [ NAME_SIZE ] ;
char program_result [ PATH_SIZE ] ;
2004-02-13 09:51:44 +03:00
char kernel_number [ NAME_SIZE ] ;
char kernel_name [ NAME_SIZE ] ;
2004-10-19 06:11:51 +04:00
int test_run ;
2003-10-21 09:48:44 +04:00
} ;
2005-07-22 20:35:58 +04:00
extern int udev_init_device ( struct udevice * udev , const char * devpath , const char * subsystem , const char * action ) ;
extern void udev_cleanup_device ( struct udevice * udev ) ;
extern int udev_process_event ( struct udev_rules * rules , struct udevice * udev ) ;
2004-10-19 06:11:51 +04:00
extern int udev_add_device ( struct udevice * udev , struct sysfs_class_device * class_dev ) ;
extern int udev_remove_device ( struct udevice * udev ) ;
2003-12-03 12:08:46 +03:00
extern void udev_init_config ( void ) ;
[PATCH] Make udev/udevstart be one binary
Hi,
The following patch makes udev/udevstart be a common binary. First,
doing this grows udev by a total of 1.8kB (ppc32, stripped) whereas
udevstart by itself is 6.4kB. I know you mentioned being able to
replace udevstart with a script, but at 1.8kB I don't think it'll be
easy to beat this with size there. Next, the following are by-eye
timings of before, after, and with devfs on a slow, but still usable
embedded platform (config stripped down to more-or-less bare for
ramdisk):
-- Embedded Planet RPX LITE, 64Mhz MPC 823e --
devfs : 15.333s, 15.253s, 14.988s (15.191s avg)
udev-pristine : 18.675s, 18.079s, 18.418s (18.390s avg)
udev-multi : 14.587s, 14.747s, 14.868s (14.734s avg)
The patch ends up being rather large to add this, as in doing so I ended
up making all refs (that I hit..) to devpath/subsystem be marked as
'const'.
Signed-off-by: Tom Rini <trini@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2004-08-10 11:50:21 +04:00
extern int udev_start ( void ) ;
2005-02-21 15:44:39 +03:00
extern int udev_make_node ( struct udevice * udev , const char * file , dev_t devt , mode_t mode , uid_t uid , gid_t gid ) ;
2003-04-11 07:04:38 +04:00
2005-03-07 06:29:43 +03:00
extern char sysfs_path [ PATH_SIZE ] ;
extern char udev_root [ PATH_SIZE ] ;
extern char udev_db_path [ PATH_SIZE ] ;
extern char udev_config_filename [ PATH_SIZE ] ;
extern char udev_rules_filename [ PATH_SIZE ] ;
2005-03-27 03:11:03 +04:00
extern int udev_log_priority ;
2005-04-02 19:45:35 +04:00
extern int udev_run ;
2003-10-22 07:19:09 +04:00
2005-04-27 07:59:47 +04:00
# endif